graphicsapitest/graphicssvs/wserv/src/T_DataWsSession.cpp
changeset 103 2717213c588a
parent 98 bf7481649c98
child 116 171fae344dd4
child 121 d72fc2aace31
child 187 9f66f99ee56f
equal deleted inserted replaced
98:bf7481649c98 103:2717213c588a
     1 /*
       
     2 * Copyright (c) 2005-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 *
       
    16 */
       
    17 
       
    18 #include "T_DataWsSession.h"
       
    19 #include "T_GraphicsUtil.h"
       
    20 #include "T_DataWindowGroup.h"
       
    21 
       
    22 //	EPOC Includes
       
    23 #include <apgtask.h>
       
    24 #include <w32std.h>
       
    25 #include <gdi.h>
       
    26 
       
    27 /*@{*/
       
    28 _LIT(KDataClassname,							"RWsSession");
       
    29 
       
    30 ///	Fields
       
    31 _LIT(KFldCheckWithStore,						"checkwithstore");
       
    32 _LIT(KFldExpected,								"expected");
       
    33 _LIT(KFldKeyCode,								"keycode");
       
    34 _LIT(KFldModifier,								"modifier");
       
    35 _LIT(KFldModifierMask,							"modifiermask");
       
    36 _LIT(KFldModifiers,								"modifiers");
       
    37 _LIT(KFldNullPointer,							"nullpointer");
       
    38 _LIT(KFldOffset,								"offset");
       
    39 _LIT(KFldRepeats,								"repeats");
       
    40 _LIT(KFldStdScanCode,							"stdscancode");
       
    41 _LIT(KFldType,									"type");
       
    42 _LIT(KFldStore,									"store");
       
    43 _LIT(KFldPos,									"pos");
       
    44 _LIT(KFldDeviceNumber,							"devicenumber");
       
    45 _LIT(KFldTip,									"tip");
       
    46 _LIT(KFldIdentifier,							"identifier");
       
    47 _LIT(KFldSpriteMember,							"spritemember");
       
    48 _LIT(KFldSpriteFlags,							"spriteflags");
       
    49 _LIT(KFldAlignment,								"alignment");
       
    50 _LIT(KFldWindowGroup,							"windowgroup");
       
    51 
       
    52 ///	Parameters
       
    53 
       
    54 _LIT(KLogMessage,	 							"logMessage");
       
    55 _LIT(KLogCommand,	 							"logCommand");
       
    56 _LIT(KTPoint,	 								"point");
       
    57 _LIT(KInputWGId,			  					"inputWGId");
       
    58 _LIT(KBGColour,									"bgcolour");
       
    59 _LIT(KInputCursorNumber,						"inputcursornumber");
       
    60 _LIT(KComputeMode,								"computemode");
       
    61 _LIT(KInputScrnNo,	  							"inputscreenno");
       
    62 _LIT(KDefDisplayMode,	  						"defDisplayMode");
       
    63 _LIT(KDefModeMaxNumColor,	  					"defModeMaxNumColor");
       
    64 _LIT(KDefModeMaxNumGray,	  					"defModeMaxNumGray");
       
    65 _LIT(KWindowGroupIdentifier,					"wgIdentifier");
       
    66 _LIT(KInputDefaultCursorNumber,					"defaultsyscurnum");
       
    67 _LIT(KUseRfs,									"userfs");
       
    68 _LIT(KExpectedHeapCount,    					"heapCount");
       
    69 _LIT(KExpectPtrCursorMode,    					"expectptrcurmode");
       
    70 _LIT(KExpectBgColour,							"expectbgcolour");
       
    71 _LIT(KExpectedDiff,								"expected_diff");
       
    72 _LIT(KSetBuffer,			  					"setbuffer");
       
    73 _LIT(KSetMaxBuffer,			  					"setmaxbuffer");
       
    74 _LIT(KSetFocusScreen,		  					"setfocusscreen");
       
    75 _LIT(KSetEventOffOn,							"seteventoffon");
       
    76 _LIT(KWTreeNodeObj,								"treenodeobj");
       
    77 _LIT(KExpectShadowVector,						"expectshdwvet");
       
    78 _LIT(KAutoFlushState,		  					"newFlushstate");
       
    79 _LIT(KExpectFlushState,		  					"expectedFlushstate");
       
    80 _LIT(KVersionBuild,			  					"build");
       
    81 _LIT(KVersionMajor,			  					"major");
       
    82 _LIT(KVersionMinor,			  					"minor");
       
    83 _LIT(KWGUseArray,			  					"usearray");
       
    84 _LIT(KWGListPriority,							"priority");
       
    85 _LIT(KWGGivenPriority,							"givenwgpriority");
       
    86 _LIT(KWGSpecifieScrnNo,							"specifiescrnno");
       
    87 _LIT(KWGScreenNumber,							"screennum");
       
    88 _LIT(KWGOrdinalId,								"identifier");
       
    89 _LIT(KWGOrdinalPosition,						"position");
       
    90 _LIT(KWGOrdinalPriority,						"wgid");
       
    91 _LIT(KWGinquiredId,								"inquiredwgid");
       
    92 _LIT(KFindWGPreId,								"prewgid");
       
    93 _LIT(KMatchWGString,							"matchwgname");
       
    94 _LIT(KThreadId,									"threadid");
       
    95 _LIT(KRequestEvent,								"requestevent");
       
    96 _LIT(KRequestRedraw,							"requestRedraw");
       
    97 _LIT(KPKPriorityKey,							"prioritykey");
       
    98 _LIT(KSetHotKey,								"hotkey");
       
    99 _LIT(KClsHotKey,								"clshotkey");
       
   100 _LIT(KRestoreDefHotKey,							"restoredefhk");
       
   101 _LIT(KSetKeyCode,								"keycode");
       
   102 _LIT(KDblClickInterval,							"maxinterval");
       
   103 _LIT(KDblClickDistance,							"maxdistance");
       
   104 _LIT(KExpectedDblMaxInitialTime,				"expecteddblmaxinittime");
       
   105 _LIT(KExpectedDblDistance,						"expecteddblmaxdistance");
       
   106 _LIT(KSetKBRepRateInterval,						"kbreprateinterval");
       
   107 _LIT(KSetKBRepRateTime,							"kbrepratetime");
       
   108 _LIT(KWGGetExpectedKBInitialTime,				"expectedkbinittime");
       
   109 _LIT(KWGGetExpectedKBRepeatTime,				"expectedkbRepeattime");
       
   110 _LIT(KSetSysFading,								"sysfadonoff");
       
   111 _LIT(KSetblackMapFading,						"blackmapfading");
       
   112 _LIT(KSetwhiteMapFading,						"whitemapfading");
       
   113 _LIT(KSetDefblackMapFading,						"defblackmapfading");
       
   114 _LIT(KSetDefwhiteMapFading,						"defwhitemapfading");
       
   115 _LIT(KSetShadowVec,								"shadowvector");
       
   116 _LIT(KSetScrnSizeMode,							"screensizemode");
       
   117 _LIT(KSetPtrCurPosValue,						"ptrcurpos");
       
   118 _LIT(KPtrCurPosArea,							"ptrcurarea");
       
   119 _LIT(KSetPtrCurMode,							"pointercurmode");
       
   120 _LIT(KSetCltCurMode,							"cltcurmode");
       
   121 _LIT(KInputPermanentModifier,					"inputpermanmodif");
       
   122 _LIT(KInputPermanentModifierState,				"inputpermanmodifstate");
       
   123 
       
   124 //Commands
       
   125 _LIT(KCmdnew,									"new");
       
   126 _LIT(KCmdConnect,								"Connect");
       
   127 _LIT(KCmdClose,									"Close");
       
   128 _LIT(KCmdVersion,								"Version");
       
   129 _LIT(KCmdSetHotKey,								"SetHotKey");
       
   130 _LIT(KCmdClearHotKeys,							"ClearHotKeys");
       
   131 _LIT(KCmdRestoreDefaultHotKey,					"RestoreDefaultHotKey");
       
   132 _LIT(KCmdEventReady,							"EventReady");
       
   133 _LIT(KCmdEventReadyCancel,						"EventReadyCancel");
       
   134 _LIT(KCmdGetEvent,								"GetEvent");
       
   135 _LIT(KCmdPurgePointerEvents,					"PurgePointerEvents");
       
   136 _LIT(KCmdRedrawReady,							"RedrawReady");
       
   137 _LIT(KCmdRedrawReadyCancel,						"RedrawReadyCancel");
       
   138 _LIT(KCmdGetRedraw,								"GetRedraw");
       
   139 _LIT(KCmdPriorityKeyReady,						"PriorityKeyReady");
       
   140 _LIT(KCmdPriorityKeyReadyCancel,				"PriorityKeyReadyCancel");
       
   141 _LIT(KCmdGetPriorityKey,						"GetPriorityKey");
       
   142 _LIT(KCmdFlush,									"Flush");
       
   143 _LIT(KCmdSetAutoFlush,							"SetAutoFlush");
       
   144 _LIT(KCmdSetKeyboardRepeatRate,					"SetKeyboardRepeatRate");
       
   145 _LIT(KCmdGetKeyboardRepeatRate,					"GetKeyboardRepeatRate");
       
   146 _LIT(KCmdGetDoubleClickSettings,				"GetDoubleClickSettings");
       
   147 _LIT(KCmdSetDoubleClick,						"SetDoubleClick");
       
   148 _LIT(KCmdNumWindowGroups,						"NumWindowGroups");
       
   149 _LIT(KCmdWindowGroupList,						"WindowGroupList");
       
   150 _LIT(KCmdGetFocusWindowGroup,					"GetFocusWindowGroup");
       
   151 _LIT(KCmdGetDefaultOwningWindow,				"GetDefaultOwningWindow");
       
   152 _LIT(KCmdSetWindowGroupOrdinalPosition,			"SetWindowGroupOrdinalPosition");
       
   153 _LIT(KCmdGetWindowGroupClientThreadId,			"GetWindowGroupClientThreadId");
       
   154 _LIT(KCmdGetWindowGroupHandle,					"GetWindowGroupHandle");
       
   155 _LIT(KCmdGetWindowGroupOrdinalPriority,			"GetWindowGroupOrdinalPriority");
       
   156 _LIT(KCmdGetWindowGroupNameFromIdentifier,		"GetWindowGroupNameFromIdentifier");
       
   157 _LIT(KCmdFindWindowGroupIdentifier,				"FindWindowGroupIdentifier");
       
   158 _LIT(KCmdFetchMessage,							"FetchMessage");
       
   159 _LIT(KCmdSetShadowVector,						"SetShadowVector");
       
   160 _LIT(KCmdShadowVector,							"ShadowVector");
       
   161 _LIT(KCmdSetBackgroundColor,					"SetBackgroundColor");
       
   162 _LIT(KCmdGetBackgroundColor,					"GetBackgroundColor");
       
   163 _LIT(KCmdSetSystemPointerCursor,				"SetSystemPointerCursor");
       
   164 _LIT(KCmdClearSystemPointerCursor,				"ClearSystemPointerCursor");
       
   165 _LIT(KCmdClaimSystemPointerCursorList,			"ClaimSystemPointerCursorList");
       
   166 _LIT(KCmdFreeSystemPointerCursorList,			"FreeSystemPointerCursorList");
       
   167 _LIT(KCmdSetCustomTextCursor,					"SetCustomTextCursor");
       
   168 _LIT(KCmdResourceCount,							"ResourceCount");
       
   169 _LIT(KCmdPasswordEntered,						"PasswordEntered");
       
   170 _LIT(KCmdComputeMode,							"ComputeMode");
       
   171 _LIT(KCmdHeapCount,								"HeapCount");
       
   172 _LIT(KCmdSetModifierState,						"SetModifierState");
       
   173 _LIT(KCmdGetModifierState,						"GetModifierState");
       
   174 _LIT(KCmdRequestOffEvents,						"RequestOffEvents");
       
   175 _LIT(KCmdGetDefModeMaxNumColors,				"GetDefModeMaxNumColors");
       
   176 _LIT(KCmdGetColorModeList,						"GetColorModeList");
       
   177 _LIT(KCmdSetPointerCursorArea,					"SetPointerCursorArea");
       
   178 _LIT(KCmdPointerCursorArea,						"PointerCursorArea");
       
   179 _LIT(KCmdSetPointerCursorMode,					"SetPointerCursorMode");
       
   180 _LIT(KCmdSetClientCursorMode,					"SetClientCursorMode");
       
   181 _LIT(KCmdPointerCursorMode,						"PointerCursorMode");
       
   182 _LIT(KCmdSetDefaultSystemPointerCursor,			"SetDefaultSystemPointerCursor");
       
   183 _LIT(KCmdClearDefaultSystemPointerCursor,		"ClearDefaultSystemPointerCursor");
       
   184 _LIT(KCmdSetPointerCursorPosition,				"SetPointerCursorPosition");
       
   185 _LIT(KCmdPointerCursorPosition,					"PointerCursorPosition");
       
   186 _LIT(KCmdSetDefaultFadingParameters,			"SetDefaultFadingParameters");
       
   187 _LIT(KCmdPrepareForSwitchOff,					"PrepareForSwitchOff");
       
   188 _LIT(KCmdSetBufferSizeL,						"SetBufferSizeL");
       
   189 _LIT(KCmdSetMaxBufferSizeL,						"SetMaxBufferSizeL");
       
   190 _LIT(KCmdSetSystemFaded,						"SetSystemFaded");
       
   191 _LIT(KCmdSetFocusScreen,						"SetFocusScreen");
       
   192 _LIT(KCmdGetFocusScreen,						"GetFocusScreen");
       
   193 _LIT(KCmdClearAllRedrawStores,					"ClearAllRedrawStores");
       
   194 _LIT(KCmdLogCommand,							"LogCommand");
       
   195 _LIT(KCmdLogMessage,							"LogMessage");
       
   196 _LIT(KCmdNumberOfScreens,						"NumberOfScreens");
       
   197 _LIT(KCmdSimulateRawEvent,						"SimulateRawEvent");
       
   198 _LIT(KCmdSimulateKeyEvent,						"SimulateKeyEvent");
       
   199 
       
   200 ///	Logging
       
   201 _LIT(KLogError,									"Error=%d");
       
   202 _LIT(KLogMissingParameter,						"Missing parameter '%S'");
       
   203 _LIT(KLogNotExpectedValue,						"Not expected value");
       
   204 
       
   205 //constants 
       
   206 const TInt  KGroupNameMaxSize =100;
       
   207 
       
   208 /*@}*/
       
   209 
       
   210 //////////////////////////////////////////////////////////////////////
       
   211 // Construction/Destruction
       
   212 //////////////////////////////////////////////////////////////////////
       
   213 
       
   214 CT_DataWsSession* CT_DataWsSession::NewL()
       
   215 	{
       
   216 	CT_DataWsSession*    ret=new (ELeave) CT_DataWsSession();
       
   217 	CleanupStack::PushL(ret);
       
   218 	ret->ConstructL();
       
   219 	CleanupStack::Pop(ret);
       
   220 	return ret;
       
   221 	}
       
   222 
       
   223 CT_DataWsSession::CT_DataWsSession()
       
   224 :	CDataWrapperBase()
       
   225 ,	iWsSession(NULL)
       
   226 ,	iResourceCount(0)
       
   227 ,	iNumWinGroup(0)
       
   228 ,	iColorModeCount(0)
       
   229 ,	iWindowGroupIdentifier(0)
       
   230 ,	iActiveEventReady(NULL)
       
   231 ,	iActivePriorityKeyReady(NULL)
       
   232 ,	iActiveRedrawReady(NULL)
       
   233 	{
       
   234 	}
       
   235 
       
   236 void CT_DataWsSession::ConstructL()
       
   237 	{
       
   238 	iActiveEventReady=CActiveCallback::NewL(*this);
       
   239 	iActivePriorityKeyReady=CActiveCallback::NewL(*this);
       
   240 	iActiveRedrawReady=CActiveCallback::NewL(*this);
       
   241 	}
       
   242 
       
   243 CT_DataWsSession::~CT_DataWsSession()
       
   244 	{
       
   245 	DestroyData();
       
   246 	delete iActiveRedrawReady;
       
   247 	iActiveRedrawReady=NULL;
       
   248 	delete iActivePriorityKeyReady;
       
   249 	iActivePriorityKeyReady=NULL;
       
   250 	delete iActiveEventReady;
       
   251 	iActiveEventReady=NULL;
       
   252 	}
       
   253 
       
   254 void CT_DataWsSession::SetObjectL(TAny* aAny)
       
   255 	{
       
   256 	DestroyData();
       
   257 	iWsSession = static_cast<RWsSession*> (aAny);
       
   258 	}
       
   259 
       
   260 void CT_DataWsSession::DisownObjectL()
       
   261 	{
       
   262 	iWsSession = NULL;
       
   263 	}
       
   264 
       
   265 void CT_DataWsSession::DestroyData()
       
   266 	{
       
   267 	delete iWsSession;
       
   268 	iWsSession=NULL;
       
   269 	}
       
   270 
       
   271 MWsClientClass* CT_DataWsSession::GetClientClass() const
       
   272 	{
       
   273 	return iWsSession;
       
   274 	}
       
   275 
       
   276 
       
   277 /**
       
   278 * Process a command read from the ini file
       
   279 *
       
   280 * @param aCommand			the command to process
       
   281 * @param aSection			the entry in the ini file requiring the command to be processed
       
   282 * @param aAsyncErrorIndex	index of command. used for async calls
       
   283 *
       
   284 * @return ETrue if the command is processed
       
   285 */
       
   286 TBool CT_DataWsSession::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
       
   287 	{
       
   288 	TBool	ret = ETrue;
       
   289 
       
   290 	if ( aCommand==KCmdnew || aCommand==KDataClassname )
       
   291 		{
       
   292 		DoCmdnew();
       
   293 		}
       
   294 	else if ( aCommand==KCmdConnect )
       
   295 		{
       
   296 		DoCmdConnectL(aSection);
       
   297 		}
       
   298 	else if ( aCommand==KCmdClose )
       
   299 		{
       
   300 		DoCmdClose();
       
   301 		}
       
   302 	else if ( aCommand==KCmdVersion )
       
   303 		{
       
   304 		DoCmdVersion(aSection);
       
   305 		}
       
   306 	else if ( aCommand==KCmdSetHotKey )
       
   307 		{
       
   308 		DoCmdSetHotKey(aSection);
       
   309 		}
       
   310 	else if ( aCommand==KCmdClearHotKeys )
       
   311 		{
       
   312 		DoCmdClearHotKeys(aSection);
       
   313 		}
       
   314 	else if ( aCommand==KCmdRestoreDefaultHotKey )
       
   315 		{
       
   316 		DoCmdRestoreDefaultHotKey(aSection);
       
   317 		}
       
   318 	else if ( aCommand==KCmdEventReady )
       
   319 		{
       
   320 		DoCmdEventReady(aSection, aAsyncErrorIndex);
       
   321 		}
       
   322 	else if ( aCommand==KCmdEventReadyCancel )
       
   323 		{
       
   324 		DoCmdEventReadyCancel();
       
   325 		}
       
   326 	else if ( aCommand==KCmdGetEvent )
       
   327 		{
       
   328 		DoCmdGetEventL(aSection);
       
   329 		}
       
   330 	else if ( aCommand==KCmdPurgePointerEvents )
       
   331 		{
       
   332 		DoCmdPurgePointerEvents();
       
   333 		}
       
   334 	else if ( aCommand==KCmdRedrawReady )
       
   335 		{
       
   336 		DoCmdRedrawReady(aSection, aAsyncErrorIndex);
       
   337 		}
       
   338 	else if ( aCommand==KCmdRedrawReadyCancel )
       
   339 		{
       
   340 		DoCmdRedrawReadyCancel();
       
   341 		}
       
   342 	else if ( aCommand==KCmdGetRedraw )
       
   343 		{
       
   344 		DoCmdGetRedrawL(aSection);
       
   345 		}
       
   346 	else if ( aCommand==KCmdPriorityKeyReady )
       
   347 		{
       
   348 		DoCmdPriorityKeyReady(aSection, aAsyncErrorIndex);
       
   349 		}
       
   350 	else if ( aCommand==KCmdPriorityKeyReadyCancel )
       
   351 		{
       
   352 		DoCmdPriorityKeyReadyCancel();
       
   353 		}
       
   354 	else if ( aCommand==KCmdGetPriorityKey )
       
   355 		{
       
   356 		DoCmdGetPriorityKeyL(aSection);
       
   357 		}
       
   358 	else if ( aCommand==KCmdFlush )
       
   359 		{
       
   360 		DoCmdFlush();
       
   361 		}
       
   362 	else if ( aCommand==KCmdSetAutoFlush )
       
   363 		{
       
   364 		DoCmdSetAutoFlush(aSection);
       
   365 		}
       
   366 	else if ( aCommand==KCmdSetKeyboardRepeatRate )
       
   367 		{
       
   368 		DoCmdSetKeyboardRepeatRate(aSection);
       
   369 		}
       
   370 	else if ( aCommand==KCmdGetKeyboardRepeatRate )
       
   371 		{
       
   372 		DoCmdGetKeyboardRepeatRate(aSection);
       
   373 		}
       
   374 	else if ( aCommand==KCmdGetDoubleClickSettings )
       
   375 		{
       
   376 		DoCmdGetDoubleClickSettings(aSection);
       
   377 		}
       
   378 	else if ( aCommand==KCmdSetDoubleClick )
       
   379 		{
       
   380 		DoCmdSetDoubleClick(aSection);
       
   381 		}
       
   382 	else if ( aCommand==KCmdNumWindowGroups )
       
   383 		{
       
   384 		DoCmdNumWindowGroups(aSection);
       
   385 		}
       
   386 	else if ( aCommand==KCmdWindowGroupList )
       
   387 		{
       
   388 		DoCmdWindowGroupListL(aSection);
       
   389 		}
       
   390 	else if ( aCommand==KCmdGetFocusWindowGroup )
       
   391 		{
       
   392 		DoCmdGetFocusWindowGroup(aSection);
       
   393 		}
       
   394 	else if ( aCommand==KCmdGetDefaultOwningWindow )
       
   395 		{
       
   396 		DoCmdGetDefaultOwningWindow(aSection);
       
   397 		}
       
   398 	else if ( aCommand==KCmdSetWindowGroupOrdinalPosition )
       
   399 		{
       
   400 		DoCmdSetWindowGroupOrdinalPosition(aSection);
       
   401 		}
       
   402 	else if ( aCommand==KCmdGetWindowGroupClientThreadId )
       
   403 		{
       
   404 		DoCmdGetWindowGroupClientThreadId(aSection);
       
   405 		}
       
   406 	else if ( aCommand==KCmdGetWindowGroupHandle )
       
   407 		{
       
   408 		DoCmdGetWindowGroupHandle(aSection);
       
   409 		}
       
   410 	else if ( aCommand==KCmdGetWindowGroupOrdinalPriority )
       
   411 		{
       
   412 		DoCmdGetWindowGroupOrdinalPriority(aSection);
       
   413 		}
       
   414 	else if ( aCommand==KCmdGetWindowGroupNameFromIdentifier )
       
   415 		{
       
   416 		DoCmdGetWindowGroupNameFromIdentifier(aSection);
       
   417 		}
       
   418 	else if ( aCommand==KCmdFindWindowGroupIdentifier )
       
   419 		{
       
   420 		DoCmdFindWindowGroupIdentifier(aSection);
       
   421 		}
       
   422 	else if ( aCommand==KCmdFetchMessage )
       
   423 		{
       
   424 		DoCmdFetchMessage(aSection);
       
   425 		}
       
   426 	else if ( aCommand==KCmdSetShadowVector )
       
   427 		{
       
   428 		DoCmdSetShadowVector(aSection);
       
   429 		}
       
   430 	else if ( aCommand==KCmdShadowVector )
       
   431 		{
       
   432 		DoCmdShadowVector(aSection);
       
   433 		}
       
   434 	else if ( aCommand==KCmdSetBackgroundColor )
       
   435 		{
       
   436 		DoCmdSetBackgroundColor(aSection);
       
   437 		}
       
   438 	else if ( aCommand==KCmdGetBackgroundColor )
       
   439 		{
       
   440 		DoCmdGetBackgroundColor(aSection);
       
   441 		}
       
   442 	else if ( aCommand==KCmdSetSystemPointerCursor )
       
   443 		{
       
   444 		DoCmdSetSystemPointerCursor(aSection);
       
   445 		}
       
   446 	else if ( aCommand==KCmdClearSystemPointerCursor )
       
   447 		{
       
   448 		DoCmdClearSystemPointerCursor(aSection);
       
   449 		}
       
   450 	else if ( aCommand==KCmdClaimSystemPointerCursorList )
       
   451 		{
       
   452 		DoCmdClaimSystemPointerCursorList();
       
   453 		}
       
   454 	else if ( aCommand==KCmdFreeSystemPointerCursorList )
       
   455 		{
       
   456 		DoCmdFreeSystemPointerCursorList();
       
   457 		}
       
   458 	else if ( aCommand==KCmdSetCustomTextCursor )
       
   459 		{
       
   460 		DoCmdSetCustomTextCursorL(aSection);
       
   461 		}
       
   462 	else if ( aCommand==KCmdResourceCount )
       
   463 		{
       
   464 		DoCmdResourceCount(aSection);
       
   465 		}
       
   466 	else if ( aCommand==KCmdPasswordEntered )
       
   467 		{
       
   468 		DoCmdPasswordEntered();
       
   469 		}
       
   470 	else if ( aCommand==KCmdComputeMode )
       
   471 		{
       
   472 		DoCmdComputeMode(aSection);
       
   473 		}
       
   474 	else if ( aCommand==KCmdHeapCount )
       
   475 		{
       
   476 		DoCmdHeapCount(aSection);
       
   477 		}
       
   478 	else if ( aCommand==KCmdSetModifierState )
       
   479 		{
       
   480 		DoCmdSetModifierState(aSection);
       
   481 		}
       
   482 	else if ( aCommand==KCmdGetModifierState )
       
   483 		{
       
   484 		DoCmdGetModifierState(aSection);
       
   485 		}
       
   486 	else if ( aCommand==KCmdRequestOffEvents )
       
   487 		{
       
   488 		DoCmdRequestOffEventsL(aSection);
       
   489 		}
       
   490 	else if ( aCommand==KCmdGetDefModeMaxNumColors )
       
   491 		{
       
   492 		DoCmdGetDefModeMaxNumColors(aSection);
       
   493 		}
       
   494 	else if ( aCommand==KCmdGetColorModeList )
       
   495 		{
       
   496 		DoCmdGetColorModeListL(aSection);
       
   497 		}
       
   498 	else if ( aCommand==KCmdSetPointerCursorArea )
       
   499 		{
       
   500 		DoCmdSetPointerCursorArea(aSection);
       
   501 		}
       
   502 	else if ( aCommand==KCmdPointerCursorArea )
       
   503 		{
       
   504 		DoCmdPointerCursorArea(aSection);
       
   505 		}
       
   506 	else if ( aCommand==KCmdSetPointerCursorMode )
       
   507 		{
       
   508 		DoCmdSetPointerCursorMode(aSection);
       
   509 		}
       
   510 	else if ( aCommand==KCmdSetClientCursorMode )
       
   511 		{
       
   512 		DoCmdSetClientCursorMode(aSection);
       
   513 		}
       
   514 	else if ( aCommand==KCmdPointerCursorMode )
       
   515 		{
       
   516 		DoCmdPointerCursorMode(aSection);
       
   517 		}
       
   518 	else if ( aCommand==KCmdSetDefaultSystemPointerCursor )
       
   519 		{
       
   520 		DoCmdSetDefaultSystemPointerCursor(aSection);
       
   521 		}
       
   522 	else if ( aCommand==KCmdClearDefaultSystemPointerCursor )
       
   523 		{
       
   524 		DoCmdClearDefaultSystemPointerCursor();
       
   525 		}
       
   526 	else if ( aCommand==KCmdSetPointerCursorPosition )
       
   527 		{
       
   528 		DoCmdSetPointerCursorPosition(aSection);
       
   529 		}
       
   530 	else if ( aCommand==KCmdPointerCursorPosition )
       
   531 		{
       
   532 		DoCmdPointerCursorPosition(aSection);
       
   533 		}
       
   534 	else if ( aCommand==KCmdSetDefaultFadingParameters )
       
   535 		{
       
   536 		DoCmdSetDefaultFadingParameters(aSection);
       
   537 		}
       
   538 	else if ( aCommand==KCmdPrepareForSwitchOff )
       
   539 		{
       
   540 		DoCmdPrepareForSwitchOff();
       
   541 		}
       
   542 	else if ( aCommand==KCmdSetBufferSizeL )
       
   543 		{
       
   544 		DoCmdSetBufferSizeL(aSection);
       
   545 		}
       
   546 	else if ( aCommand==KCmdSetMaxBufferSizeL )
       
   547 		{
       
   548 		DoCmdSetMaxBufferSizeL(aSection);
       
   549 		}
       
   550 	else if ( aCommand==KCmdSetSystemFaded )
       
   551 		{
       
   552 		DoCmdSetSystemFaded(aSection);
       
   553 		}
       
   554 	else if ( aCommand==KCmdSetFocusScreen )
       
   555 		{
       
   556 		DoCmdSetFocusScreen(aSection);
       
   557 		}
       
   558 	else if ( aCommand==KCmdGetFocusScreen )
       
   559 		{
       
   560 		DoCmdGetFocusScreen(aSection);
       
   561 		}
       
   562 	else if ( aCommand==KCmdClearAllRedrawStores )
       
   563 		{
       
   564 		DoCmdClearAllRedrawStores();
       
   565 		}
       
   566 	else if ( aCommand==KCmdLogCommand )
       
   567 		{
       
   568 		DoCmdLogCommand(aSection);
       
   569 		}
       
   570 	else if ( aCommand==KCmdLogMessage )
       
   571 		{
       
   572 		DoCmdLogMessage(aSection);
       
   573 		}
       
   574 	else if ( aCommand==KCmdNumberOfScreens )
       
   575 		{
       
   576 		DoCmdNumberOfScreens(aSection);
       
   577 		}
       
   578 	else if ( aCommand==KCmdSimulateRawEvent )
       
   579 		{
       
   580 		DoCmdSimulateRawEvent(aSection);
       
   581 		}
       
   582 	else if ( aCommand==KCmdSimulateKeyEvent )
       
   583 		{
       
   584 		DoCmdSimulateKeyEvent(aSection);
       
   585 		}
       
   586 	else
       
   587 		{
       
   588 		ret=CT_DataWsClientClass::DoCommandL(*this, aCommand, aSection, aAsyncErrorIndex);
       
   589 		}
       
   590 
       
   591 	return ret;
       
   592 	}
       
   593 
       
   594 
       
   595 void CT_DataWsSession::DoCmdnew()
       
   596 	{
       
   597 	INFO_PRINTF1(_L("Session is going to create"));
       
   598 	TRAPD(err,	iWsSession = new (ELeave) RWsSession());
       
   599 	if ( err!=KErrNone )
       
   600 		{
       
   601 		ERR_PRINTF2(KLogError, err);
       
   602 		SetError(err);
       
   603 		}
       
   604 	}
       
   605 
       
   606 void CT_DataWsSession::DoCmdConnectL(const TDesC& aSection)
       
   607 	{
       
   608 	TBool	useRfs=EFalse;
       
   609 	GetBoolFromConfig(aSection, KUseRfs(), useRfs);
       
   610 
       
   611 	TInt	err=KErrNone;
       
   612 	if ( useRfs )
       
   613 		{
       
   614 		INFO_PRINTF1(_L("RWsSession::Connect(RFs&) call"));
       
   615 		err=iWsSession->Connect(FileServer());
       
   616 		}
       
   617 	else
       
   618 		{
       
   619 		INFO_PRINTF1(_L("RWsSession::Connect() call"));
       
   620 		err=iWsSession->Connect();
       
   621 		}
       
   622 	if ( err!=KErrNone )
       
   623 		{
       
   624 		ERR_PRINTF2(KLogError, err);
       
   625 		SetError(err);
       
   626 		}
       
   627 	}
       
   628 
       
   629 void CT_DataWsSession::DoCmdClose()
       
   630 	{
       
   631 	INFO_PRINTF1(_L("RWsSession::Close() call"));
       
   632 	iWsSession->Close();
       
   633 	}
       
   634 
       
   635 void CT_DataWsSession::DoCmdVersion(const TDesC& aSection)
       
   636 	{
       
   637 	INFO_PRINTF1(_L("WsSession::Version() call"));
       
   638 
       
   639 	TVersion		version		= iWsSession->Version();
       
   640 
       
   641 	INFO_PRINTF2(_L("Version build : %d"), (TInt)version.iBuild);
       
   642 	INFO_PRINTF2(_L("Version major : %d"), (TInt)version.iMajor);
       
   643 	INFO_PRINTF2(_L("Version minor : %d"), (TInt)version.iMinor);
       
   644 	TInt	intTemp;
       
   645 	if ( GetIntFromConfig(aSection, KVersionBuild(), intTemp) )
       
   646 		{
       
   647 		if ( intTemp != version.iBuild )
       
   648 			{
       
   649 			ERR_PRINTF1(_L("Build does not match expected build"));
       
   650 			SetBlockResult(EFail);
       
   651 			}
       
   652 		}
       
   653 
       
   654 	if ( GetIntFromConfig(aSection, KVersionMajor(), intTemp) )
       
   655 		{
       
   656 		if ( intTemp != version.iMajor )
       
   657 			{
       
   658 			ERR_PRINTF1(_L("Major does not match expected major"));
       
   659 			SetBlockResult(EFail);
       
   660 			}
       
   661 		}
       
   662 
       
   663 	if ( GetIntFromConfig(aSection, KVersionMinor(), intTemp) )
       
   664 		{
       
   665 		if ( intTemp != version.iMinor )
       
   666 			{
       
   667 			ERR_PRINTF1(_L("Minor does not match expected minor"));
       
   668 			SetBlockResult(EFail);
       
   669 			}
       
   670 		}
       
   671 
       
   672 	if (version.Name() == _L("") && version.iBuild == 0 && version.iMajor == 0 && version.iMinor == 0)
       
   673 		{
       
   674 		ERR_PRINTF1(_L("Some version fields are not set!"));
       
   675 		SetBlockResult(EFail);
       
   676 		}
       
   677 	}
       
   678 
       
   679 void CT_DataWsSession::DoCmdSetHotKey(const TDesC& aSection)
       
   680 	{
       
   681 	TBool	dataOk=ETrue;
       
   682 
       
   683 	THotKey	hotKey;
       
   684 	TInt	err=KErrNone;
       
   685 	
       
   686 	if ( !CT_GraphicsUtil::ReadHotKey(*this, aSection, KSetHotKey(), hotKey) )
       
   687 		{
       
   688 		dataOk=EFalse;
       
   689 		ERR_PRINTF2(KLogMissingParameter, &KSetHotKey());
       
   690 		SetBlockResult(EFail);
       
   691 		}
       
   692 
       
   693 	TKeyCode	keyCode;
       
   694 	if ( !CT_GraphicsUtil::ReadKeyCode(*this, aSection, KSetKeyCode(), keyCode) )
       
   695 		{
       
   696 		dataOk=EFalse;
       
   697 		ERR_PRINTF2(KLogMissingParameter, &KSetKeyCode());
       
   698 		SetBlockResult(EFail);
       
   699 		}
       
   700 
       
   701 	TUint	modifierMask=EModifierAlt | EModifierCtrl | EModifierShift | EModifierFunc | EModifierCapsLock;
       
   702 	CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifierMask, modifierMask);
       
   703 	TUint	modifier=EModifierAlt | EModifierCtrl | EModifierShift | EModifierFunc | EModifierCapsLock;
       
   704 	CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifier, modifier);
       
   705 	if ( dataOk )
       
   706 		{
       
   707 		err = iWsSession->SetHotKey(hotKey, keyCode, modifierMask, modifier);
       
   708 		}
       
   709 	
       
   710 	if ( err!=KErrNone )
       
   711 		{
       
   712 		ERR_PRINTF2(KLogError, err);
       
   713 		SetError(err);
       
   714 		}
       
   715 	}
       
   716 
       
   717 void CT_DataWsSession::DoCmdClearHotKeys(const TDesC& aSection)
       
   718 	{
       
   719 	THotKey	hotKey;
       
   720 	
       
   721 	TInt	err=KErrNone;
       
   722 	if ( !CT_GraphicsUtil::ReadHotKey(*this, aSection, KClsHotKey(), hotKey) )
       
   723 		{
       
   724 		ERR_PRINTF2(KLogMissingParameter, &KClsHotKey());
       
   725 		SetBlockResult(EFail);
       
   726 		}
       
   727 	else
       
   728 		{
       
   729 		err = iWsSession->ClearHotKeys(hotKey);
       
   730 		}
       
   731 	
       
   732 	if ( err!=KErrNone )
       
   733 		{
       
   734 		ERR_PRINTF2(KLogError, err);
       
   735 		SetError(err);
       
   736 		}
       
   737 	}
       
   738 
       
   739 void CT_DataWsSession::DoCmdRestoreDefaultHotKey(const TDesC& aSection)
       
   740 	{
       
   741 	THotKey	hotKey;
       
   742 	
       
   743 	TInt	err=KErrNone;
       
   744 	if ( !CT_GraphicsUtil::ReadHotKey(*this, aSection, KRestoreDefHotKey(), hotKey) )
       
   745 		{
       
   746 		ERR_PRINTF2(KLogMissingParameter, &KRestoreDefHotKey());
       
   747 		SetBlockResult(EFail);
       
   748 		}
       
   749 	else
       
   750 		{
       
   751 		err=iWsSession->RestoreDefaultHotKey(hotKey);
       
   752 		}
       
   753 	
       
   754 	if ( err!=KErrNone )
       
   755 		{
       
   756 		ERR_PRINTF2(KLogError, err);
       
   757 		SetError(err);
       
   758 		}
       
   759 		
       
   760 	}
       
   761 
       
   762 void CT_DataWsSession::DoCmdEventReady(const TDesC& aSection, TInt aAsyncErrorIndex)
       
   763 	{
       
   764 	CActive::TPriority	priority=CActive::EPriorityHigh;
       
   765 	CT_GraphicsUtil::ReadPriority(*this, aSection, KRequestEvent(), priority);
       
   766 
       
   767 	iActiveEventReady->SetPriority(priority);
       
   768 	INFO_PRINTF1(_L("RWsSession::EventReady() call"));
       
   769 	iWsSession->EventReady(&iActiveEventReady->iStatus);
       
   770 	iActiveEventReady->Activate(aAsyncErrorIndex);
       
   771 	IncOutstanding();
       
   772 	}
       
   773 
       
   774 void CT_DataWsSession::DoCmdEventReadyCancel()
       
   775 	{
       
   776 	iWsSession->EventReadyCancel();
       
   777 	}
       
   778 
       
   779 void CT_DataWsSession::DoCmdGetEventL(const TDesC& aSection)
       
   780 	{
       
   781 	TWsEvent	event;
       
   782 
       
   783 	iWsSession->GetEvent(event);
       
   784 	INFO_PRINTF1(_L("RWsSession::GetEvent() call"));
       
   785 
       
   786 	TWsEvent*	store=NULL;
       
   787 	if ( CT_GraphicsUtil::GetWsEventL(*this, aSection, KFldStore(), store) )
       
   788 		{
       
   789 		*store=event;
       
   790 		}
       
   791 	}
       
   792 
       
   793 void CT_DataWsSession::DoCmdPurgePointerEvents()
       
   794 	{
       
   795 	// Execute command and log parameters
       
   796 	INFO_PRINTF3(_L("execute %S::%S()"), &KDataClassname, &KCmdPurgePointerEvents);
       
   797 	iWsSession->PurgePointerEvents();
       
   798 	}
       
   799 
       
   800 void CT_DataWsSession::DoCmdRedrawReady(const TDesC& aSection, TInt aAsyncErrorIndex)
       
   801 	{
       
   802 	CActive::TPriority	priority=CActive::EPriorityHigh;
       
   803 	CT_GraphicsUtil::ReadPriority(*this, aSection, KRequestRedraw(), priority);
       
   804 
       
   805 	iActiveRedrawReady->SetPriority(priority);
       
   806 	INFO_PRINTF1(_L("RWsSession::RedrawReady() call"));
       
   807 	iWsSession->RedrawReady(&iActiveRedrawReady->iStatus);
       
   808 	iActiveRedrawReady->Activate(aAsyncErrorIndex);
       
   809 	IncOutstanding();
       
   810 	}
       
   811 
       
   812 void CT_DataWsSession::DoCmdRedrawReadyCancel()
       
   813 	{
       
   814 	INFO_PRINTF1(_L("RWsSession::RedrawReadyCancel() call"));
       
   815 	iWsSession->RedrawReadyCancel();
       
   816 	}
       
   817 
       
   818 void CT_DataWsSession::DoCmdGetRedrawL(const TDesC& aSection)
       
   819 	{
       
   820 	TWsRedrawEvent 	redrawEvent;
       
   821 
       
   822 	iWsSession->GetRedraw(redrawEvent);
       
   823 	INFO_PRINTF1(_L("RWsSession::GetRedraw() call"));
       
   824 
       
   825 	TWsRedrawEvent*	store=NULL;
       
   826 	if ( CT_GraphicsUtil::GetWsRedrawEventL(*this, aSection, KFldStore(), store) )
       
   827 		{
       
   828 		*store=redrawEvent;
       
   829 		}
       
   830 	}
       
   831 
       
   832 void CT_DataWsSession::DoCmdPriorityKeyReady(const TDesC& aSection, TInt aAsyncErrorIndex)
       
   833 	{
       
   834 	CActive::TPriority	priority=CActive::EPriorityHigh;
       
   835 	CT_GraphicsUtil::ReadPriority(*this, aSection, KPKPriorityKey(), priority);
       
   836 
       
   837 	iActivePriorityKeyReady->SetPriority(priority);
       
   838 	INFO_PRINTF1(_L("RWsSession::PriorityKeyReady() call"));
       
   839 	iWsSession->PriorityKeyReady(&iActivePriorityKeyReady->iStatus);
       
   840 	iActivePriorityKeyReady->Activate(aAsyncErrorIndex);
       
   841 	IncOutstanding();
       
   842 	}
       
   843 
       
   844 
       
   845 void CT_DataWsSession::DoCmdPriorityKeyReadyCancel()
       
   846 	{
       
   847 	INFO_PRINTF1(_L("RWsSession::PriorityKeyReadyCancel() call"));
       
   848 	iWsSession->PriorityKeyReadyCancel();
       
   849 	}
       
   850 
       
   851 void CT_DataWsSession::DoCmdGetPriorityKeyL(const TDesC& aSection)
       
   852 	{
       
   853 	TWsPriorityKeyEvent  	event;
       
   854 
       
   855 	iWsSession->GetPriorityKey(event);
       
   856 	INFO_PRINTF1(_L("RWsSession::GetPriorityKey() call"));
       
   857 
       
   858 	TWsPriorityKeyEvent *	store=NULL;
       
   859 	if ( CT_GraphicsUtil::GetWsPriorityKeyEventL(*this, aSection, KFldStore(), store) )
       
   860 		{
       
   861 		*store=event;
       
   862 		}
       
   863 	}
       
   864 
       
   865 void CT_DataWsSession::DoCmdFlush()
       
   866 	{
       
   867 	INFO_PRINTF1(_L("RWsSession::Flush() call"));
       
   868 	iWsSession->Flush();
       
   869 	}
       
   870 
       
   871 void CT_DataWsSession::DoCmdSetAutoFlush(const TDesC& aSection)
       
   872 	{
       
   873 	TBool	actualFlushstate;
       
   874 	TBool	setFlushState=EFalse;
       
   875 	TBool	expectedFlush=EFalse;
       
   876 
       
   877 	if ( !GetBoolFromConfig(aSection, KAutoFlushState(), setFlushState) )
       
   878 		{
       
   879 		ERR_PRINTF2(KLogMissingParameter, &KAutoFlushState());
       
   880 		SetBlockResult(EFail);
       
   881 		}
       
   882 	else
       
   883 		{
       
   884 		actualFlushstate = iWsSession->SetAutoFlush(setFlushState);
       
   885 		INFO_PRINTF2(_L("Flush State: %d"),actualFlushstate);
       
   886 		
       
   887 		if ( !GetBoolFromConfig(aSection, KExpectFlushState(), expectedFlush) )
       
   888 			{
       
   889 			ERR_PRINTF2(KLogMissingParameter, &KExpectFlushState());
       
   890 			SetBlockResult(EFail);
       
   891 			}
       
   892 		else
       
   893 			{
       
   894 			if ( actualFlushstate!=expectedFlush)
       
   895 				{
       
   896 				ERR_PRINTF1(_L("SetAutoFlush is not as expected!"));
       
   897 				SetBlockResult(EFail);
       
   898 				}
       
   899 			}
       
   900 		}
       
   901 	}
       
   902 
       
   903 void CT_DataWsSession::DoCmdSetKeyboardRepeatRate(const TDesC& aSection)
       
   904 	{
       
   905     TInt	setInputInterval=iKeyboardRepeateRateInitialTime.Int();
       
   906     GetIntFromConfig(aSection, KSetKBRepRateInterval(), setInputInterval);
       
   907 
       
   908 	TInt	setInputTime=iKeyboardRepeateRateTime.Int();
       
   909 	GetIntFromConfig(aSection, KSetKBRepRateTime(), setInputTime);
       
   910 
       
   911 	TTimeIntervalMicroSeconds32 changeInitialTime(setInputInterval);
       
   912 	TTimeIntervalMicroSeconds32 changeTime(setInputTime);
       
   913 	iWsSession->SetKeyboardRepeatRate(changeInitialTime, changeTime);
       
   914 	}
       
   915 
       
   916 void CT_DataWsSession::DoCmdGetKeyboardRepeatRate(const TDesC& aSection)
       
   917 	{
       
   918 	TTimeIntervalMicroSeconds32	actualInitialTime;
       
   919 	TTimeIntervalMicroSeconds32	actualTime;
       
   920 	iWsSession->GetKeyboardRepeatRate(actualInitialTime, actualTime);
       
   921 	INFO_PRINTF2(_L("actual Interval Time: %d"), actualInitialTime.Int());
       
   922 	INFO_PRINTF2(_L("actual Time: %d"), actualTime.Int());
       
   923 
       
   924 	TInt	expectInitialTime;
       
   925 	if(	GetIntFromConfig(aSection, KWGGetExpectedKBInitialTime(), expectInitialTime))
       
   926 		{
       
   927 		if ( actualInitialTime.Int()!=expectInitialTime )
       
   928 			{
       
   929 			ERR_PRINTF1(_L("GetKeyboardRepeatRate is not as expected!"));
       
   930 			SetBlockResult(EFail);
       
   931 			}
       
   932 		}
       
   933 
       
   934 	TInt	expectTime;
       
   935 	if ( GetIntFromConfig(aSection, KWGGetExpectedKBRepeatTime(), expectTime) )
       
   936 		{
       
   937 		if ( actualTime.Int()!=expectTime)
       
   938 			{
       
   939 			ERR_PRINTF1(_L("GetKeyboardRepeatRate is not as expected!"));
       
   940 			SetBlockResult(EFail);
       
   941 			}
       
   942 		}
       
   943 
       
   944 	TBool	checkWithStore=FALSE;
       
   945 	GetBoolFromConfig(aSection, KFldCheckWithStore(), checkWithStore);
       
   946 	if ( checkWithStore )
       
   947 		{
       
   948 		if ( iKeyboardRepeateRateInitialTime!=actualInitialTime )
       
   949 			{
       
   950 			ERR_PRINTF1(_L("GetKeyboardRepeatRate is not as expected!"));
       
   951 			SetBlockResult(EFail);
       
   952 			}
       
   953 		if ( iKeyboardRepeateRateTime!=actualTime )
       
   954 			{
       
   955 			ERR_PRINTF1(_L("GetKeyboardRepeatRate is not as expected!"));
       
   956 			SetBlockResult(EFail);
       
   957 			}
       
   958 		}
       
   959 
       
   960 	TBool	store=FALSE;
       
   961 	GetBoolFromConfig(aSection, KFldStore(), store);
       
   962 	if ( store )
       
   963 		{
       
   964 		iKeyboardRepeateRateInitialTime=actualInitialTime;
       
   965 		iKeyboardRepeateRateTime=actualTime;
       
   966 		}
       
   967 	}
       
   968 
       
   969 void CT_DataWsSession::DoCmdSetDoubleClick(const TDesC& aSection)
       
   970 	{
       
   971 	TBool	dataOk=ETrue;
       
   972     TInt	setMaxInputInterval;
       
   973     if ( !GetIntFromConfig(aSection, KDblClickInterval(), setMaxInputInterval) )
       
   974 		{
       
   975 		dataOk=EFalse;
       
   976 		ERR_PRINTF2(KLogMissingParameter, &KDblClickInterval());
       
   977 		SetBlockResult(EFail);
       
   978 		}
       
   979 
       
   980 	TInt	setMaxDistance;
       
   981 	if ( !GetIntFromConfig(aSection, KDblClickDistance(), setMaxDistance) )
       
   982 		{
       
   983 		dataOk=EFalse;
       
   984 		ERR_PRINTF2(KLogMissingParameter, &KDblClickDistance());
       
   985 		SetBlockResult(EFail);
       
   986 		}
       
   987 
       
   988 	if ( dataOk )
       
   989 		{
       
   990 		TTimeIntervalMicroSeconds32	changeMaxIntervalTime(setMaxInputInterval);
       
   991 		iWsSession->SetDoubleClick(changeMaxIntervalTime, setMaxDistance);
       
   992 		}
       
   993 	}
       
   994 
       
   995 void CT_DataWsSession::DoCmdGetDoubleClickSettings(const TDesC& aSection)
       
   996 	{
       
   997 	TTimeIntervalMicroSeconds32	actualMaxIntervalValue;
       
   998 	TInt						actualMaxDistanceValue;
       
   999 	iWsSession->GetDoubleClickSettings(actualMaxIntervalValue, actualMaxDistanceValue);
       
  1000 	INFO_PRINTF2(_L("Maximum interval: %d"), actualMaxIntervalValue.Int());
       
  1001 	INFO_PRINTF2(_L("Maximum distance : %d"), actualMaxDistanceValue);
       
  1002 
       
  1003 	TInt	expectMaxIntervalValue;
       
  1004 	if ( !GetIntFromConfig(aSection, KExpectedDblMaxInitialTime(), expectMaxIntervalValue))
       
  1005 		{
       
  1006 		ERR_PRINTF2(KLogMissingParameter, &KExpectedDblMaxInitialTime());
       
  1007 		SetBlockResult(EFail);
       
  1008 		}
       
  1009 	else
       
  1010 		{
       
  1011 		if ( actualMaxIntervalValue.Int()!=expectMaxIntervalValue )
       
  1012 			{
       
  1013 			ERR_PRINTF1(KLogNotExpectedValue);
       
  1014 			SetBlockResult(EFail);
       
  1015 			}
       
  1016 		}
       
  1017 
       
  1018 	TInt	expectMaxDistanceValue;
       
  1019 	if ( !GetIntFromConfig(aSection, KExpectedDblDistance(), expectMaxDistanceValue))
       
  1020 		{
       
  1021 		ERR_PRINTF2(KLogMissingParameter, &KExpectedDblDistance());
       
  1022 		SetBlockResult(EFail);
       
  1023 		}
       
  1024 	else
       
  1025 		{
       
  1026 		if ( actualMaxDistanceValue!=expectMaxDistanceValue)
       
  1027 			{
       
  1028 			ERR_PRINTF1(KLogNotExpectedValue);
       
  1029 			SetBlockResult(EFail);
       
  1030 			}
       
  1031 		}
       
  1032 	}
       
  1033 
       
  1034 void CT_DataWsSession::DoCmdNumWindowGroups(const TDesC& aSection)
       
  1035 	{
       
  1036 	TBool	dataOk=ETrue;
       
  1037 	TInt	previousCount=iNumWinGroup;
       
  1038 
       
  1039 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  1040 	TInt	priority;
       
  1041 	if ( GetIntFromConfig(aSection, KWGGivenPriority(), priority) )
       
  1042 		{
       
  1043 		TInt	screenNumber=0;
       
  1044 		if ( !GetIntFromConfig(aSection, KWGSpecifieScrnNo(), screenNumber) )
       
  1045 			{
       
  1046 			iNumWinGroup=iWsSession->NumWindowGroups(priority);
       
  1047 			INFO_PRINTF2(_L("NumWindowGroups(TInt aPriority):%d"), iNumWinGroup);
       
  1048 			}
       
  1049 		else
       
  1050 			{
       
  1051 			iNumWinGroup=iWsSession->NumWindowGroups(screenNumber, priority);
       
  1052 			INFO_PRINTF2(_L("NumWindowGroups(TInt aScreenNumber, TInt aPriority):%d"), iNumWinGroup);
       
  1053 			}
       
  1054 		}
       
  1055 	else
       
  1056 #endif
       
  1057 		{
       
  1058 		iNumWinGroup=iWsSession->NumWindowGroups();
       
  1059 		INFO_PRINTF2(_L("NumWindowGroups():%d"), iNumWinGroup);
       
  1060 		}
       
  1061 
       
  1062 	if ( dataOk )
       
  1063 		{
       
  1064 		TInt	difference=0;
       
  1065 		if ( GetIntFromConfig(aSection, KExpectedDiff(), difference) )
       
  1066 			{
       
  1067 			if ( (iNumWinGroup-previousCount)!=difference )
       
  1068 				{
       
  1069 				ERR_PRINTF2(_L("Previous count:%d"), previousCount);
       
  1070 				ERR_PRINTF1(KLogNotExpectedValue);
       
  1071 				SetBlockResult(EFail);
       
  1072 				}
       
  1073 			}
       
  1074 		}
       
  1075 	}
       
  1076 
       
  1077 void CT_DataWsSession::DoCmdWindowGroupListL(const TDesC& aSection)
       
  1078 	{
       
  1079 	INFO_PRINTF2(_L("iNumWinGroup:%d"), iNumWinGroup);
       
  1080 	RArray<RWsSession::TWindowGroupChainInfo>	numWGListRArray(1);
       
  1081 	CArrayFixFlat<TInt>*						numWGListCArray=new (ELeave) CArrayFixFlat<TInt>(iNumWinGroup);
       
  1082 	CleanupStack::PushL(numWGListCArray);
       
  1083 	CleanupClosePushL(numWGListRArray);
       
  1084 
       
  1085 	//True:CArrayFixFlat  Flase:RArray
       
  1086 	TInt	priority;
       
  1087 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  1088 	TBool	hasPriority=CT_GraphicsUtil::ReadPriorities(*this, aSection, KWGListPriority(), priority);
       
  1089 #else
       
  1090 	TBool	hasPriority=GetIntFromConfig(aSection, KWGListPriority(), priority);
       
  1091 #endif
       
  1092 
       
  1093 	TBool	useClassArray;
       
  1094 	if ( !GetBoolFromConfig(aSection, KWGUseArray(), useClassArray) )
       
  1095 		{
       
  1096 		ERR_PRINTF2(KLogMissingParameter, &KWGUseArray());
       
  1097 		SetBlockResult(EFail);
       
  1098 		}
       
  1099 	else
       
  1100 		{
       
  1101 		TInt	err=KErrNone;
       
  1102 		INFO_PRINTF2(_L("Use Class array:%d"), useClassArray);
       
  1103 		
       
  1104 		if ( useClassArray )
       
  1105 			{
       
  1106 			if(	hasPriority )
       
  1107 				{
       
  1108 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  1109 				TInt	theScrnNum;
       
  1110 				if(	GetIntFromConfig(aSection, KWGScreenNumber(), theScrnNum))
       
  1111 					{
       
  1112 					INFO_PRINTF1(_L("WindowGroupList(CArrayFixFlat< TInt >*, TInt, TInt)"));
       
  1113 					err=iWsSession->WindowGroupList(numWGListCArray, theScrnNum, priority);
       
  1114 					}
       
  1115 				else
       
  1116 #endif
       
  1117 					{
       
  1118 					INFO_PRINTF1(_L("WindowGroupList(TInt, CArrayFixFlat<TInt>*)"));
       
  1119 					err=iWsSession->WindowGroupList(priority, numWGListCArray);
       
  1120 					}
       
  1121 				}
       
  1122 			else
       
  1123 				{
       
  1124 				INFO_PRINTF1(_L("WindowGroupList(CArrayFixFlat<TInt>*)"));
       
  1125 				err=iWsSession->WindowGroupList(numWGListCArray);
       
  1126 				}
       
  1127 			}
       
  1128 		else
       
  1129 			{
       
  1130 			if ( hasPriority )
       
  1131 				{
       
  1132 				INFO_PRINTF1(_L("WindowGroupList(TInt, RArray<RWsSession::TWindowGroupChainInfo>*)"));
       
  1133 				err=iWsSession->WindowGroupList(priority, &numWGListRArray);
       
  1134 				}
       
  1135 			else
       
  1136 				{
       
  1137 				INFO_PRINTF1(_L("WindowGroupList(RArray<RWsSession::TWindowGroupChainInfo>)"));
       
  1138 				err=iWsSession->WindowGroupList(&numWGListRArray);
       
  1139 				}
       
  1140 			}
       
  1141 
       
  1142 		if ( err!=KErrNone )
       
  1143 			{
       
  1144 			ERR_PRINTF2(KLogError, err);
       
  1145 			SetError(err);
       
  1146 			}
       
  1147 		else
       
  1148 			{
       
  1149 			if ( useClassArray )
       
  1150 				{
       
  1151 				TInt	actual=0;
       
  1152 				INFO_PRINTF2(_L("numWGListCArray:%d"), numWGListCArray->Count());
       
  1153 				for ( TInt index=0; index<numWGListCArray->Count(); ++index )
       
  1154 					{
       
  1155 					// Gets a list of identifiers of all window groups in all window server sessions
       
  1156 					actual=(*numWGListCArray)[index];
       
  1157 					INFO_PRINTF3(_L("CArrayFixFlat[%d]= :%d"), index, actual);
       
  1158 					}
       
  1159 				}
       
  1160 			else
       
  1161 				{
       
  1162 				RWsSession::TWindowGroupChainInfo	actual;
       
  1163 				INFO_PRINTF2(_L("numWGListRArray:%d"), numWGListRArray.Count());
       
  1164 				for ( TInt index=0; index<numWGListRArray.Count(); ++index )
       
  1165 					{
       
  1166 					// Gets a list of identifiers of all window groups in all window server sessions
       
  1167 					actual=numWGListRArray[index];
       
  1168 					INFO_PRINTF4(_L("RArray{%d] iId:%d iParentId:%d"), index, actual.iId, actual.iParentId);
       
  1169 					}
       
  1170 				}
       
  1171 			}
       
  1172 		}
       
  1173 
       
  1174 	CleanupStack::PopAndDestroy(2, numWGListCArray);
       
  1175 	}
       
  1176 
       
  1177 void CT_DataWsSession::DoCmdGetFocusWindowGroup(const TDesC& aSection)
       
  1178 	{
       
  1179 	TInt	actual=0;
       
  1180 
       
  1181 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  1182 	TInt	theScrnNum=0;
       
  1183 	if ( GetIntFromConfig(aSection, KWGScreenNumber(), theScrnNum) )
       
  1184 		{
       
  1185 		INFO_PRINTF1(_L("RWsSession::GetFocusWindowGroup(TInt aScreenNumber)  call"));
       
  1186 		actual=iWsSession->GetFocusWindowGroup(theScrnNum);
       
  1187 		}
       
  1188 	else
       
  1189 #endif
       
  1190 		{
       
  1191 		INFO_PRINTF1(_L("RWsSession::GetFocusWindowGroup() call"));
       
  1192 		actual=iWsSession->GetFocusWindowGroup();
       
  1193 		}
       
  1194 	INFO_PRINTF2(_L("Window Group Identifier:%d"), actual);
       
  1195 
       
  1196 	TInt 	expected=0;
       
  1197 	if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
       
  1198 		{
       
  1199 		if ( actual!=expected )
       
  1200 			{
       
  1201 			ERR_PRINTF1(_L("Window group identifier is not as expected!"));
       
  1202 			SetBlockResult(EFail);
       
  1203 			}
       
  1204 		}
       
  1205 	}
       
  1206 
       
  1207 void CT_DataWsSession::DoCmdGetDefaultOwningWindow(const TDesC& aSection)
       
  1208 	{
       
  1209 	TInt	actual=0;
       
  1210 	TBool	dataOk=ETrue;
       
  1211 
       
  1212 	TInt	theScrnNum=0;
       
  1213 	if(	GetIntFromConfig(aSection, KWGScreenNumber(), theScrnNum))
       
  1214 		{
       
  1215 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  1216 		INFO_PRINTF1(_L("RWsSession::GetDefaultOwningWindow(TInt aScreenNumber)  call"));
       
  1217 		actual=iWsSession->GetDefaultOwningWindow(theScrnNum);
       
  1218 #else
       
  1219 		dataOk=EFalse;
       
  1220 		ERR_PRINTF1(_L("SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS Not Supported"));
       
  1221 		SetBlockResult(EFail);
       
  1222 #endif
       
  1223 		}
       
  1224 	else
       
  1225 		{
       
  1226 		INFO_PRINTF1(_L("RWsSession::GetDefaultOwningWindow()  call"));
       
  1227 		actual=iWsSession->GetDefaultOwningWindow();
       
  1228 		}
       
  1229 
       
  1230 	if ( dataOk )
       
  1231 		{
       
  1232 		INFO_PRINTF2(_L("default owning window:%d"), actual);
       
  1233 
       
  1234 		TInt	expected=0;
       
  1235 		if ( !GetIntFromConfig(aSection, KFldExpected(), expected) )
       
  1236 			{
       
  1237 			ERR_PRINTF2(KLogMissingParameter, &KFldExpected());
       
  1238 			SetBlockResult(EFail);
       
  1239 			}
       
  1240 		else
       
  1241 			{
       
  1242 			if ( actual!=expected)
       
  1243 				{
       
  1244 				ERR_PRINTF1(_L("Default Owning Window is not as expected!"));
       
  1245 				SetBlockResult(EFail);
       
  1246 				}
       
  1247 			}
       
  1248 		}
       
  1249 	}
       
  1250 
       
  1251 void CT_DataWsSession::DoCmdSetWindowGroupOrdinalPosition(const TDesC& aSection)
       
  1252 	{
       
  1253 	TBool	dataOk=ETrue;
       
  1254 
       
  1255 	TInt		 inputWGId;
       
  1256 	if ( !GetIntFromConfig(aSection, KWGOrdinalId(), inputWGId) )
       
  1257 		{
       
  1258 		TPtrC		 objectName;
       
  1259 		if ( GetStringFromConfig(aSection, KFldWindowGroup(), objectName) )
       
  1260 			 {
       
  1261 			 INFO_PRINTF1(_L("Get CT_DataWindowGroup's wrapper. "));
       
  1262 			 CDataWrapperBase* wrapper = NULL;
       
  1263 			 wrapper = static_cast<CDataWrapperBase*>(GetDataWrapperL(objectName));
       
  1264 			 if(wrapper)
       
  1265 				 {
       
  1266 				 inputWGId=wrapper->GetIdentifier();
       
  1267 				 INFO_PRINTF2(_L("Window group's identifier is: %d"), inputWGId);
       
  1268 				 }
       
  1269 			 else
       
  1270 				 {
       
  1271 				 dataOk=EFalse;
       
  1272 				 ERR_PRINTF1(_L("Window group's wrapper pointer is NULL"));
       
  1273 				 SetBlockResult(EFail);
       
  1274 				 }
       
  1275 			 }
       
  1276 		else
       
  1277 			 {
       
  1278 			 dataOk=EFalse;
       
  1279 			 ERR_PRINTF2(KLogMissingParameter, &KWGOrdinalId());
       
  1280 			 SetBlockResult(EFail);
       
  1281 			 }
       
  1282 		}
       
  1283    	
       
  1284 	TInt	inputWGOrdinalPos;
       
  1285 	if ( !GetIntFromConfig(aSection, KWGOrdinalPosition(), inputWGOrdinalPos) )
       
  1286 		{
       
  1287 		dataOk=EFalse;
       
  1288 		ERR_PRINTF2(KLogMissingParameter, &KWGOrdinalPosition());
       
  1289 		SetBlockResult(EFail);
       
  1290 		}
       
  1291 
       
  1292 	if ( dataOk )
       
  1293 		{
       
  1294 		TInt	err=iWsSession->SetWindowGroupOrdinalPosition(inputWGId, inputWGOrdinalPos);
       
  1295 
       
  1296 		if ( err!=KErrNone )
       
  1297 			{
       
  1298 			ERR_PRINTF2(KLogError, err);
       
  1299 			SetError(err);
       
  1300 			}
       
  1301 		}
       
  1302 	}
       
  1303 
       
  1304 void CT_DataWsSession::DoCmdGetWindowGroupClientThreadId(const TDesC& aSection)
       
  1305 	{
       
  1306 	TInt	inputWindowGroupIdentifier=0;
       
  1307 	if ( !GetIntFromConfig(aSection, KWindowGroupIdentifier(), inputWindowGroupIdentifier) )
       
  1308 		{
       
  1309 		ERR_PRINTF2(KLogMissingParameter, &KWindowGroupIdentifier());
       
  1310 		SetBlockResult(EFail);
       
  1311 		}
       
  1312 	else
       
  1313 		{
       
  1314 		TThreadId	threadId;
       
  1315 		TInt		err=iWsSession->GetWindowGroupClientThreadId(inputWindowGroupIdentifier, threadId);
       
  1316 		TUint64		actual=threadId.Id();
       
  1317 		INFO_PRINTF1(_L("RWsSession::GetWindowGroupClientThreadId"));
       
  1318 		INFO_PRINTF2(_L("actual ThreadId:%d"), actual);
       
  1319 		if ( err!=KErrNone )
       
  1320 			{
       
  1321 			ERR_PRINTF2(KLogError, err);
       
  1322 			SetError(err);
       
  1323 			}
       
  1324 		}
       
  1325 	}
       
  1326 
       
  1327 void CT_DataWsSession::DoCmdGetWindowGroupHandle(const TDesC& aSection)
       
  1328     {
       
  1329 	TInt	inputWGId=0;
       
  1330 	if ( !GetIntFromConfig(aSection, KInputWGId(), inputWGId) )
       
  1331 		{
       
  1332 		ERR_PRINTF2(KLogMissingParameter, &KInputWGId());
       
  1333 		SetBlockResult(EFail);
       
  1334 		}
       
  1335 	else
       
  1336 		{
       
  1337 		TInt	actual=iWsSession->GetWindowGroupHandle(inputWGId);
       
  1338 		INFO_PRINTF2(_L("Window group handle :%d"), actual);
       
  1339 		}
       
  1340     }
       
  1341 
       
  1342 void CT_DataWsSession::DoCmdGetWindowGroupOrdinalPriority(const TDesC& aSection)
       
  1343     {
       
  1344 	TInt	inputWGId=0;
       
  1345 	if ( !GetIntFromConfig(aSection, KWGOrdinalPriority(), inputWGId))
       
  1346 		{
       
  1347 		ERR_PRINTF2(KLogMissingParameter, &KWGOrdinalPriority());
       
  1348 		SetBlockResult(EFail);
       
  1349 		}
       
  1350 	else
       
  1351 		{
       
  1352 		TInt	actual=iWsSession->GetWindowGroupOrdinalPriority(inputWGId);
       
  1353 		INFO_PRINTF2(_L("Window Group Ordinal Priority:%d"), actual);
       
  1354 		
       
  1355 		TInt	expected;
       
  1356 		if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
       
  1357 			{
       
  1358 			if ( actual!=expected )
       
  1359 				{
       
  1360 				ERR_PRINTF1(KLogNotExpectedValue);
       
  1361 				SetBlockResult(EFail);
       
  1362 				}
       
  1363 			}
       
  1364 		}
       
  1365     }
       
  1366 
       
  1367 void CT_DataWsSession::DoCmdGetWindowGroupNameFromIdentifier(const TDesC& aSection)
       
  1368 	{
       
  1369 	TInt 	inquiredWGId=0;
       
  1370 	TInt	rtnStatus;
       
  1371 
       
  1372 	if ( !GetIntFromConfig(aSection, KWGinquiredId(), inquiredWGId) )
       
  1373 		{
       
  1374 		ERR_PRINTF2(KLogMissingParameter, &KWGinquiredId());
       
  1375 		SetBlockResult(EFail);
       
  1376 		}
       
  1377 	else
       
  1378 		{
       
  1379 		TBuf<KGroupNameMaxSize> storeAWindowName;
       
  1380 		INFO_PRINTF2(_L("Window Group inquired Id:%d"),inquiredWGId);
       
  1381 		rtnStatus= iWsSession->GetWindowGroupNameFromIdentifier(inquiredWGId, storeAWindowName);
       
  1382 		INFO_PRINTF2(_L("return status:%d"),rtnStatus);
       
  1383 
       
  1384 		if (rtnStatus==KErrNone)
       
  1385 			{
       
  1386 			INFO_PRINTF2(_L("the length of  buffer:%d"),storeAWindowName.Length());
       
  1387 			INFO_PRINTF1(_L("the name of window group:"));
       
  1388 			INFO_PRINTF1(storeAWindowName);
       
  1389 			}
       
  1390 		else
       
  1391 			{
       
  1392 			ERR_PRINTF1(_L("GetWindowGroupNameFromIdentifier function is fail!"));
       
  1393 			SetBlockResult(EFail);
       
  1394 			}
       
  1395 		}
       
  1396 	}
       
  1397 
       
  1398 void CT_DataWsSession::DoCmdFindWindowGroupIdentifier(const TDesC& aSection)
       
  1399 	{
       
  1400 	TInt	previousId=iWindowGroupIdentifier;
       
  1401 	GetIntFromConfig(aSection, KFindWGPreId(), previousId);
       
  1402 	INFO_PRINTF2(_L("previous window group id:%d"), previousId);
       
  1403 
       
  1404 	TInt	nextId;
       
  1405 	TPtrC	matchString;
       
  1406 	if ( GetStringFromConfig(aSection, KMatchWGString(), matchString) )
       
  1407 		{
       
  1408 		TInt	offset=0;
       
  1409 		GetIntFromConfig(aSection, KFldOffset(), offset);
       
  1410 		nextId=iWsSession->FindWindowGroupIdentifier(previousId, matchString, offset);
       
  1411 		}
       
  1412 	else
       
  1413 		{
       
  1414 		RThread		proc;
       
  1415 		TThreadId	threadId=proc.Id();
       
  1416 
       
  1417 		TInt	id;
       
  1418 		if ( GetIntFromConfig(aSection, KThreadId(), id) )
       
  1419 			{
       
  1420 			threadId=id;
       
  1421 			}
       
  1422 		nextId=iWsSession->FindWindowGroupIdentifier(previousId, threadId);
       
  1423 		}
       
  1424 
       
  1425 	if ( nextId<0 )
       
  1426 		{
       
  1427 		ERR_PRINTF1(_L("failed to find Window group name function !"));
       
  1428 		SetError(nextId);
       
  1429 		}
       
  1430 	else
       
  1431 		{
       
  1432 		iWindowGroupIdentifier=nextId;
       
  1433 		}
       
  1434 	}
       
  1435 
       
  1436 void CT_DataWsSession::DoCmdFetchMessage(const TDesC& aSection)
       
  1437 	{
       
  1438 	TUid		uid;
       
  1439 	TPtr8		params(NULL,0);
       
  1440 	TWsEvent	event;
       
  1441 	TInt		err=iWsSession->FetchMessage(uid, params, event);
       
  1442     TInt expected;
       
  1443 	if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
       
  1444 		{
       
  1445 		if ( err!=expected )
       
  1446 			{
       
  1447 			ERR_PRINTF2(KLogError, err);
       
  1448 			SetBlockResult(EFail);
       
  1449 			}
       
  1450 		}
       
  1451 	}
       
  1452 
       
  1453 void CT_DataWsSession::DoCmdSetShadowVector(const TDesC& aSection)
       
  1454 	{
       
  1455 	// Get test data for command input parameter(s)
       
  1456 	TPoint	setPtShdwVet;
       
  1457 	if ( !GetPointFromConfig(aSection, KSetShadowVec(), setPtShdwVet) )
       
  1458 		{
       
  1459 		ERR_PRINTF2(KLogMissingParameter, &KSetShadowVec());
       
  1460 		SetBlockResult(EFail);
       
  1461 		}
       
  1462 	else
       
  1463 		{
       
  1464 		// Execute command and log parameters
       
  1465 		INFO_PRINTF1(_L("execute SetShadowVector(const TPoint &aVector)"));
       
  1466 		iWsSession->SetShadowVector(setPtShdwVet);
       
  1467 		}
       
  1468     }
       
  1469 
       
  1470 void CT_DataWsSession::DoCmdShadowVector(const TDesC& aSection)
       
  1471 	{
       
  1472 	// Get test data for command input parameter(s)
       
  1473 	TPoint	actual=iWsSession->ShadowVector();
       
  1474 	INFO_PRINTF3(_L("execute ShadowVector() x=%d y=%d"), actual.iX, actual.iY);
       
  1475 
       
  1476 	TPoint	expected;
       
  1477 	if ( !GetPointFromConfig(aSection, KExpectShadowVector(), expected) )
       
  1478 		{
       
  1479 		ERR_PRINTF2(KLogMissingParameter, &KExpectShadowVector());
       
  1480 		SetBlockResult(EFail);
       
  1481 		}
       
  1482 	else
       
  1483 		{
       
  1484 		if ( actual!=expected )
       
  1485 			{
       
  1486 			ERR_PRINTF1(_L("The current value of the shadow vector is not as expected!"));
       
  1487 			SetBlockResult(EFail);
       
  1488 			}
       
  1489 		}
       
  1490     }
       
  1491 
       
  1492 void CT_DataWsSession::DoCmdSetBackgroundColor(const TDesC& aSection)
       
  1493 	{
       
  1494 	TRgb	datColour;
       
  1495 	if ( !GetRgbFromConfig(aSection, KBGColour, datColour) )
       
  1496 		{
       
  1497 		ERR_PRINTF2(KLogMissingParameter, &KBGColour());
       
  1498 		SetBlockResult(EFail);
       
  1499 		}
       
  1500 	else
       
  1501 		{
       
  1502 		// Execute command and log parameters
       
  1503 		INFO_PRINTF1(_L("execute SetColor(TRgb)"));
       
  1504 		iWsSession->SetBackgroundColor(datColour);
       
  1505 		}
       
  1506 	}
       
  1507 
       
  1508 void CT_DataWsSession::DoCmdGetBackgroundColor(const TDesC& aSection)
       
  1509 	{
       
  1510 	// Get test data for command input parameter(s)
       
  1511 	TRgb	actualBgColour=iWsSession->GetBackgroundColor();
       
  1512 
       
  1513 	TRgb	expectBgColour;
       
  1514 	if ( !GetRgbFromConfig(aSection, KExpectBgColour(), expectBgColour) )
       
  1515 		{
       
  1516 		ERR_PRINTF2(KLogMissingParameter, &KExpectBgColour());
       
  1517 		SetBlockResult(EFail);
       
  1518 		}
       
  1519 	else
       
  1520 		{
       
  1521 		if ( actualBgColour!=expectBgColour )
       
  1522 			{
       
  1523 			ERR_PRINTF1(_L("The current value of the shadow vector is not as expected!"));
       
  1524 			SetBlockResult(EFail);
       
  1525 			}
       
  1526 		}
       
  1527 	}
       
  1528 
       
  1529 void CT_DataWsSession::DoCmdSetSystemPointerCursor(const TDesC& aSection)
       
  1530     {
       
  1531     RWsPointerCursor	sysPointerCursor=RWsPointerCursor(*iWsSession);
       
  1532 
       
  1533 	INFO_PRINTF1(_L("RWsSession::SetSystemPointerCursor() call"));
       
  1534 	TInt	inputCursorNumber=0;
       
  1535 	if ( !GetIntFromConfig(aSection, KInputCursorNumber(), inputCursorNumber) )
       
  1536 		{
       
  1537 		ERR_PRINTF2(KLogMissingParameter, &KExpectBgColour());
       
  1538 		SetBlockResult(EFail);
       
  1539 		}
       
  1540 	else
       
  1541 		{
       
  1542 		INFO_PRINTF2(_L("CursorNumber:%d"),inputCursorNumber);
       
  1543 		TInt	err=iWsSession->SetSystemPointerCursor(sysPointerCursor,inputCursorNumber);
       
  1544 		if ( err!=KErrNone )
       
  1545 			{
       
  1546 			ERR_PRINTF2(KLogError, err);
       
  1547 			SetError(err);
       
  1548 			}
       
  1549 		}
       
  1550 	}
       
  1551 
       
  1552 void CT_DataWsSession::DoCmdClearSystemPointerCursor(const TDesC& aSection)
       
  1553 	{
       
  1554 	TInt	inputCursorNumber=0;
       
  1555 
       
  1556 	if ( !GetIntFromConfig(aSection, KInputCursorNumber(), inputCursorNumber) )
       
  1557 		{
       
  1558 		ERR_PRINTF2(KLogMissingParameter, &KInputCursorNumber());
       
  1559 		SetBlockResult(EFail);
       
  1560 		}
       
  1561 	else
       
  1562 		{
       
  1563 		INFO_PRINTF2(_L("CursorNumber:%d"),inputCursorNumber);
       
  1564 		INFO_PRINTF1(_L("RWsSession::ClearSystemPointerCursor"));
       
  1565 		iWsSession->ClearSystemPointerCursor(inputCursorNumber);
       
  1566 		}
       
  1567 	}
       
  1568 
       
  1569 void CT_DataWsSession::DoCmdClaimSystemPointerCursorList()
       
  1570 	{
       
  1571 	INFO_PRINTF1(_L("RWsSession::ClaimSystemPointerCursorList() call"));
       
  1572 	TInt	err=iWsSession->ClaimSystemPointerCursorList();
       
  1573 
       
  1574 	if ( err!=KErrNone )
       
  1575 		{
       
  1576 		ERR_PRINTF2(KLogError, err);
       
  1577 		SetError(err);
       
  1578 		}
       
  1579 	}
       
  1580 
       
  1581 void CT_DataWsSession::DoCmdFreeSystemPointerCursorList()
       
  1582 	{
       
  1583 	INFO_PRINTF1(_L("RWsSession::FreeSystemPointerCursorList() call"));
       
  1584 	iWsSession->FreeSystemPointerCursorList();
       
  1585 	}
       
  1586 
       
  1587 void CT_DataWsSession::DoCmdSetCustomTextCursorL(const TDesC& aSection)
       
  1588 	{
       
  1589 	TBool	dataOk=ETrue;
       
  1590 
       
  1591 	TInt	identifier;
       
  1592 	if ( !GetIntFromConfig(aSection, KFldIdentifier(), identifier) )
       
  1593 		{
       
  1594 		dataOk=EFalse;
       
  1595 		ERR_PRINTF2(KLogMissingParameter, &KFldIdentifier);
       
  1596 		SetBlockResult(EFail);
       
  1597 		}
       
  1598 
       
  1599 	CArrayFixFlat<TSpriteMember>*	spriteMember = new (ELeave) CArrayFixFlat<TSpriteMember>(1);
       
  1600 	if ( !CT_GraphicsUtil::GetSpriteMemberListL(*this, aSection, KFldSpriteMember, *spriteMember) )
       
  1601 		{
       
  1602 		dataOk=EFalse;
       
  1603 		ERR_PRINTF2(KLogMissingParameter, &KFldSpriteMember);
       
  1604 		SetBlockResult(EFail);
       
  1605 		}
       
  1606 	TArray<TSpriteMember>	spriteArray = spriteMember->Array();
       
  1607 
       
  1608 	TSpriteFlags	spriteFlags;
       
  1609 	if ( !CT_GraphicsUtil::ReadSpriteFlags(*this, aSection, KFldSpriteFlags, spriteFlags) )
       
  1610 		{
       
  1611 		dataOk=EFalse;
       
  1612 		ERR_PRINTF2(KLogMissingParameter, &KFldSpriteFlags);
       
  1613 		SetBlockResult(EFail);
       
  1614 		}
       
  1615 
       
  1616 	RWsSession::TCustomTextCursorAlignment	alignment;
       
  1617 	if ( !CT_GraphicsUtil::ReadCustomTextCursorAlignment(*this, aSection, KFldAlignment, alignment) )
       
  1618 		{
       
  1619 		dataOk=EFalse;
       
  1620 		ERR_PRINTF2(KLogMissingParameter, &KFldAlignment);
       
  1621 		SetBlockResult(EFail);
       
  1622 		}
       
  1623 
       
  1624 	if ( dataOk )
       
  1625 		{
       
  1626 		INFO_PRINTF1(_L("SetCustomTextCursor(TInt, TArray< TSpriteMember >, TUint, TCustomTextCursorAlignment)"));
       
  1627 		TInt	err=iWsSession->SetCustomTextCursor(identifier, spriteArray, (TUint)spriteFlags, alignment);
       
  1628 
       
  1629 		if ( err!=KErrNone )
       
  1630 			{
       
  1631 			ERR_PRINTF2(KLogError, err);
       
  1632 			SetError(err);
       
  1633 			}
       
  1634 		}
       
  1635 	}
       
  1636 
       
  1637 void CT_DataWsSession::DoCmdResourceCount(const TDesC& aSection)
       
  1638 	{
       
  1639 	TInt	resourceCount=iWsSession->ResourceCount();
       
  1640 	INFO_PRINTF2(_L("RWsSession::ResourceCount() %d"), resourceCount);
       
  1641 
       
  1642 	// get expected difference from parameters
       
  1643 	TInt	expectedDifference;
       
  1644 	if ( GetIntFromConfig(aSection, KExpectedDiff(), expectedDifference) )
       
  1645 		{
       
  1646 		TInt	actualDifference=resourceCount-iResourceCount;
       
  1647 		if ( actualDifference != expectedDifference )
       
  1648 			{
       
  1649 			ERR_PRINTF3(_L("Resource count difference is not as expected! expected: %d, actual: %d"), expectedDifference, actualDifference);
       
  1650 			SetBlockResult(EFail);
       
  1651 			}
       
  1652 		}
       
  1653 	iResourceCount = resourceCount;
       
  1654 	}
       
  1655 
       
  1656 void CT_DataWsSession::DoCmdPasswordEntered()
       
  1657 	{
       
  1658 	INFO_PRINTF1(_L("RWsSession::PasswordEntered() call"));
       
  1659 	iWsSession->PasswordEntered();
       
  1660 	}
       
  1661 
       
  1662 void CT_DataWsSession::DoCmdComputeMode(const TDesC& aSection)
       
  1663 	{
       
  1664 	RWsSession::TComputeMode	mode;
       
  1665 
       
  1666 	INFO_PRINTF1(_L("RWsSession::ComputeMode() call"));
       
  1667 	if ( !CT_GraphicsUtil::ReadComputeMode(*this, aSection, KComputeMode(), mode) )
       
  1668 		{
       
  1669 		ERR_PRINTF2(KLogMissingParameter, &KComputeMode());
       
  1670 		SetBlockResult(EFail);
       
  1671 		}
       
  1672 	else
       
  1673 		{
       
  1674 		iWsSession->ComputeMode(mode);
       
  1675 		}
       
  1676 	}
       
  1677 
       
  1678 
       
  1679 void CT_DataWsSession::DoCmdHeapCount(const TDesC& aSection)
       
  1680 	{
       
  1681 	TInt	expectedCount;
       
  1682 	TInt	heapCount;
       
  1683 
       
  1684 	if ( !GetIntFromConfig(aSection, KExpectedHeapCount(), expectedCount) )
       
  1685 		{
       
  1686 		ERR_PRINTF2(KLogMissingParameter, &KExpectedHeapCount());
       
  1687 		SetBlockResult(EFail);
       
  1688 		}
       
  1689 	else
       
  1690 		{
       
  1691 		INFO_PRINTF2(_L("expected count: %d"), expectedCount);
       
  1692 		INFO_PRINTF1(_L("RWsSession::HeapCount() call"));
       
  1693 		heapCount=iWsSession->HeapCount();
       
  1694 		INFO_PRINTF2(_L("RWsSession::HeapCount(): %d"), heapCount);
       
  1695 		if ( expectedCount > heapCount )
       
  1696 			{
       
  1697 			ERR_PRINTF3(_L("Heap count is lower than expected! expected: %d, actual: %d"), expectedCount, heapCount);
       
  1698 			SetBlockResult(EFail);
       
  1699 			}
       
  1700 		}
       
  1701 	}
       
  1702 
       
  1703 void CT_DataWsSession::DoCmdSetModifierState(const TDesC& aSection)
       
  1704 	{
       
  1705 	TBool	dataOk=ETrue;
       
  1706 
       
  1707 	TEventModifier	eventModifier;
       
  1708 	if ( !CT_GraphicsUtil::ReadEventModifier(*this, aSection, KInputPermanentModifier(), eventModifier) )
       
  1709 		{
       
  1710 		dataOk=EFalse;
       
  1711 		ERR_PRINTF2(KLogMissingParameter, &KInputPermanentModifier());
       
  1712 		SetBlockResult(EFail);
       
  1713 		}
       
  1714 
       
  1715 	TModifierState	modifierState;
       
  1716 	if(	!CT_GraphicsUtil::ReadModifierState(*this, aSection, KInputPermanentModifierState(), modifierState) )
       
  1717 		{
       
  1718 		dataOk=EFalse;
       
  1719 		ERR_PRINTF2(KLogMissingParameter, &KInputPermanentModifierState());
       
  1720 		SetBlockResult(EFail);
       
  1721 		}
       
  1722 
       
  1723 	if ( dataOk )
       
  1724 		{
       
  1725 		INFO_PRINTF1(_L("RWsSession::SetModifierState"));
       
  1726 		TInt	err = iWsSession->SetModifierState(eventModifier, modifierState);
       
  1727 		if ( err!=KErrNone )
       
  1728 			{
       
  1729 			ERR_PRINTF2(KLogError, err);
       
  1730 			SetError(err);
       
  1731 			}
       
  1732 		}
       
  1733 	}
       
  1734 
       
  1735 void CT_DataWsSession::DoCmdGetModifierState(const TDesC& aSection)
       
  1736     {
       
  1737 	TInt	actual=iWsSession->GetModifierState();
       
  1738 	INFO_PRINTF2(_L("GetModifierState:%d"), actual);
       
  1739 
       
  1740 	TUint 	expected=0;
       
  1741 	if ( CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldExpected(), expected) )
       
  1742 		{
       
  1743 		if ( actual!=(TInt)expected )
       
  1744 			{
       
  1745 			ERR_PRINTF1(_L("ModifierState is not as expected!"));
       
  1746 			SetBlockResult(EFail);
       
  1747 			}
       
  1748 		}
       
  1749 	}
       
  1750 
       
  1751 void CT_DataWsSession::DoCmdRequestOffEventsL(const TDesC& aSection)
       
  1752 	{
       
  1753 	TBool 	eventOffOn;
       
  1754 	if ( !GetBoolFromConfig(aSection, KSetEventOffOn(), eventOffOn) )
       
  1755 		{
       
  1756 		ERR_PRINTF2(KLogMissingParameter, &KSetEventOffOn());
       
  1757 		SetBlockResult(EFail);
       
  1758 		}
       
  1759 	else
       
  1760 		{
       
  1761 		RWindowTreeNode*	treeNodeObj=NULL;
       
  1762 		TPtrC 	treeNodeObjectName;
       
  1763 		if ( GetStringFromConfig(aSection, KWTreeNodeObj(), treeNodeObjectName) )
       
  1764 			{
       
  1765 			treeNodeObj = static_cast<RWindowTreeNode*>(GetDataObjectL(treeNodeObjectName));
       
  1766 			}
       
  1767 
       
  1768 		INFO_PRINTF1(_L("RWsSession::RequestOffEvents(TBool, RWindowTreeNode*) call"));
       
  1769 		TInt	err=iWsSession->RequestOffEvents(eventOffOn, treeNodeObj);
       
  1770 		if ( err!=KErrNone )
       
  1771 			{
       
  1772 			ERR_PRINTF2(KLogError, err);
       
  1773 			SetError(err);
       
  1774 			}
       
  1775 		}
       
  1776 	}
       
  1777 
       
  1778 void CT_DataWsSession::DoCmdGetDefModeMaxNumColors(const TDesC& aSection)
       
  1779 	{
       
  1780 	TInt	colors;
       
  1781 	TInt	grays;
       
  1782 
       
  1783 	INFO_PRINTF1(_L("RWsSession::GetDefModeMaxNumColors(TInt &aColor, TInt &aGray) call"));
       
  1784 		
       
  1785 	TDisplayMode	displayMode;
       
  1786 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  1787 	TInt			theScrnNum=0;
       
  1788 	if ( GetIntFromConfig(aSection, KWGScreenNumber(), theScrnNum) )
       
  1789 		{
       
  1790 		displayMode=iWsSession->GetDefModeMaxNumColors(theScrnNum, colors, grays);
       
  1791 		}
       
  1792 	else
       
  1793 #endif
       
  1794 		{
       
  1795 		displayMode=iWsSession->GetDefModeMaxNumColors(colors, grays);
       
  1796 		}
       
  1797 	INFO_PRINTF4(_L("RWsSession::GetDefModeMaxNumColors() DisplayMode:%d Colors:%d Grays:%d"), displayMode, colors, grays);
       
  1798 
       
  1799 	TDisplayMode	expectedDisplayMode;
       
  1800 	if ( CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KDefDisplayMode(), expectedDisplayMode) )
       
  1801 		{
       
  1802 		if ( expectedDisplayMode!=displayMode )
       
  1803 			{
       
  1804 			ERR_PRINTF1(KLogNotExpectedValue);
       
  1805 			SetBlockResult(EFail);
       
  1806 			}
       
  1807 		}
       
  1808 	TInt	expected=0;
       
  1809 	if ( GetIntFromConfig(aSection, KDefModeMaxNumColor(), expected) )
       
  1810 		{
       
  1811 		if ( expected!=colors )
       
  1812 			{
       
  1813 			ERR_PRINTF1(KLogNotExpectedValue);
       
  1814 			SetBlockResult(EFail);
       
  1815 			}
       
  1816 		}
       
  1817 	if ( GetIntFromConfig(aSection, KDefModeMaxNumGray(), expected) )
       
  1818 		{
       
  1819 		if ( expected!=grays )
       
  1820 			{
       
  1821 			ERR_PRINTF1(KLogNotExpectedValue);
       
  1822 			SetBlockResult(EFail);
       
  1823 			}
       
  1824 		}
       
  1825 	}
       
  1826 
       
  1827 void CT_DataWsSession::DoCmdGetColorModeListL(const TDesC& aSection)
       
  1828 	{
       
  1829 	TBool	nullPointer=EFalse;
       
  1830 	GetBoolFromConfig(aSection, KFldNullPointer(), nullPointer);
       
  1831 
       
  1832 	CArrayFixFlat<TInt>*	modeList=NULL;
       
  1833 	if ( !nullPointer )
       
  1834 		{
       
  1835 		modeList=new (ELeave) CArrayFixFlat<TInt>(iColorModeCount);
       
  1836 		}
       
  1837 	CleanupStack::PushL(modeList);
       
  1838 
       
  1839 	TBool	dataOk=ETrue;
       
  1840 	TInt	err=KErrNone;
       
  1841 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  1842 	TInt	inputScreenNo=0;
       
  1843 	if ( GetIntFromConfig(aSection, KInputScrnNo(), inputScreenNo))
       
  1844 		{
       
  1845 		INFO_PRINTF1(_L("RWsSession::GetColorModeList(TInt aScreenNumber, CArrayFixFlat< TInt > *aModeList) call"));
       
  1846 		err=iWsSession->GetColorModeList(inputScreenNo, modeList);
       
  1847 		}
       
  1848 	else
       
  1849 #endif
       
  1850 		{
       
  1851 		INFO_PRINTF1(_L("RWsSession::GetColorModeList(CArrayFixFlat< TInt > *aModeList) call"));
       
  1852 		err=iWsSession->GetColorModeList(modeList);
       
  1853 		}
       
  1854 
       
  1855 	if ( err<KErrNone )
       
  1856 		{
       
  1857 		ERR_PRINTF2(KLogError, err);
       
  1858 		SetError(err);
       
  1859 		}
       
  1860 	else
       
  1861 		{
       
  1862 		if ( dataOk )
       
  1863 			{
       
  1864 			if ( nullPointer )
       
  1865 				{
       
  1866 				iColorModeCount=err;
       
  1867 				}
       
  1868 			else
       
  1869 				{
       
  1870 				INFO_PRINTF2(_L("Color Mode List array count:%d"), modeList->Count());
       
  1871 				for ( TInt index=0; index<modeList->Count(); ++index )
       
  1872 					{
       
  1873 					INFO_PRINTF2(_L("Content of Color Mode List:%d"), (*modeList)[index]);
       
  1874 					}
       
  1875 				}
       
  1876 			}
       
  1877 		}
       
  1878 
       
  1879 	CleanupStack::PopAndDestroy(modeList);
       
  1880 	}
       
  1881 
       
  1882 void CT_DataWsSession::DoCmdSetPointerCursorArea(const TDesC& aSection)
       
  1883 	{
       
  1884 	// Get test data for command input parameter(s)
       
  1885 	TRect	setRectArea;
       
  1886 	if ( !GetRectFromConfig(aSection, KPtrCurPosArea, setRectArea) )
       
  1887 		{
       
  1888 		ERR_PRINTF2(KLogMissingParameter, &KPtrCurPosArea());
       
  1889 		SetBlockResult(EFail);
       
  1890 		}
       
  1891 	else
       
  1892 		{
       
  1893 		// Execute command and log parameters
       
  1894 		INFO_PRINTF1(_L("execute SetPointerCursorPosition(TPoint)"));
       
  1895 		
       
  1896 		TInt	setScrnSizeMode;
       
  1897 		if ( !GetIntFromConfig(aSection, KSetScrnSizeMode, setScrnSizeMode) )
       
  1898 			{
       
  1899 			iWsSession->SetPointerCursorArea(setRectArea);
       
  1900 			}
       
  1901 		else
       
  1902 			{
       
  1903 			iWsSession->SetPointerCursorArea(setScrnSizeMode,setRectArea);
       
  1904 			}
       
  1905 		}
       
  1906 	}
       
  1907 
       
  1908 void CT_DataWsSession::DoCmdPointerCursorArea(const TDesC& aSection)
       
  1909 	{
       
  1910 	// Get test data for command input parameter(s)
       
  1911 	TRect	actual;
       
  1912 	TInt	theScreenSizeMode=0;
       
  1913 	if ( !GetIntFromConfig(aSection, KSetScrnSizeMode, theScreenSizeMode) )
       
  1914 		{
       
  1915 		actual=iWsSession->PointerCursorArea();
       
  1916 		LogRect(_L("PointerCursorArea()"), actual);
       
  1917 		}
       
  1918 	else
       
  1919 		{
       
  1920 		actual=iWsSession->PointerCursorArea(theScreenSizeMode);
       
  1921 		LogRect(_L("PointerCursorArea(TInt)"), actual);
       
  1922 		}
       
  1923 
       
  1924 	TRect	expected;
       
  1925 	if ( !GetRectFromConfig(aSection, KPtrCurPosArea, expected) )
       
  1926 		{
       
  1927 		ERR_PRINTF2(KLogMissingParameter, &KPtrCurPosArea);
       
  1928 		SetBlockResult(EFail);
       
  1929 		}
       
  1930 	else
       
  1931 		{
       
  1932 		if ( actual!=expected )
       
  1933 			{
       
  1934 			ERR_PRINTF1(KLogNotExpectedValue);
       
  1935 			SetBlockResult(EFail);
       
  1936 			}
       
  1937 		}
       
  1938 	}
       
  1939 
       
  1940 
       
  1941 void CT_DataWsSession::DoCmdSetPointerCursorMode(const TDesC& aSection)
       
  1942 	{
       
  1943 	TPointerCursorMode  mode;
       
  1944 	if ( !CT_GraphicsUtil::ReadPointerCursorMode(*this, aSection, KSetPtrCurMode(), mode) )
       
  1945 		{
       
  1946 		ERR_PRINTF2(KLogMissingParameter, &KSetPtrCurMode());
       
  1947 		SetBlockResult(EFail);
       
  1948 		}
       
  1949 	else
       
  1950 		{
       
  1951 		iWsSession->SetPointerCursorMode(mode);
       
  1952 		}
       
  1953 	}
       
  1954 
       
  1955 void CT_DataWsSession::DoCmdSetClientCursorMode(const TDesC& aSection)
       
  1956 	{
       
  1957 	TPointerCursorMode  mode;
       
  1958 	if ( !CT_GraphicsUtil::ReadPointerCursorMode(*this, aSection, KSetCltCurMode(), mode) )
       
  1959 		{
       
  1960 		ERR_PRINTF2(KLogMissingParameter, &KSetCltCurMode());
       
  1961 		SetBlockResult(EFail);
       
  1962 		}
       
  1963 	else
       
  1964 		{
       
  1965 		iWsSession->SetClientCursorMode(mode);
       
  1966 		}
       
  1967 	}
       
  1968 
       
  1969 void CT_DataWsSession::DoCmdPointerCursorMode(const TDesC& aSection)
       
  1970     {
       
  1971 	INFO_PRINTF1(_L("RWsSession::PointerCursorMode() call"));
       
  1972 	TPointerCursorMode	actual=iWsSession->PointerCursorMode();
       
  1973 	INFO_PRINTF2(_L("actual Pointer Cursor Mode:%d"), actual);
       
  1974 
       
  1975 	TPointerCursorMode  expected;
       
  1976 	if ( !CT_GraphicsUtil::ReadPointerCursorMode(*this, aSection, KFldExpected(), expected) )
       
  1977 		{
       
  1978 		ERR_PRINTF2(KLogMissingParameter, &KExpectPtrCursorMode());
       
  1979 		SetBlockResult(EFail);
       
  1980 		}
       
  1981 	else
       
  1982 		{
       
  1983 		if ( actual!=expected )
       
  1984 			{
       
  1985 			ERR_PRINTF1(_L("Pointer cursor mode is not as expected!"));
       
  1986 			SetBlockResult(EFail);
       
  1987 			}
       
  1988 		}
       
  1989 	}
       
  1990 
       
  1991 void CT_DataWsSession::DoCmdSetDefaultSystemPointerCursor(const TDesC& aSection)
       
  1992 	{
       
  1993 	TInt	inputDefCursorNumber=0;
       
  1994 	INFO_PRINTF1(_L("RWsSession::SetDefaultSystemPointerCursor() call"));
       
  1995 
       
  1996 	if ( !GetIntFromConfig(aSection, KInputDefaultCursorNumber(), inputDefCursorNumber))
       
  1997 		{
       
  1998 		ERR_PRINTF2(KLogMissingParameter, &KInputDefaultCursorNumber());
       
  1999 		SetBlockResult(EFail);
       
  2000 		}
       
  2001 	else
       
  2002 		{
       
  2003 		iWsSession->SetDefaultSystemPointerCursor(inputDefCursorNumber);
       
  2004 		}
       
  2005 	}
       
  2006 
       
  2007 void CT_DataWsSession::DoCmdClearDefaultSystemPointerCursor()
       
  2008 	{
       
  2009 	INFO_PRINTF1(_L("RWsSession::ClearDefaultSystemPointerCursor() call"));
       
  2010 	iWsSession->ClearDefaultSystemPointerCursor();
       
  2011 	}
       
  2012 
       
  2013 void CT_DataWsSession::DoCmdSetPointerCursorPosition(const TDesC& aSection)
       
  2014 	{
       
  2015 	// Get test data for command input parameter(s)
       
  2016 	TPoint	ptrCurPost;
       
  2017 	if ( !GetPointFromConfig(aSection, KSetPtrCurPosValue, ptrCurPost) )
       
  2018 		{
       
  2019 		ERR_PRINTF2(KLogMissingParameter, &KSetPtrCurPosValue);
       
  2020 		SetBlockResult(EFail);
       
  2021 		}
       
  2022 	else
       
  2023 		{
       
  2024 		// Execute command and log parameters
       
  2025 		INFO_PRINTF1(_L("execute SetPointerCursorPosition(TPoint)"));
       
  2026 		iWsSession->SetPointerCursorPosition(ptrCurPost);
       
  2027 		}
       
  2028 	}
       
  2029 
       
  2030 void CT_DataWsSession::DoCmdPointerCursorPosition(const TDesC& aSection)
       
  2031 	{
       
  2032 	// Get test data for command input parameter(s)
       
  2033 	TPoint	actualPtrCurPost=iWsSession->PointerCursorPosition();
       
  2034 
       
  2035 	TPoint	expectPtrCurPost;
       
  2036 	if ( !GetPointFromConfig(aSection, KTPoint, expectPtrCurPost) )
       
  2037 		{
       
  2038 		ERR_PRINTF2(KLogMissingParameter, &KTPoint);
       
  2039 		SetBlockResult(EFail);
       
  2040 		}
       
  2041 	else
       
  2042 		{
       
  2043 		// Execute command and log parameters
       
  2044 		INFO_PRINTF1(_L("execute SetPointerCursorPosition(TPoint)"));
       
  2045 		if ((expectPtrCurPost.iX!=expectPtrCurPost.iX)||(expectPtrCurPost.iY!=expectPtrCurPost.iY))
       
  2046 				{
       
  2047 				ERR_PRINTF1(_L("The cursor position is not as expected!"));
       
  2048 				SetBlockResult(EFail);
       
  2049 				}
       
  2050 		}
       
  2051 	}
       
  2052 
       
  2053 void CT_DataWsSession::DoCmdSetDefaultFadingParameters(const TDesC& aSection)
       
  2054 	{
       
  2055 	TBool dataOk=ETrue;
       
  2056 	TInt	setBlackMap;
       
  2057 	TInt	setWhiteMap;
       
  2058 	
       
  2059 	if ( !GetIntFromConfig(aSection, KSetDefblackMapFading(), setBlackMap) )
       
  2060 		{
       
  2061 		dataOk=EFalse;
       
  2062 		ERR_PRINTF2(KLogMissingParameter, &KSetDefblackMapFading);
       
  2063 		SetBlockResult(EFail);
       
  2064 		}
       
  2065 
       
  2066 	if ( !GetIntFromConfig(aSection, KSetDefwhiteMapFading(), setWhiteMap) )
       
  2067 		{
       
  2068 		dataOk=EFalse;
       
  2069 		ERR_PRINTF2(KLogMissingParameter, &KSetDefwhiteMapFading);
       
  2070 		SetBlockResult(EFail);
       
  2071 		}
       
  2072 
       
  2073 	if ( dataOk )
       
  2074 		{
       
  2075 		iWsSession->SetDefaultFadingParameters(setBlackMap, setWhiteMap);
       
  2076 		}
       
  2077 	}
       
  2078 
       
  2079 void CT_DataWsSession::DoCmdPrepareForSwitchOff()
       
  2080 	{
       
  2081 	INFO_PRINTF1(_L("RWsSession::PrepareForSwitchOff() call"));
       
  2082 	iWsSession->PrepareForSwitchOff();
       
  2083 	}
       
  2084 
       
  2085 
       
  2086 void CT_DataWsSession::DoCmdSetBufferSizeL(const TDesC& aSection)
       
  2087 	{
       
  2088 	TInt	theBuffersize;
       
  2089 
       
  2090 	if ( !GetIntFromConfig(aSection, KSetBuffer(), theBuffersize) )
       
  2091 		{
       
  2092 		ERR_PRINTF2(KLogMissingParameter, &KSetBuffer);
       
  2093 		SetBlockResult(EFail);
       
  2094 		}
       
  2095 	else
       
  2096 		{
       
  2097 		iWsSession->SetBufferSizeL(theBuffersize);
       
  2098 		INFO_PRINTF1(_L("RWsSession::SetBufferSizeL"));
       
  2099 		}
       
  2100 	}
       
  2101 
       
  2102 void CT_DataWsSession::DoCmdSetMaxBufferSizeL(const TDesC& aSection)
       
  2103 	{
       
  2104 	TInt	theMaxBuffersize;
       
  2105 
       
  2106 	if ( !GetIntFromConfig(aSection, KSetMaxBuffer(), theMaxBuffersize) )
       
  2107 		{
       
  2108 		ERR_PRINTF2(KLogMissingParameter, &KSetBuffer);
       
  2109 		SetBlockResult(EFail);
       
  2110 		}
       
  2111 	else
       
  2112 		{
       
  2113 		iWsSession->SetMaxBufferSizeL(theMaxBuffersize);
       
  2114 		INFO_PRINTF1(_L("RWsSession::SetMaxBufferSizeL"));
       
  2115 		}
       
  2116 	}
       
  2117 
       
  2118 void CT_DataWsSession::DoCmdSetSystemFaded(const TDesC& aSection)
       
  2119 	{
       
  2120 	TBool 	systemFadOffOn;
       
  2121 	TInt	blackMap;
       
  2122 	TInt	whiteMap;
       
  2123 
       
  2124 	if ( !GetBoolFromConfig(aSection, KSetSysFading(), systemFadOffOn) )
       
  2125 		{
       
  2126 		ERR_PRINTF2(KLogMissingParameter, &KSetSysFading());
       
  2127 		SetBlockResult(EFail);
       
  2128 		}
       
  2129 	else
       
  2130 		{
       
  2131 		INFO_PRINTF2(_L("the status of fad window :%d"),systemFadOffOn);
       
  2132 		if(	GetIntFromConfig(aSection, KSetblackMapFading(), blackMap))
       
  2133 			{
       
  2134 			if ( !GetIntFromConfig(aSection, KSetwhiteMapFading(), whiteMap) )
       
  2135 				{
       
  2136 				ERR_PRINTF2(KLogMissingParameter, &KSetwhiteMapFading);
       
  2137 				SetBlockResult(EFail);
       
  2138 				}
       
  2139 			else
       
  2140 				{
       
  2141 				iWsSession->SetSystemFaded(systemFadOffOn,blackMap,whiteMap);
       
  2142 				INFO_PRINTF1(_L("RWsSession::SetSystemFaded"));
       
  2143 				}
       
  2144 			}
       
  2145 		else
       
  2146 			{
       
  2147 			iWsSession->SetSystemFaded(systemFadOffOn);
       
  2148 			INFO_PRINTF1(_L("RWsSession::SetSystemFaded"));
       
  2149 			}
       
  2150 		}
       
  2151 	}
       
  2152 
       
  2153 void CT_DataWsSession::DoCmdSetFocusScreen(const TDesC& aSection)
       
  2154     {
       
  2155 	TInt	theScreenNo;
       
  2156 	if ( !GetIntFromConfig(aSection, KSetFocusScreen(), theScreenNo) )
       
  2157 		{
       
  2158 		ERR_PRINTF2(KLogMissingParameter, &KSetFocusScreen());
       
  2159 		SetBlockResult(EFail);
       
  2160 		}
       
  2161 	else
       
  2162 		{
       
  2163 		iWsSession->SetFocusScreen(theScreenNo);
       
  2164 		INFO_PRINTF1(_L("RWsSession::SetFocusScreen"));
       
  2165 		}
       
  2166 	}
       
  2167 
       
  2168 void CT_DataWsSession::DoCmdGetFocusScreen(const TDesC& aSection)
       
  2169 	{
       
  2170 	TInt 	actual=iWsSession->GetFocusScreen();
       
  2171 	INFO_PRINTF2(_L("RWsSession::GetFocusScreen()=%d"), actual);
       
  2172 
       
  2173 	TInt	expected;
       
  2174 	if ( !GetIntFromConfig(aSection, KFldExpected(), expected) )
       
  2175 		{
       
  2176 		ERR_PRINTF2(KLogMissingParameter, &KFldExpected());
       
  2177 		SetBlockResult(EFail);
       
  2178 		}
       
  2179 	else
       
  2180 		{
       
  2181 		if ( actual!=expected )
       
  2182 			{
       
  2183 			ERR_PRINTF1(_L("GetFocusScreen is not as expected!"));
       
  2184 			SetBlockResult(EFail);
       
  2185 			}
       
  2186 		}
       
  2187 	}
       
  2188 
       
  2189 void CT_DataWsSession::DoCmdClearAllRedrawStores()
       
  2190 	{
       
  2191 	INFO_PRINTF1(_L("RWsSession::ClearAllRedrawStores() call"));
       
  2192 	iWsSession->ClearAllRedrawStores();
       
  2193 	}
       
  2194 
       
  2195 
       
  2196 void CT_DataWsSession::DoCmdLogCommand(const TDesC& aSection)
       
  2197 	{
       
  2198 	RWsSession::TLoggingCommand	inputCommand;
       
  2199 	if ( !CT_GraphicsUtil::ReadLoggingCommand(*this, aSection, KLogCommand(), inputCommand) )
       
  2200 		{
       
  2201 		ERR_PRINTF2(KLogMissingParameter, &KLogCommand());
       
  2202 		SetBlockResult(EFail);
       
  2203 		}
       
  2204 	else
       
  2205 		{
       
  2206 		INFO_PRINTF1(_L("RWsSession::LogCommand() call"));
       
  2207 		iWsSession->LogCommand(inputCommand);
       
  2208 		}
       
  2209 	}
       
  2210 
       
  2211 
       
  2212 void CT_DataWsSession::DoCmdLogMessage(const TDesC& aSection)
       
  2213     {
       
  2214 	TPtrC	theMessage;
       
  2215 
       
  2216 	if ( !GetStringFromConfig(aSection, KLogMessage(), theMessage) )
       
  2217 		{
       
  2218 		ERR_PRINTF2(KLogMissingParameter, &KLogMessage());
       
  2219 		SetBlockResult(EFail);
       
  2220 		}
       
  2221 	else
       
  2222 		{
       
  2223 		INFO_PRINTF1(_L("RWsSession::LogMessage() call"));
       
  2224 		iWsSession->LogMessage(theMessage);
       
  2225 		}
       
  2226 	}
       
  2227 
       
  2228 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  2229 void CT_DataWsSession::DoCmdNumberOfScreens(const TDesC& aSection)
       
  2230 	{
       
  2231 	TInt    actual=iWsSession->NumberOfScreens();
       
  2232 	INFO_PRINTF2(_L("NumberOfScreens:%d"), actual);
       
  2233 
       
  2234 	TInt	expected=0;
       
  2235 	if ( !GetIntFromConfig(aSection, KFldExpected(), expected) )
       
  2236 		{
       
  2237 		ERR_PRINTF2(KLogMissingParameter, &KFldExpected());
       
  2238 		SetBlockResult(EFail);
       
  2239 		}
       
  2240 	else
       
  2241 		{
       
  2242 		if ( actual!=expected )
       
  2243 			{
       
  2244 			ERR_PRINTF1(_L("NumberOfScreens is not as expected!"));
       
  2245 			SetBlockResult(EFail);
       
  2246 			}
       
  2247 		}
       
  2248 	}
       
  2249 #else
       
  2250 void CT_DataWsSession::DoCmdNumberOfScreens(const TDesC& /*aSection*/)
       
  2251 	{
       
  2252 	ERR_PRINTF1(_L("SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS Not Supported"));
       
  2253 	SetBlockResult(EFail);
       
  2254 	}
       
  2255 #endif
       
  2256 
       
  2257 void CT_DataWsSession::DoCmdSimulateRawEvent(const TDesC& aSection)
       
  2258 	{
       
  2259 	TBool		dataOk=ETrue;
       
  2260 	TRawEvent	event;
       
  2261 
       
  2262 	TRawEvent::TType	type=TRawEvent::ENone;
       
  2263 	if ( !CT_GraphicsUtil::ReadType(*this, aSection, KFldType(), type) )
       
  2264 		{
       
  2265 		dataOk=EFalse;
       
  2266 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldType());
       
  2267 		SetBlockResult(EFail);
       
  2268 		}
       
  2269 	else
       
  2270 		{
       
  2271 		event.Set(type);
       
  2272 		}
       
  2273 
       
  2274 	TStdScanCode	stdScanCode;
       
  2275 	if ( CT_GraphicsUtil::ReadStdScanCode(*this, aSection, KFldStdScanCode(), stdScanCode) )
       
  2276 		{
       
  2277 		event.Set(type, stdScanCode);
       
  2278 		}
       
  2279 
       
  2280 	TInt	deviceNumber;
       
  2281 	if ( GetIntFromConfig(aSection, KFldDeviceNumber, deviceNumber) )
       
  2282 		{
       
  2283 		event.SetDeviceNumber(deviceNumber);
       
  2284 		}
       
  2285 
       
  2286 	TPoint	pointerPos(0,0);
       
  2287 	if ( GetPointFromConfig(aSection, KFldPos, pointerPos) )
       
  2288 		{
       
  2289 		event.Set(type, pointerPos.iX, pointerPos.iY);
       
  2290 		}
       
  2291 
       
  2292 	TBool	tip;
       
  2293 	if ( GetBoolFromConfig(aSection, KFldTip, tip) )
       
  2294 		{
       
  2295 		event.SetTip(tip);
       
  2296 		}
       
  2297 
       
  2298 	if ( dataOk )
       
  2299 		{
       
  2300 		INFO_PRINTF1(_L("RWsSession::SimulateRawEvent(TRawEvent) call"));
       
  2301 		iWsSession->SimulateRawEvent(event);
       
  2302 		}
       
  2303 	}
       
  2304 
       
  2305 void CT_DataWsSession::DoCmdSimulateKeyEvent(const TDesC& aSection)
       
  2306 	{
       
  2307 	TBool	dataOk=ETrue;
       
  2308 
       
  2309 	TKeyCode	keyCode;
       
  2310 	if ( !CT_GraphicsUtil::ReadKeyCode(*this, aSection, KFldKeyCode(), keyCode) )
       
  2311 		{
       
  2312 		dataOk=EFalse;
       
  2313 		ERR_PRINTF2(KLogMissingParameter, &KFldKeyCode());
       
  2314 		SetBlockResult(EFail);
       
  2315 		}
       
  2316 
       
  2317 	TUint	modifiers=0;
       
  2318 	CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifiers(), modifiers);
       
  2319 
       
  2320 	TInt	repeats=0;
       
  2321 	GetIntFromConfig(aSection, KFldRepeats(), repeats);
       
  2322 
       
  2323 	if ( dataOk )
       
  2324 		{
       
  2325 		TKeyEvent	event;
       
  2326 
       
  2327 		event.iCode=keyCode;
       
  2328 		event.iScanCode=keyCode;
       
  2329 		event.iModifiers=modifiers;
       
  2330 		event.iRepeats=repeats;
       
  2331 		INFO_PRINTF1(_L("RWsSession::SimulateKeyEvent(TKeyEvent) call"));
       
  2332 		iWsSession->SimulateKeyEvent(event);
       
  2333 		}
       
  2334 	}
       
  2335 
       
  2336 /**
       
  2337  Virtual RunL - Called on completion of an asynchronous command
       
  2338  @see MTPActiveCallback
       
  2339  @param aActive Active Object that RunL has been called on
       
  2340  @pre N/A
       
  2341  @post N/A
       
  2342  @leave system wide error code
       
  2343 */
       
  2344 void CT_DataWsSession::RunL(CActive* aActive, const TInt aIndex)
       
  2345 	{
       
  2346 	if ( aActive==iActiveEventReady )
       
  2347 		{
       
  2348 		RunEventReady(aIndex);
       
  2349 		}
       
  2350 	else if ( aActive==iActivePriorityKeyReady )
       
  2351 		{
       
  2352 		RunPriorityKeyReady(aIndex);
       
  2353 		}
       
  2354 	else if ( aActive==iActiveRedrawReady )
       
  2355 		{
       
  2356 		RunRedrawReady(aIndex);
       
  2357 		}
       
  2358 	else
       
  2359 		{
       
  2360 		ERR_PRINTF1(_L("Stray signal"));
       
  2361 		SetBlockResult(EFail);
       
  2362 		}
       
  2363 	DecOutstanding();
       
  2364 	}
       
  2365 
       
  2366 /**
       
  2367  Virtual DoCancel - Request to cancel the asynchronous command
       
  2368  @see - MTPActiveCallback
       
  2369  @param aActive Active Object that DoCancel has been called on
       
  2370  @pre - N/A
       
  2371  @post - N/A
       
  2372  @leave system wide error code
       
  2373 */
       
  2374 void CT_DataWsSession::DoCancel(CActive* aActive, const TInt aIndex)
       
  2375 	{
       
  2376 	if ( aActive==iActiveEventReady )
       
  2377 		{
       
  2378 		DoCancelEventReady(aIndex);
       
  2379 		}
       
  2380 	else if ( aActive==iActivePriorityKeyReady )
       
  2381 		{
       
  2382 		DoCancelPriorityKeyReady(aIndex);
       
  2383 		}
       
  2384 	else if ( aActive==iActiveRedrawReady )
       
  2385 		{
       
  2386 		DoCancelRedrawReady(aIndex);
       
  2387 		}
       
  2388 	else
       
  2389 		{
       
  2390 		ERR_PRINTF1(_L("Stray signal"));
       
  2391 		SetBlockResult(EFail);
       
  2392 		}
       
  2393 	DecOutstanding();
       
  2394 	}
       
  2395 
       
  2396 void CT_DataWsSession::RunEventReady(const TInt aIndex)
       
  2397 	{
       
  2398 	TInt	err=iActiveEventReady->iStatus.Int();
       
  2399 	INFO_PRINTF2(_L("RunEventReady %d"), err);
       
  2400 	if ( err!=KErrNone )
       
  2401 		{
       
  2402 		ERR_PRINTF2(_L("RunL Error %d"), err);
       
  2403 		SetAsyncError(aIndex, err);
       
  2404 		}
       
  2405 	}
       
  2406 
       
  2407 void CT_DataWsSession::DoCancelEventReady(const TInt /*aIndex*/)
       
  2408 	{
       
  2409 	}
       
  2410 
       
  2411 void CT_DataWsSession::RunPriorityKeyReady(const TInt aIndex)
       
  2412 	{
       
  2413 	TInt	err=iActivePriorityKeyReady->iStatus.Int();
       
  2414 	INFO_PRINTF2(_L("RunPriorityKeyReady %d"), err);
       
  2415 	if ( err!=KErrNone )
       
  2416 		{
       
  2417 		ERR_PRINTF2(_L("RunL Error %d"), err);
       
  2418 		SetAsyncError(aIndex, err);
       
  2419 		}
       
  2420 	}
       
  2421 
       
  2422 void CT_DataWsSession::DoCancelPriorityKeyReady(const TInt /*aIndex*/)
       
  2423 	{
       
  2424 	}
       
  2425 
       
  2426 void CT_DataWsSession::RunRedrawReady(const TInt aIndex)
       
  2427 	{
       
  2428 	TInt	err=iActiveRedrawReady->iStatus.Int();
       
  2429 	INFO_PRINTF2(_L("RunRedrawReady %d"), err);
       
  2430 	if ( err!=KErrNone )
       
  2431 		{
       
  2432 		ERR_PRINTF2(_L("RunL Error %d"), err);
       
  2433 		SetAsyncError(aIndex, err);
       
  2434 		}
       
  2435 	}
       
  2436 
       
  2437 void CT_DataWsSession::DoCancelRedrawReady(const TInt /*aIndex*/)
       
  2438 	{
       
  2439 	}