supl/locationomasuplpostester/epos_comasuplpostestermodulecfg/inc/epos_comasuplsessiontest.h
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Tests POS session.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_COMASUPLSESSIONTEST_H
       
    19 #define C_COMASUPLSESSIONTEST_H
       
    20 
       
    21 #include <epos_comasuplinforequestlist.h>
       
    22 
       
    23 #include "epos_comasuplgetsuplinfomanager.h"
       
    24 
       
    25 class COMASuplPosHandlerBase;
       
    26 class COMASuplPosSessionBase;
       
    27 class COMASuplPosition;
       
    28 
       
    29 /** Constant used for logging name of test*/
       
    30 _LIT8(KSessionTest, "---------------Session Test---------------");
       
    31 
       
    32 
       
    33 /**
       
    34  *  Tests GetSuplInfoL() function
       
    35  *
       
    36  *  Tests GetSuplInfoL() function after Initializing the session and 
       
    37  *  after closing the session. Contents of request List can be controlled
       
    38  *  through arguments in CreateRequestList().
       
    39  *
       
    40  *  @lib PosTesterModuleCfg.lib
       
    41  *  @since S60 v3.1u
       
    42  */
       
    43 class COMASuplSessionTest : public COMASuplGetSuplInfoManager
       
    44 	{
       
    45 	private:
       
    46 		/**  Controls the series of execution of asynchronous functions */
       
    47 		enum TExecutionSequence
       
    48 			{
       
    49 			EStartTest = 0,
       
    50 			EGetSuplInfoSessionNotInitRequest,
       
    51 			EGetSuplInfoSessionNotInitRequestComplete,
       
    52 			EGetPositionSessionNotInitRequest,
       
    53 			EGetPositionSessionNotInitRequestComplete,
       
    54 			EInitializeSessionRequest,
       
    55 			EinitializeSessionRequestComplete,
       
    56 			EGetSuplInfoSessionInitRequest,
       
    57 			EGetSuplInfoSessionInitRequestComplete,
       
    58 			EGetPositionSessionInitRequest,
       
    59 			EGetPositionSessionInitRequestComplete,
       
    60 			EEndSessionRequest,
       
    61 			EEndSessionRequestComplete,
       
    62 			EGetSuplInfoSessionEndRequest,
       
    63 			EGetSuplInfoSessionEndRequestComplete,
       
    64 			EGetPositionSessionEndRequest,
       
    65 			EGetPositionSessionEndRequestComplete,
       
    66 			EExistingSessionTest,
       
    67 			ETestingComplete
       
    68 			};
       
    69 
       
    70 		/** Identifies the current state of the POS Session */
       
    71 		enum TSessionState
       
    72 			{
       
    73 			ESessionUninitialized = 0,
       
    74 			ESessionInitialized,
       
    75 			ESessionEnded
       
    76 			};
       
    77 	public:
       
    78 		static COMASuplSessionTest* NewL(
       
    79 								COMASuplPosHandlerBase& aPosHandler
       
    80 							, COMASuplPosTesterCategory* aCallBack = NULL);
       
    81 		virtual ~COMASuplSessionTest();
       
    82 		
       
    83 	private:
       
    84 		void ConstructL();
       
    85 		COMASuplSessionTest( COMASuplPosHandlerBase& aPosHandler
       
    86 							, COMASuplPosTesterCategory* aCallBack );
       
    87 	public:
       
    88 		/**
       
    89 	     * From COMASuplGetSuplInfoManager
       
    90 	     * Starts testing for the test class
       
    91 	     *
       
    92 	     * @since S60 v3.1
       
    93 	     */
       
    94 		void StartTestingL();
       
    95 	public:
       
    96 		/**
       
    97 	     * From COMASuplGetSuplInfoManager
       
    98 	     * Handles completion of asynchronous request
       
    99 	     *
       
   100 	     * @since S60 v3.1
       
   101 	     */
       
   102 		void RunL();
       
   103 		/**
       
   104 	     * From COMASuplGetSuplInfoManager
       
   105 	     * Handles cancellation of asynchronous request
       
   106 	     *
       
   107 	     * @since S60 v3.1
       
   108 	     */
       
   109 		void DoCancel();
       
   110 
       
   111 		/**
       
   112 	     * From COMASuplGetSuplInfoManager
       
   113 	     * Handles leave from RunL, aborts testing.
       
   114 	     *
       
   115 	     * @since S60 v3.1
       
   116 	     * @param aError: Errorcode of leaving
       
   117 	     */
       
   118 		TInt  RunError( TInt aError );
       
   119 
       
   120 		/**
       
   121 	     * Requests for GetSuplInfoL before initializing session
       
   122 	     *
       
   123 	     * @since S60 v3.1
       
   124 	     * @return void
       
   125 	     */
       
   126 		void GetSuplInfoRequestL();
       
   127 
       
   128 		/**
       
   129 	     * Logs the completion status of GetsuplinfoL
       
   130 	     *
       
   131 	     * @since S60 v3.1
       
   132 	     * @return void
       
   133 	     */
       
   134 		void GetSuplInfoRequestCompleteL();
       
   135 
       
   136 		/**
       
   137 	     * Initializes the POS session.
       
   138 	     *
       
   139 	     * @since S60 v3.1
       
   140 	     * @return void
       
   141 	     */
       
   142 		void InitializeSessionRequestL();
       
   143 
       
   144 		/**
       
   145 	     * Logs the completion status of session initialization.
       
   146 	     * Leaves if session initialization is not complete with KErrNone.
       
   147 	     *
       
   148 	     * @since S60 v3.1
       
   149 	     * @return void
       
   150 	     */
       
   151 		void InitializeSessionRequestCompleteL();
       
   152 		
       
   153 		/**
       
   154 	     * Resets Position object
       
   155 	     *
       
   156 	     * @since S60 v3.1
       
   157 	     * @return void
       
   158 	     */
       
   159 		void COMASuplSessionTest::ResetPositionL();
       
   160 		/**
       
   161 	     * Requests for GetPositionL()
       
   162 	     *
       
   163 	     * @since S60 v3.1
       
   164 	     * @return void
       
   165 	     */
       
   166 		void GetPositionRequestL();
       
   167 		
       
   168 		/**
       
   169 	     * Logs the completion status of GetSplInfoL()
       
   170 	     *
       
   171 	     * @since S60 v3.1
       
   172 	     * @return void
       
   173 	     */
       
   174 		void GetPositionRequestComplete();
       
   175 			
       
   176 		/**
       
   177 	     * Ends session and requests for GetSuplInfoL()
       
   178 	     *
       
   179 	     * @since S60 v3.1
       
   180 	     * @return void
       
   181 	     */
       
   182 		void EndSession();
       
   183 
       
   184 	private:
       
   185 
       
   186 		/**
       
   187 		 * Controls the series of execution of asynchronous functions.
       
   188 		 */
       
   189 		TExecutionSequence iNextInSeq;
       
   190 
       
   191 		/**
       
   192 		 * Identifies the current state of the POS Session.
       
   193 		 */
       
   194 		TSessionState iSessionState;
       
   195 
       
   196 		/**
       
   197 		 * Holds an object of COMASuplPosition for GetPositionL.
       
   198 		 * Own.
       
   199 		 */
       
   200 		COMASuplPosition* iPosition;
       
   201 
       
   202 		/**
       
   203 		 * Holds EFalse if the tests are not done on an existing session.
       
   204 		 */
       
   205 		TBool iExistingSessionTestDone;
       
   206 	};
       
   207 #endif