localconnectivityservice/dun/utils/inc/DunSignalNotify.h
changeset 0 c3e98f10fcf4
child 11 c47ebe2ac36c
equal deleted inserted replaced
-1:000000000000 0:c3e98f10fcf4
       
     1 /*
       
     2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Monitors signal changes on network side and reports changes
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CDUNSIGNALNOTIFY_H
       
    20 #define C_CDUNSIGNALNOTIFY_H
       
    21 
       
    22 #include "DunTransUtils.h"
       
    23 #include "DunAtCmdHandler.h"
       
    24 
       
    25 /**
       
    26  *  Class for monitoring line status and reporting changes
       
    27  *
       
    28  *  @lib dunutils.lib
       
    29  *  @since S60 v3.2
       
    30  */
       
    31 NONSHARABLE_CLASS( CDunSignalNotify ) : public CActive
       
    32     {
       
    33 
       
    34 public:
       
    35 
       
    36     /**
       
    37      * Two-phased constructor.
       
    38      * @param aUtility Pointer to common utility class
       
    39      * @return Instance of self
       
    40      */
       
    41 	static CDunSignalNotify* NewL( MDunTransporterUtilityAux* aUtility );
       
    42 
       
    43     /**
       
    44     * Destructor.
       
    45     */
       
    46     virtual ~CDunSignalNotify();
       
    47 
       
    48     /**
       
    49      * Resets data to initial values
       
    50      *
       
    51      * @since S60 3.2
       
    52      * @return None
       
    53      */
       
    54     void ResetData();
       
    55 
       
    56     /**
       
    57      * Adds callback for line status change controlling
       
    58      * The callback will be called when line status change is detected in
       
    59      * endpoint
       
    60      *
       
    61      * @since S60 3.2
       
    62      * @param aCallback Callback to call when line status changes
       
    63      * @return Symbian error code on error, KErrNone otherwise
       
    64      */
       
    65     TInt AddCallback( MDunConnMon* aCallback );
       
    66 
       
    67     /**
       
    68      * Adds callback for endpoint readiness
       
    69      * The callback will be called when the endpoint is ready or not ready
       
    70      *
       
    71      * @since S60 5.0
       
    72      * @param aERCallback Callback to call when writes can/can't be done
       
    73      * @return Symbian error code on error, KErrNone otherwise
       
    74      */
       
    75     TInt AddEndpointReadyCallback( MDunEndpointReady* aERCallback );
       
    76 
       
    77     /**
       
    78      * Sets media to use for this endpoint monitor (network side)
       
    79      *
       
    80      * @since S60 3.2
       
    81      * @param aComm RComm pointer to use as the endpoint
       
    82      * @return Symbian error code on error, KErrNone otherwise
       
    83      */
       
    84     TInt SetMedia( RComm* aComm );
       
    85 
       
    86     /**
       
    87      * Issues request to start monitoring the endpoint for line status change
       
    88      *
       
    89      * @since S60 3.2
       
    90      * @return Symbian error code on error, KErrNone otherwise
       
    91      */
       
    92     TInt IssueRequest();
       
    93 
       
    94     /**
       
    95      * Stops monitoring the endpoint for line status change
       
    96      *
       
    97      * @since S60 3.2
       
    98      * @return Symbian error code on error, KErrNone otherwise
       
    99      */
       
   100     TInt Stop();
       
   101 
       
   102 private:
       
   103 
       
   104     CDunSignalNotify( MDunTransporterUtilityAux* aUtility );
       
   105 
       
   106     void ConstructL();
       
   107 
       
   108     /**
       
   109      * Initializes this class
       
   110      *
       
   111      * @since S60 3.2
       
   112      * @return None
       
   113      */
       
   114     void Initialize();
       
   115 
       
   116     /**
       
   117      * Manages signal changes
       
   118      *
       
   119      * @since S60 3.2
       
   120      * @return None
       
   121      */
       
   122     void ManageSignalChange();
       
   123 
       
   124     /**
       
   125      * Reports signal change
       
   126      *
       
   127      * @since S60 3.2
       
   128      * @param aSetMask Set the handshaking lines in the mask
       
   129      * @param aClearMask Clear the handshaking lines in the mask.
       
   130      * @return None
       
   131      */
       
   132     void ReportSignalChange( TUint aSetMask, TUint aClearMask );
       
   133 
       
   134     /**
       
   135      * Reports endpoint ready or not ready
       
   136      *
       
   137      * @since S60 5.0
       
   138      * @param aReady ETrue if endpoint ready, EFalse otherwise
       
   139      * @return None
       
   140      */
       
   141     void ReportEndpointReady( TBool aReady );
       
   142 
       
   143 // from base class CActive
       
   144 
       
   145     /*
       
   146      * From CActive.
       
   147      * Gets called when line status changes
       
   148      *
       
   149      * @since S60 3.2
       
   150      * @return None
       
   151      */
       
   152     void RunL();
       
   153 
       
   154     /**
       
   155      * From CActive.
       
   156      * Gets called on cancel
       
   157      *
       
   158      * @since S60 3.2
       
   159      * @return None
       
   160      */
       
   161     void DoCancel();
       
   162 
       
   163 private:  // data
       
   164 
       
   165     /**
       
   166      * Callback(s) to call when notification(s) via MDunConnMon to be made
       
   167      * Normally contains only one callback
       
   168      */
       
   169     RPointerArray<MDunConnMon> iCallbacks;
       
   170 
       
   171     /**
       
   172      * Callback(s) to call when notification(s) via MDunEndpointReady to be made
       
   173      * Normally contains only one callback for upstream
       
   174      */
       
   175     RPointerArray<MDunEndpointReady> iERCallbacks;
       
   176 
       
   177     /**
       
   178      * Pointer to common utility class
       
   179      * Not own.
       
   180      */
       
   181     MDunTransporterUtilityAux* iUtility;
       
   182 
       
   183     /**
       
   184      * Current state of signal monitoring: active or inactive
       
   185      */
       
   186     TDunState iSignalNotifyState;
       
   187 
       
   188     /**
       
   189      * Signals to listen with RComm::NotifySignalChange()
       
   190      */
       
   191     TUint iListenSignals;
       
   192 
       
   193     /**
       
   194      * Signals set when RComm::NotifySignalChange() request completes
       
   195      */
       
   196     TUint iSignals;
       
   197 
       
   198     /**
       
   199      * RComm object of network side
       
   200      * Not own.
       
   201      */
       
   202     RComm* iNetwork;
       
   203 
       
   204     };
       
   205 
       
   206 #endif  // C_CDUNSIGNALNOTIFY_H