connectionmonitoring/connmon/connectionmonitor/inc/connmonasyncstopdaemon.h
changeset 71 9f263f780e41
equal deleted inserted replaced
70:ac5daea24fb0 71:9f263f780e41
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Active object that starts a connection stop operation in a new
       
    15 *               thread and waits for it to complete.
       
    16 */
       
    17 
       
    18 #ifndef CONNMONASYNCSTOPDAEMON_H
       
    19 #define CONNMONASYNCSTOPDAEMON_H
       
    20 
       
    21 class CConnMonIAP;
       
    22 class CPsdFax;
       
    23 
       
    24 const TInt KCmESockMessageSlots = 4;
       
    25 const TInt KCmStopThreadStackSize = 1024;
       
    26 
       
    27 NONSHARABLE_CLASS( TAsyncStopThreadData )
       
    28     {
       
    29 public:
       
    30     TAsyncStopThreadData( TUint32 aIapId, TUint32 aNetId );
       
    31 
       
    32 public:
       
    33     TUint32 iIapId;
       
    34     TUint32 iNetId;
       
    35 
       
    36     TInt iStep;      // Indicates location if error occurs. 
       
    37     TInt iErrorCode; // Error code that occured at location indicated by iStep.
       
    38     };
       
    39 
       
    40 
       
    41 /**
       
    42  * Method to stop a connection in a separate thread. 
       
    43  */
       
    44 TInt ConnectionStopThreadFunction( TAny *aPtr );
       
    45 
       
    46 
       
    47 NONSHARABLE_CLASS( CConnMonAsyncStopDaemon ) : public CActive
       
    48     {
       
    49 private:
       
    50     enum TConnMonStopType
       
    51         {
       
    52         EConnMonStopTypeUnknown = 0,
       
    53         EConnMonStopTypeInternal,    // Stoped with RConnection handle
       
    54         EConnMonStopTypeExternalPsd, // Stopped through CPsdFax-class
       
    55         EConnMonStopTypeExternalCsd  // Stopped through CCsdFax-class
       
    56         };
       
    57 
       
    58 public:
       
    59     static CConnMonAsyncStopDaemon* NewL( CConnMonIAP* aIap );
       
    60     static CConnMonAsyncStopDaemon* NewLC( CConnMonIAP* aIap );
       
    61     virtual ~CConnMonAsyncStopDaemon();
       
    62 
       
    63 private:
       
    64     CConnMonAsyncStopDaemon( CConnMonIAP* aIap );
       
    65     void Construct();
       
    66 
       
    67 public:
       
    68     /**
       
    69      * Starts the asynchronous stop task for an internal connection. This is
       
    70      * executed in a separate thread.
       
    71      */
       
    72     TInt Start( TUint aConnectionId, TUint32 aIapId, TUint32 aNetId );
       
    73 
       
    74     /**
       
    75      * Starts the asynchronous stop task for an external connection. This is
       
    76      * executed as a normal asunchronous request.
       
    77      */
       
    78     TInt Start( const TUint aConnectionId, CPsdFax* aPsdFax );
       
    79 
       
    80 private: // Methods from base class
       
    81     void DoCancel();
       
    82     void RunL();
       
    83 
       
    84 private:
       
    85     CConnMonIAP* iIap;           // Not owned
       
    86     CPsdFax* iPsdFax;            // Not owned
       
    87     TAsyncStopThreadData* iData; // Owned
       
    88     TConnMonStopType iConnectionType;
       
    89     TUint iConnectionId;
       
    90     };
       
    91 
       
    92 #endif // CONNMONASYNCSTOPDAEMON_H
       
    93 
       
    94 // End of file