browserutilities/connectionmanager/Inc/ConnManActiveConnector.h
changeset 0 dd21522fd290
child 27 6297cdf66332
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 ConnMan_Active_Connector_H
       
    23 #define ConnMan_Active_Connection_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <nifman.h>
       
    27 
       
    28 
       
    29 class TCommDbConnPref;
       
    30 class TConnSnapPref;
       
    31 
       
    32 const TInt KStageGoingBackwardsError = 10602;
       
    33 //This class plays the role of a high level state machine in the connection creation
       
    34 NONSHARABLE_CLASS(  CConnManActiveConnector ): public CActive
       
    35 	{
       
    36 public:	
       
    37 
       
    38 	/**
       
    39 	*Constructor
       
    40 	*@param aAgent an RGenerericAgent
       
    41 	*@param aPriority the priority of the active object
       
    42 	*/
       
    43 	CConnManActiveConnector( RConnection& aConnection, TInt aPriority = EPriorityStandard );
       
    44 
       
    45 	/**
       
    46 	*Destructor
       
    47 	*/
       
    48 	virtual ~CConnManActiveConnector();
       
    49 	
       
    50 	/**
       
    51 	*This will activate the active object and start the connection creation process
       
    52 	*It will complete on error or when the connection has been created
       
    53 	*An important precondition: the agent that was passed must be opened before calling this function
       
    54 	*and must not be closed before it completes
       
    55 	*@param aSettings the overridesettings containing the connection characteristics
       
    56 	*@param aStatus the status of the observer Active object
       
    57 	*/
       
    58     void StartConnection( TCommDbConnPref* aSettings, TRequestStatus& aStatus );
       
    59     
       
    60     /**
       
    61 	*This will activate the active object and start the connection creation process
       
    62 	*It will complete on error or when the connection has been created
       
    63 	*An important precondition: the agent that was passed must be opened before calling this function
       
    64 	*and must not be closed before it completes
       
    65 	*@param aSettings the overridesettings containing the connection characteristics
       
    66 	*@param aStatus the status of the observer Active object
       
    67 	*/
       
    68     void StartConnection( TConnSnapPref* aSettings, TRequestStatus& aStatus);
       
    69 
       
    70 private://from CActive	
       
    71 
       
    72 	/**
       
    73 	*This method is implemented to enable proper cancellation of the active obect
       
    74 	*/
       
    75 	void DoCancel();			
       
    76 	
       
    77 	/**
       
    78 	*RunL contains the decisions in different stages of the connection progress
       
    79 	*/	
       
    80 	void RunL();
       
    81 
       
    82 private:
       
    83 
       
    84 	TRequestStatus* iExternalRequestStatus;
       
    85     RConnection& iConnection;
       
    86 	};
       
    87 
       
    88 
       
    89 //This is a wrapper class on top of CConnManActiveConnector enabling asynch->synch conversion
       
    90 NONSHARABLE_CLASS(  CActiveConnectorSyncWrapper ): public CActive
       
    91 	{
       
    92 public:
       
    93 	/**
       
    94 	*Symbian OS constructor 
       
    95 	*@param aAgent a RGenerericAgent
       
    96 	*@param aPriority the priority of the active object
       
    97 	*/
       
    98     static CActiveConnectorSyncWrapper * NewL( RConnection& aConnection, TInt aPriority = EPriorityStandard );
       
    99 	static CActiveConnectorSyncWrapper * NewL( TInt aPriority = EPriorityStandard );
       
   100 
       
   101 	/**
       
   102 	*Symbian OS constructor 
       
   103 	*@param aAgent a RGenerericAgent
       
   104 	*@param aPriority the priority of the active object
       
   105 	*/
       
   106 //	static CActiveConnectorSyncWrapper * NewLC( RGenericAgent& aAgent, TInt aPriority = EPriorityStandard );    CHANGED
       
   107     static CActiveConnectorSyncWrapper * NewLC( RConnection& aConnection, TInt aPriority = EPriorityStandard );
       
   108 	
       
   109 public:	
       
   110 
       
   111 	/**
       
   112 	*This will activate the active object and start the connection creation process
       
   113 	*The it will return on error or when the connection has been created
       
   114 	*An important precondition: the agent that was passed must be opened before calling this function
       
   115 	*and must not be closed before it completes
       
   116 	*@param aSettings the overridesettings containing the connection characteristics
       
   117 	*@return the error code
       
   118 	*/
       
   119     TInt Connect( TCommDbConnPref* aSettings );
       
   120     
       
   121     /**
       
   122 	*This will activate the active object and start the connection creation process
       
   123 	*The it will return on error or when the connection has been created
       
   124 	*An important precondition: the agent that was passed must be opened before calling this function
       
   125 	*and must not be closed before it completes
       
   126 	*@param aSettings the overridesettings containing the connection characteristics
       
   127 	*@return the error code
       
   128 	*/    
       
   129     TInt ConnectSnap( TConnSnapPref* aSettings );
       
   130 
       
   131 public:
       
   132 	
       
   133     /**
       
   134 	*Destructor
       
   135 	*/
       
   136 	virtual ~CActiveConnectorSyncWrapper();
       
   137 
       
   138 private://from CActive
       
   139 
       
   140     /**
       
   141 	*This function will release the active scheduler loop
       
   142 	*/
       
   143 	void RunL();
       
   144 	/**
       
   145 	*This function too releases the active scheduler loop
       
   146 	*/
       
   147 	void DoCancel();
       
   148 
       
   149 protected:
       
   150 
       
   151 	/**
       
   152 	*Symbian OS second phase constructor
       
   153 	*@param aAgent a RGenericAgent handle
       
   154 	*/
       
   155 	void ConstructL( RConnection& aConnection );
       
   156 
       
   157 	/**
       
   158 	*constructor
       
   159 	*@param aPiority the priority of the active object
       
   160 	*/
       
   161 	CActiveConnectorSyncWrapper( TInt aPriority );
       
   162 
       
   163 private:
       
   164 
       
   165 	CActiveSchedulerWait iWait;
       
   166 	CConnManActiveConnector* iActiveConnector;
       
   167 	};
       
   168 
       
   169 #endif// End of File