web_plat/connection_manager_api/inc/ConnectionObservers.h
changeset 0 dd21522fd290
child 58 220a17280356
child 65 5bfc169077b2
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2002 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 the License "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: 
       
    15 *     This class provides connection/session related information.
       
    16 *	  Both the requested and the stored AP's are here.
       
    17 *
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef Connection_Observers_H
       
    23 #define Connection_Observers_H
       
    24 
       
    25 //System includes
       
    26 #include <es_sock.h>
       
    27 
       
    28 
       
    29 //You should inherit from this if you want to observe connection stages
       
    30 class MConnectionStageObserver
       
    31 	{
       
    32 	public:
       
    33 
       
    34 		virtual void ConnectionStageAchievedL() = 0;
       
    35 	};
       
    36 
       
    37 
       
    38 //You should inherit from this if you want to observe multiple connection stages
       
    39 class MConnectionMultiStageObserver
       
    40 	{
       
    41 	public:
       
    42 
       
    43 		virtual void ConnectionStageAchievedL( TInt aStage ) = 0;
       
    44 	};
       
    45 
       
    46 //This is the notifier class which listens to connection stage changes
       
    47 NONSHARABLE_CLASS(  CConnectionStageNotifierWCB ) : public CActive
       
    48 	{
       
    49 public:
       
    50 
       
    51 	/**
       
    52 	*Symbian OS 2 phased constructor
       
    53 	*@param aPriority the active objects priority
       
    54 	*/
       
    55 	IMPORT_C static CConnectionStageNotifierWCB* NewL( TInt aPriority = EPriorityStandard);
       
    56 	
       
    57 	/**
       
    58 	*Symbian OS 2 phased constructor
       
    59 	*@param aPriority the active objects priority
       
    60 	*/
       
    61 	IMPORT_C static CConnectionStageNotifierWCB* NewLC( TInt aPriority = EPriorityStandard );
       
    62 
       
    63 public:
       
    64 
       
    65 	/**
       
    66     *
       
    67     *DEPRECATED since Averell2.0
       
    68     *
       
    69 	*Starts the notification service
       
    70 	*after it has been started you can expect a notification
       
    71 	*@param aStageToObserve the stage you want to notified about
       
    72 	*@param aObserver the observer you want to register for notification
       
    73 	*@param aCompleteIfAlreadyAtStage if ETrue then you get a notification even 
       
    74 	* if the connection is in the stage you defined when you start the service
       
    75 	*/
       
    76 	IMPORT_C void StartNotificationL( TInt aStageToObserve, MConnectionStageObserver* aObserver, TBool aCompleteIfAlreadyAtStage= ETrue  );
       
    77 
       
    78 public:
       
    79 
       
    80 	/**
       
    81 	*Destructor
       
    82 	*/
       
    83 	IMPORT_C virtual ~CConnectionStageNotifierWCB();
       
    84 
       
    85 protected:
       
    86 
       
    87 	/**
       
    88 	*Constructor
       
    89 	*@param aPriority the priority of the active object
       
    90 	*/
       
    91 	CConnectionStageNotifierWCB( TInt aPriority );
       
    92 
       
    93 private://from CActive		
       
    94 
       
    95         void DoCancel();		
       
    96 		void RunL();	
       
    97 
       
    98 public:
       
    99 
       
   100     /**
       
   101 	*Starts the notification service
       
   102 	*after it has been started you can expect a notification
       
   103     *@param aConnName connection name returned by RConnection::Name()
       
   104 	*@param aStageToObserve the stage you want to notified about
       
   105 	*@param aObserver the observer you want to register for notification
       
   106 	*@param aCompleteIfAlreadyAtStage if ETrue then you get a notification even 
       
   107 	* if the connection is in the stage you defined when you start the service
       
   108 	*/
       
   109 	IMPORT_C void StartNotificationL( TName* aConnName, 
       
   110                                       TInt aStageToObserve, 
       
   111                                       MConnectionStageObserver* aObserver, 
       
   112                                       TBool aCompleteIfAlreadyAtStage= ETrue  );
       
   113 
       
   114     /**
       
   115 	*Starts the notification service
       
   116 	*after it has been started you can expect a notification
       
   117     *@param aConnName connection name returned by RConnection::Name()
       
   118 	*@param aStagesToObserve array that contains the stages you want to notified about
       
   119 	*@param aObserver the observer you want to register for notification
       
   120 	*@param aCompleteIfAlreadyAtStage if ETrue then you get a notification even 
       
   121 	* if the connection is in the stage you defined when you start the service
       
   122 	*/
       
   123     IMPORT_C void StartNotificationL( TName* aConnName, 
       
   124                                       TInt* aStages, 
       
   125                                       TInt aNumOfStages,
       
   126                                       MConnectionMultiStageObserver* aObserver,
       
   127                                       TBool aCompleteIfAlreadyAtStage = ETrue );
       
   128 
       
   129 protected:
       
   130 
       
   131     /**
       
   132     *Attach to connection, the name of which is the aConnName.
       
   133     *@param aConnName connection name returned by RConnection::Name()
       
   134     */
       
   135     void DoOpenAgentL( TName* aConnName );
       
   136 
       
   137     /**
       
   138     *Detach from connection.
       
   139     */
       
   140     void DoCloseAgent();
       
   141 
       
   142     /**
       
   143     *Checks if any of the stage passed in StartNotificationL() is reached.
       
   144     *Doesn't stop for waiting for another state.
       
   145     */
       
   146     TBool IsAnyStageReached( TInt aCurrentStage );
       
   147 
       
   148 private:
       
   149 
       
   150     RSocketServ     iServer;
       
   151     RConnection     iConnection;
       
   152 	TNifProgressBuf iProgressBuf;		
       
   153 	TBool iCompleteIfAlreadyAtStage;	
       
   154 	TInt iStageToObserve;
       
   155 	MConnectionStageObserver* iObserver;
       
   156     MConnectionMultiStageObserver* iMultiObserver;
       
   157     TInt*   iStages;
       
   158     TInt    iNumOfStages;
       
   159 	};
       
   160 
       
   161 
       
   162 
       
   163 
       
   164 
       
   165 
       
   166 #endif
       
   167 // End of File