localconnectivityservice/dun/utils/inc/DunSignalCopy.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:  Copies signals changes between network and local media
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CDUNSIGNALCOPY_H
       
    20 #define C_CDUNSIGNALCOPY_H
       
    21 
       
    22 #include "DunTransporter.h"
       
    23 #include "DunTransUtils.h"
       
    24 #include "DunAtCmdHandler.h"
       
    25 
       
    26 /**
       
    27  *  Class for copying signal changes between to endpoints
       
    28  *
       
    29  *  @lib dunutils.lib
       
    30  *  @since S60 v3.2
       
    31  */
       
    32 NONSHARABLE_CLASS( CDunSignalCopy ) : public CActive
       
    33     {
       
    34 
       
    35 public:
       
    36 
       
    37     /**
       
    38      * Two-phased constructor.
       
    39      * @return Instance of self
       
    40      */
       
    41 	static CDunSignalCopy* NewL();
       
    42 
       
    43     /**
       
    44     * Destructor.
       
    45     */
       
    46     virtual ~CDunSignalCopy();
       
    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 RunL error is detected
       
    59      *
       
    60      * @since S60 3.2
       
    61      * @param aCallback Callback to call when line status changes
       
    62      * @return Symbian error code on error, KErrNone otherwise
       
    63      */
       
    64     TInt AddCallback( MDunConnMon* aCallback );
       
    65 
       
    66     /**
       
    67      * Adds callback for endpoint readiness
       
    68      * The callback will be called when the endpoint is ready or not ready
       
    69      *
       
    70      * @since S60 5.0
       
    71      * @param aEPCallback Callback to call when writes can/can't be done
       
    72      * @return Symbian error code on error, KErrNone otherwise
       
    73      */
       
    74     TInt AddEndpointReadyCallback( MDunEndpointReady* aEPCallback );
       
    75 
       
    76     /**
       
    77      * Sets media to use for this endpoint monitor
       
    78      *
       
    79      * @since S60 3.2
       
    80      * @param aComm RComm pointer to local media side
       
    81      * @param aNetwork RComm pointer to network side
       
    82      * @param aStreamType Stream type for this endpoint
       
    83      * @return Symbian error code on error, KErrNone otherwise
       
    84      */
       
    85     TInt SetMedia( RComm* aComm,
       
    86                    RComm* aNetwork,
       
    87                    TDunStreamType aStreamType );
       
    88 
       
    89     /**
       
    90      * Issues request to start monitoring the endpoint for line status change
       
    91      *
       
    92      * @since S60 3.2
       
    93      * @return Symbian error code on error, KErrNone otherwise
       
    94      */
       
    95     TInt IssueRequest();
       
    96 
       
    97     /**
       
    98      * Stops monitoring the endpoint for line status change
       
    99      *
       
   100      * @since S60 3.2
       
   101      * @return Symbian error code on error, KErrNone otherwise
       
   102      */
       
   103     TInt Stop();
       
   104 
       
   105 private:
       
   106 
       
   107     CDunSignalCopy();
       
   108 
       
   109     void ConstructL();
       
   110 
       
   111     /**
       
   112      * Initializes this class
       
   113      *
       
   114      * @since S60 3.2
       
   115      * @return None
       
   116      */
       
   117     void Initialize();
       
   118 
       
   119     /**
       
   120      * Manages upstream signal changes
       
   121      *
       
   122      * @since S60 3.2
       
   123      * @return None
       
   124      */
       
   125     void ManageSignalChange();
       
   126 
       
   127     /**
       
   128      * Manages signal changes
       
   129      *
       
   130      * @since S60 3.2
       
   131      * @return None
       
   132      */
       
   133     void ManageSignalChangeUpstream();
       
   134 
       
   135     /**
       
   136      * Manages downstream signal changes
       
   137      *
       
   138      * @since S60 3.2
       
   139      * @return None
       
   140      */
       
   141     void ManageSignalChangeDownstream();
       
   142 
       
   143     /**
       
   144      * Changes upstream signal
       
   145      *
       
   146      * @since S60 5.0
       
   147      * @param aSetMask Set the handshaking lines in the mask
       
   148      * @param aClearMask Clear the handshaking lines in the mask
       
   149      * @return None
       
   150      */
       
   151     void ChangeUpstreamSignal( TUint aSetMask, TUint aClearMask );
       
   152 
       
   153     /**
       
   154      * Changes downstream signal
       
   155      *
       
   156      * @since S60 3.2
       
   157      * @param aSetMask Set the handshaking lines in the mask
       
   158      * @param aClearMask Clear the handshaking lines in the mask
       
   159      * @return None
       
   160      */
       
   161     void ChangeDownstreamSignal( TUint aSetMask, TUint aClearMask );
       
   162 
       
   163     /**
       
   164      * Reports endpoint ready or not ready
       
   165      *
       
   166      * @since S60 5.0
       
   167      * @param aReady ETrue if endpoint ready, EFalse otherwise
       
   168      * @return None
       
   169      */
       
   170     void ReportEndpointReady( TBool aReady );
       
   171 
       
   172 // from base class CActive
       
   173 
       
   174     /*
       
   175      * From CActive.
       
   176      * Gets called when line status changes
       
   177      *
       
   178      * @since S60 3.2
       
   179      * @return None
       
   180      */
       
   181     void RunL();
       
   182 
       
   183     /**
       
   184      * From CActive.
       
   185      * Gets called on cancel
       
   186      *
       
   187      * @since S60 3.2
       
   188      * @return None
       
   189      */
       
   190     void DoCancel();
       
   191 
       
   192 private:  // data
       
   193 
       
   194     /**
       
   195      * Callback(s) to call when notification(s) via MDunConnMon to be made
       
   196      * Normally contains only one callback
       
   197      */
       
   198     RPointerArray<MDunConnMon> iCallbacks;
       
   199 
       
   200     /**
       
   201      * Callback(s) to call when notification(s) via MDunEndpointReady to be made
       
   202      * Normally contains only one callback for upstream
       
   203      */
       
   204     RPointerArray<MDunEndpointReady> iERCallbacks;
       
   205 
       
   206     /**
       
   207      * Callback(s) to call when command mode starts or ends
       
   208      * Usually two needed: one for upstream and second for downstream
       
   209      */
       
   210     RPointerArray<MDunCmdModeMonitor> iCmdCallbacks;
       
   211 
       
   212     /**
       
   213      * Used media context: network or local
       
   214      */
       
   215     TDunMediaContext iContextInUse;
       
   216 
       
   217     /**
       
   218      * Used stream type: upstream or downstream
       
   219      */
       
   220     TDunStreamType iStreamType;
       
   221 
       
   222     /**
       
   223      * Current state of connection monitoring: active or inactive
       
   224      */
       
   225     TDunState iSignalCopyState;
       
   226 
       
   227     /**
       
   228      * Signal to listen with RComm::NotifySignalChange()
       
   229      */
       
   230     TUint iListenSignals;
       
   231 
       
   232     /**
       
   233      * Signals set when RComm::NotifySignalChange() request completes
       
   234      */
       
   235     TUint iSignals;
       
   236 
       
   237     /**
       
   238      * RComm object of network side
       
   239      * Not own.
       
   240      */
       
   241     RComm* iNetwork;
       
   242 
       
   243     /**
       
   244      * RComm object of local media side
       
   245      * Not own.
       
   246      */
       
   247     RComm* iComm;
       
   248 
       
   249     };
       
   250 
       
   251 #endif  // C_CDUNSIGNALCOPY_H