diff -r ac5daea24fb0 -r 9f263f780e41 connectionmonitoring/connmon/connectionmonitor/inc/connmonasyncstopdaemon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectionmonitoring/connmon/connectionmonitor/inc/connmonasyncstopdaemon.h Wed Oct 27 17:51:11 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Active object that starts a connection stop operation in a new +* thread and waits for it to complete. +*/ + +#ifndef CONNMONASYNCSTOPDAEMON_H +#define CONNMONASYNCSTOPDAEMON_H + +class CConnMonIAP; +class CPsdFax; + +const TInt KCmESockMessageSlots = 4; +const TInt KCmStopThreadStackSize = 1024; + +NONSHARABLE_CLASS( TAsyncStopThreadData ) + { +public: + TAsyncStopThreadData( TUint32 aIapId, TUint32 aNetId ); + +public: + TUint32 iIapId; + TUint32 iNetId; + + TInt iStep; // Indicates location if error occurs. + TInt iErrorCode; // Error code that occured at location indicated by iStep. + }; + + +/** + * Method to stop a connection in a separate thread. + */ +TInt ConnectionStopThreadFunction( TAny *aPtr ); + + +NONSHARABLE_CLASS( CConnMonAsyncStopDaemon ) : public CActive + { +private: + enum TConnMonStopType + { + EConnMonStopTypeUnknown = 0, + EConnMonStopTypeInternal, // Stoped with RConnection handle + EConnMonStopTypeExternalPsd, // Stopped through CPsdFax-class + EConnMonStopTypeExternalCsd // Stopped through CCsdFax-class + }; + +public: + static CConnMonAsyncStopDaemon* NewL( CConnMonIAP* aIap ); + static CConnMonAsyncStopDaemon* NewLC( CConnMonIAP* aIap ); + virtual ~CConnMonAsyncStopDaemon(); + +private: + CConnMonAsyncStopDaemon( CConnMonIAP* aIap ); + void Construct(); + +public: + /** + * Starts the asynchronous stop task for an internal connection. This is + * executed in a separate thread. + */ + TInt Start( TUint aConnectionId, TUint32 aIapId, TUint32 aNetId ); + + /** + * Starts the asynchronous stop task for an external connection. This is + * executed as a normal asunchronous request. + */ + TInt Start( const TUint aConnectionId, CPsdFax* aPsdFax ); + +private: // Methods from base class + void DoCancel(); + void RunL(); + +private: + CConnMonIAP* iIap; // Not owned + CPsdFax* iPsdFax; // Not owned + TAsyncStopThreadData* iData; // Owned + TConnMonStopType iConnectionType; + TUint iConnectionId; + }; + +#endif // CONNMONASYNCSTOPDAEMON_H + +// End of file