telephonyprotocols/psdagt/inc/psdstates.h
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 /**
       
     2 * Copyright (c) 2003-2009 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:
       
    15 * Header for PSD States
       
    16 * 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file PSDStates.h
       
    24  @internalComponent
       
    25 */
       
    26 
       
    27 
       
    28 #ifndef __PSDSTATES_H__
       
    29 #define __PSDSTATES_H__
       
    30 
       
    31 #include <comms-infras/dialogprocessor.h>
       
    32 #include <etelpckt.h>
       
    33 #include "psdagt.h"
       
    34 #include "PSDAGTBase.h"
       
    35 
       
    36 class MPsdEnv;
       
    37 class MPsdCommDbAccess;
       
    38 class CPsdInitBase : public CAgentStateBase
       
    39 /**
       
    40 Base class for classes performing the initialisation state for both
       
    41 incomming and outgoing connections
       
    42 
       
    43 @internalComponent
       
    44 */
       
    45 	{
       
    46 public:
       
    47 	CPsdInitBase(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
    48 	virtual ~CPsdInitBase();
       
    49 	virtual void StartState();
       
    50 protected:
       
    51 	virtual void DoStartStateL();
       
    52 	void GetPhoneInfoL(const TDesC& aLoadedTsyName, RTelServer::TPhoneInfo& aInfo);
       
    53 	virtual void RunL();
       
    54 	virtual void DoCancel();
       
    55 protected:
       
    56 	MPsdEnv* iSM;
       
    57 	MPsdCommDbAccess* iDbPsd;
       
    58 	};
       
    59 
       
    60 class CPsdOutInit : public CPsdInitBase
       
    61 /**
       
    62 Class implementing the initialisation state for outgoing connections
       
    63 
       
    64 @internalComponent
       
    65 */
       
    66 	{
       
    67 public:
       
    68 	CPsdOutInit(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
    69 	virtual ~CPsdOutInit();
       
    70 	virtual CAgentStateBase* NextStateL(TBool aContinue);
       
    71 	};
       
    72 
       
    73 
       
    74 #ifndef INCOMING_NOT_SUPORTED
       
    75 
       
    76 class CPsdInInit : public CPsdInitBase
       
    77 /**
       
    78 Class implementing the initialisation state for incomming connections
       
    79 
       
    80 @internalComponent
       
    81 */
       
    82 	{
       
    83 public:
       
    84 	CPsdInInit(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
    85 	virtual ~CPsdInInit();
       
    86 	virtual CAgentStateBase* NextStateL(TBool aContinue);
       
    87 protected:
       
    88 	virtual void DoStartStateL();
       
    89 	};
       
    90 #endif // #ifndef INCOMING_NOT_SUPORTED
       
    91 
       
    92 
       
    93 class CPsdCheckConfig : public CAgentStateBase
       
    94 /**
       
    95 Base class for classes performing the config checking state for both
       
    96 incomming and outgoing connections
       
    97 
       
    98 @internalComponent
       
    99 */
       
   100 	{
       
   101 public:
       
   102 	CPsdCheckConfig(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
   103 	virtual ~CPsdCheckConfig();
       
   104 	virtual void StartState();
       
   105 protected:
       
   106 	virtual void DoInitL();
       
   107 	virtual void RunL();
       
   108 	virtual void DoCancel();
       
   109 protected:
       
   110 	MPsdEnv* iSM;
       
   111 	MPsdCommDbAccess* iDbPsd;
       
   112 	};
       
   113 
       
   114 class CPsdOutCheckConfig : public CPsdCheckConfig
       
   115 /**
       
   116 Class implementing the config checking state for outgoing connections
       
   117 
       
   118 @internalComponent
       
   119 */
       
   120 	{
       
   121 public:
       
   122 	CPsdOutCheckConfig(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
   123 	virtual ~CPsdOutCheckConfig();
       
   124 	virtual CAgentStateBase* NextStateL(TBool aContinue);
       
   125 	};
       
   126 
       
   127 
       
   128 #ifndef INCOMING_NOT_SUPORTED
       
   129 
       
   130 class CPsdInCheckConfig : public CPsdCheckConfig
       
   131 /**
       
   132 Class implementing the config checking state for incomming connections
       
   133 
       
   134 @internalComponent
       
   135 */
       
   136 	{
       
   137 public:
       
   138 	CPsdInCheckConfig(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
   139 	virtual ~CPsdInCheckConfig();
       
   140 	virtual CAgentStateBase* NextStateL(TBool aContinue);
       
   141 	};
       
   142 #endif // #ifndef INCOMING_NOT_SUPORTED
       
   143 
       
   144 
       
   145 class CPsdNetworkCheck : public CAgentStateBase
       
   146 /**
       
   147 Class implementing the network check state. Responsible for ensuring that 
       
   148 the network is in a suitable state before advancing the state machine
       
   149 
       
   150 @internalComponent
       
   151 */
       
   152 	{
       
   153 public:
       
   154 	CPsdNetworkCheck(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
   155 	virtual ~CPsdNetworkCheck();
       
   156 	virtual void StartState();
       
   157 	virtual CAgentStateBase* NextStateL(TBool aContinue);
       
   158 protected:
       
   159 	void RunL();
       
   160 	void DoCancel();
       
   161 private:
       
   162 	void DoNetworkCheck();
       
   163 private:
       
   164 	RPacketService::TRegistrationStatus iRegStatus;
       
   165 	MPsdEnv* iSM;
       
   166 	MPsdCommDbAccess* iDbPsd;
       
   167 	enum
       
   168 	{EGettingInitialStatus,EWaitingForStatusChange} iSubState;
       
   169 	};
       
   170 
       
   171 
       
   172 #ifndef INCOMING_NOT_SUPORTED
       
   173 
       
   174 class CPsdWaitForIncoming : public CAgentStateBase
       
   175 /**
       
   176 Class implementing the wait for incomming state. Used in incomming connections
       
   177 it is responsible for listening out for an incomming connection, validating the 
       
   178 connection and advancing the state machine.
       
   179 
       
   180 @internalComponent
       
   181 */
       
   182 	{
       
   183 public:
       
   184 	CPsdWaitForIncoming(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
   185 	virtual ~CPsdWaitForIncoming();
       
   186 	virtual void StartState();
       
   187 	virtual CAgentStateBase* NextStateL(TBool aContinue);
       
   188 protected:
       
   189 	void RunL();
       
   190 	void DoCancel();
       
   191 private:
       
   192 	RPacketContext::TProtocolType iPdpTypeRequested;
       
   193 	RPacketContext::TProtocolAddress iAddressRequested;
       
   194 	MPsdEnv* iSM;
       
   195 	MPsdCommDbAccess* iDbPsd;
       
   196 	};
       
   197 #endif // #ifndef INCOMING_NOT_SUPORTED
       
   198 
       
   199 
       
   200 class CPsdCreateContext : public CAgentStateBase
       
   201 /**
       
   202 Class implementing the create context state. Responsible for creating the 
       
   203 context and configuring it with the correct parameters
       
   204 
       
   205 @internalComponent
       
   206 */
       
   207 	{
       
   208 public:
       
   209 	CPsdCreateContext(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
   210 	virtual ~CPsdCreateContext();
       
   211 	virtual void StartState();
       
   212 	virtual CAgentStateBase* NextStateL(TBool aContinue);
       
   213 protected:
       
   214 	void RunL();
       
   215 	void DoCancel();
       
   216 private:
       
   217 	MPsdEnv* iSM;
       
   218 	MPsdCommDbAccess* iDbPsd;
       
   219 	};
       
   220 
       
   221 class CPsdCreateQoS : public CAgentStateBase
       
   222 /**
       
   223 Class implementing the create QoS state. Responsible for creating the 
       
   224 QoS and configuring it with the correct parameters
       
   225 
       
   226 @internalComponent
       
   227 */
       
   228 	{
       
   229 public:
       
   230 	CPsdCreateQoS(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
   231 	virtual ~CPsdCreateQoS();
       
   232 	virtual void StartState();
       
   233 	virtual CAgentStateBase* NextStateL(TBool aContinue);
       
   234 protected:
       
   235 	void RunL();
       
   236 	void DoCancel();
       
   237 private:
       
   238 	MPsdEnv* iSM;
       
   239 	MPsdCommDbAccess* iDbPsd;
       
   240 	};
       
   241 
       
   242 class CPsdActivateContext : public CAgentStateBase
       
   243 /**
       
   244 Class implementing the activate context state. Responsible for activating
       
   245 the previously configured context
       
   246 
       
   247 @internalComponent
       
   248 */
       
   249 	{
       
   250 public:
       
   251 	CPsdActivateContext(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
   252 	virtual ~CPsdActivateContext();
       
   253 	virtual void StartState();
       
   254 	virtual CAgentStateBase* NextStateL(TBool aContinue);
       
   255 protected:
       
   256 	void RunL();
       
   257 	void DoCancel();
       
   258 private:
       
   259 	MPsdEnv* iSM;
       
   260 	MPsdCommDbAccess* iDbPsd;
       
   261 	enum
       
   262 	{EActivatingContext,ELoaningCommPort} iSubState;
       
   263 	RCall::TCommPort iCommport;
       
   264 	};
       
   265 
       
   266 class CDataLogger;
       
   267 
       
   268 class CPsdOpen : public CAgentStateBase, public MPsdContextChangeObserver, public MDialogProcessorObserver
       
   269 /**
       
   270 Class implementing the open state. Responsible for maintaining the connection
       
   271 reporting progress and logging
       
   272 
       
   273 @internalComponent
       
   274 */
       
   275 	{
       
   276 public:
       
   277 	static CPsdOpen* NewL(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
   278 	virtual ~CPsdOpen();
       
   279 	// From CAgentStateBase
       
   280 	virtual void StartState();
       
   281 	virtual CAgentStateBase* NextStateL(TBool aContinue);
       
   282 	// from MPsdContextChangeObserver
       
   283 	virtual void ReportContextBelowAcceptableQuality();
       
   284 	virtual void ReportError(TInt aError);
       
   285 	 // from MDialogProcessorObserver
       
   286 	virtual void MDPOQoSWarningComplete(TInt aError, TBool aResponse);
       
   287 private:
       
   288 	void RequestStatusChange();
       
   289 	CPsdOpen(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
   290 	void ConstructL();
       
   291 	void LogActive();
       
   292 	void WatchForConfigChangesL();
       
   293 protected:
       
   294 	void RunL();
       
   295 	void DoCancel();
       
   296 private:
       
   297 	RPacketContext::TContextStatus iContextStatus;
       
   298 	MPsdEnv* iSM;
       
   299 	MPsdCommDbAccess* iDbPsd;
       
   300 	TBool iEventLoggerStarted;
       
   301 	CPsdContextChangeMonitor* iContextChangeMonitor;
       
   302 	};
       
   303 
       
   304 
       
   305 
       
   306 class CPsdRecoverCommPort : public CAgentStateBase
       
   307 /**
       
   308 Class implementing the recover comm port state. First state during
       
   309 disconnection it is responsible for recovering the previously loaned
       
   310 comm port
       
   311 
       
   312 @internalComponent
       
   313 */
       
   314 	{
       
   315 public:
       
   316 	CPsdRecoverCommPort(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
   317 	virtual ~CPsdRecoverCommPort();
       
   318 	virtual void StartState();
       
   319 	virtual CAgentStateBase* NextStateL(TBool aContinue);
       
   320 protected:
       
   321 	void RunL();
       
   322 	void DoCancel();
       
   323 private:
       
   324 	MPsdEnv* iSM;
       
   325 	MPsdCommDbAccess* iDbPsd;
       
   326 	};
       
   327 
       
   328 
       
   329 class CPsdCloseLog : public CAgentStateBase
       
   330 /**
       
   331 Class implementing the close log state. Responsible for the discontinuation
       
   332 of logging
       
   333 
       
   334 @internalComponent
       
   335 */
       
   336 	{
       
   337 public:
       
   338 	CPsdCloseLog(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
   339 	virtual ~CPsdCloseLog();
       
   340 	virtual void StartState();
       
   341 	virtual CAgentStateBase* NextStateL(TBool aContinue);
       
   342 protected:
       
   343 	void RunL();
       
   344 	void DoCancel();
       
   345 private:
       
   346 	MPsdEnv* iSM;
       
   347 	MPsdCommDbAccess* iDbPsd;
       
   348 	enum
       
   349 	{EStart,ELoggingFinalValues,EEndingLog} iSubState;
       
   350 	};
       
   351 
       
   352 
       
   353 class CPsdDeactivation : public CAgentStateBase
       
   354 /**
       
   355 Class implementing the deactivation state. Responsible for deactivating the
       
   356 context
       
   357 
       
   358 @internalComponent
       
   359 */
       
   360 	{
       
   361 public:
       
   362 	CPsdDeactivation(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
   363 	virtual ~CPsdDeactivation();
       
   364 	virtual void StartState();
       
   365 	virtual CAgentStateBase* NextStateL(TBool aContinue);
       
   366 protected:
       
   367 	void RunL();
       
   368 	void DoCancel();
       
   369 private:
       
   370 	MPsdEnv* iSM;
       
   371 	MPsdCommDbAccess* iDbPsd;
       
   372 	};
       
   373 
       
   374 
       
   375 class CPsdClosure : public CAgentStateBase
       
   376 /**
       
   377 Class implementing the closure state. Responsible for cleaning up all the
       
   378 resources used for the connection
       
   379 
       
   380 @internalComponent
       
   381 */
       
   382 	{
       
   383 public:
       
   384 	CPsdClosure(MAgentStateMachineEnv* aObserver,MPsdEnv* aPsdSM, MPsdCommDbAccess* aDb);
       
   385 	virtual ~CPsdClosure();
       
   386 	virtual void StartState();
       
   387 	virtual CAgentStateBase* NextStateL(TBool aContinue);
       
   388 protected:
       
   389 	void RunL();
       
   390 	void DoCancel();
       
   391 private:
       
   392 	MPsdEnv* iSM;
       
   393 	MPsdCommDbAccess* iDbPsd;
       
   394 	enum
       
   395 	{EClosureStart,EDeletingContext,EClosureEnd} iSubState;
       
   396 	};
       
   397 
       
   398 #endif