graphics/wserv/src/T_DataWsSession.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     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 the License "Symbian Foundation License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-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 	
       
   685 	TInt	err=KErrNone;
       
   686 	
       
   687 	if ( !CT_GraphicsUtil::ReadHotKey(*this, aSection, KSetHotKey(), hotKey) )
       
   688 		{
       
   689 		dataOk=EFalse;
       
   690 		ERR_PRINTF2(KLogMissingParameter, &KSetHotKey());
       
   691 		SetBlockResult(EFail);
       
   692 		}
       
   693 
       
   694 	TKeyCode	keyCode;
       
   695 	if ( !CT_GraphicsUtil::ReadKeyCode(*this, aSection, KSetKeyCode(), keyCode) )
       
   696 		{
       
   697 		dataOk=EFalse;
       
   698 		ERR_PRINTF2(KLogMissingParameter, &KSetKeyCode());
       
   699 		SetBlockResult(EFail);
       
   700 		}
       
   701 
       
   702 	TUint	modifierMask=EModifierAlt | EModifierCtrl | EModifierShift | EModifierFunc | EModifierCapsLock;
       
   703 	CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifierMask, modifierMask);
       
   704 	TUint	modifier=EModifierAlt | EModifierCtrl | EModifierShift | EModifierFunc | EModifierCapsLock;
       
   705 	CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifier, modifier);
       
   706 	if ( dataOk )
       
   707 		{
       
   708 		err = iWsSession->SetHotKey(hotKey, keyCode, modifierMask, modifier);
       
   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 	
       
   723 	if ( !CT_GraphicsUtil::ReadHotKey(*this, aSection, KClsHotKey(), hotKey) )
       
   724 		{
       
   725 		ERR_PRINTF2(KLogMissingParameter, &KClsHotKey());
       
   726 		SetBlockResult(EFail);
       
   727 		}
       
   728 	else
       
   729 		{
       
   730 		err = iWsSession->ClearHotKeys(hotKey);
       
   731 		}
       
   732 	
       
   733 	if ( err!=KErrNone )
       
   734 		{
       
   735 		ERR_PRINTF2(KLogError, err);
       
   736 		SetError(err);
       
   737 		}
       
   738 	}
       
   739 
       
   740 void CT_DataWsSession::DoCmdRestoreDefaultHotKey(const TDesC& aSection)
       
   741 	{
       
   742 	THotKey	hotKey;
       
   743 	
       
   744 	TInt	err=KErrNone;
       
   745 	
       
   746 	if ( !CT_GraphicsUtil::ReadHotKey(*this, aSection, KRestoreDefHotKey(), hotKey) )
       
   747 		{
       
   748 		ERR_PRINTF2(KLogMissingParameter, &KRestoreDefHotKey());
       
   749 		SetBlockResult(EFail);
       
   750 		}
       
   751 	else
       
   752 		{
       
   753 		err = iWsSession->RestoreDefaultHotKey(hotKey);
       
   754 		}
       
   755 	
       
   756 	if ( err!=KErrNone )
       
   757 		{
       
   758 		ERR_PRINTF2(KLogError, err);
       
   759 		SetError(err);
       
   760 		}
       
   761 	}
       
   762 
       
   763 void CT_DataWsSession::DoCmdEventReady(const TDesC& aSection, TInt aAsyncErrorIndex)
       
   764 	{
       
   765 	CActive::TPriority	priority=CActive::EPriorityHigh;
       
   766 	CT_GraphicsUtil::ReadPriority(*this, aSection, KRequestEvent(), priority);
       
   767 
       
   768 	iActiveEventReady->SetPriority(priority);
       
   769 	INFO_PRINTF1(_L("RWsSession::EventReady() call"));
       
   770 	iWsSession->EventReady(&iActiveEventReady->iStatus);
       
   771 	iActiveEventReady->Activate(aAsyncErrorIndex);
       
   772 	IncOutstanding();
       
   773 	}
       
   774 
       
   775 void CT_DataWsSession::DoCmdEventReadyCancel()
       
   776 	{
       
   777 	iWsSession->EventReadyCancel();
       
   778 	}
       
   779 
       
   780 void CT_DataWsSession::DoCmdGetEventL(const TDesC& aSection)
       
   781 	{
       
   782 	TWsEvent	event;
       
   783 
       
   784 	iWsSession->GetEvent(event);
       
   785 	INFO_PRINTF1(_L("RWsSession::GetEvent() call"));
       
   786 
       
   787 	TWsEvent*	store=NULL;
       
   788 	if ( CT_GraphicsUtil::GetWsEventL(*this, aSection, KFldStore(), store) )
       
   789 		{
       
   790 		*store=event;
       
   791 		}
       
   792 	}
       
   793 
       
   794 void CT_DataWsSession::DoCmdPurgePointerEvents()
       
   795 	{
       
   796 	// Execute command and log parameters
       
   797 	INFO_PRINTF3(_L("execute %S::%S()"), &KDataClassname, &KCmdPurgePointerEvents);
       
   798 	iWsSession->PurgePointerEvents();
       
   799 	}
       
   800 
       
   801 void CT_DataWsSession::DoCmdRedrawReady(const TDesC& aSection, TInt aAsyncErrorIndex)
       
   802 	{
       
   803 	CActive::TPriority	priority=CActive::EPriorityHigh;
       
   804 	CT_GraphicsUtil::ReadPriority(*this, aSection, KRequestRedraw(), priority);
       
   805 
       
   806 	iActiveRedrawReady->SetPriority(priority);
       
   807 	INFO_PRINTF1(_L("RWsSession::RedrawReady() call"));
       
   808 	iWsSession->RedrawReady(&iActiveRedrawReady->iStatus);
       
   809 	iActiveRedrawReady->Activate(aAsyncErrorIndex);
       
   810 	IncOutstanding();
       
   811 	}
       
   812 
       
   813 void CT_DataWsSession::DoCmdRedrawReadyCancel()
       
   814 	{
       
   815 	INFO_PRINTF1(_L("RWsSession::RedrawReadyCancel() call"));
       
   816 	iWsSession->RedrawReadyCancel();
       
   817 	}
       
   818 
       
   819 void CT_DataWsSession::DoCmdGetRedrawL(const TDesC& aSection)
       
   820 	{
       
   821 	TWsRedrawEvent 	redrawEvent;
       
   822 
       
   823 	iWsSession->GetRedraw(redrawEvent);
       
   824 	INFO_PRINTF1(_L("RWsSession::GetRedraw() call"));
       
   825 
       
   826 	TWsRedrawEvent*	store=NULL;
       
   827 	if ( CT_GraphicsUtil::GetWsRedrawEventL(*this, aSection, KFldStore(), store) )
       
   828 		{
       
   829 		*store=redrawEvent;
       
   830 		}
       
   831 	}
       
   832 
       
   833 void CT_DataWsSession::DoCmdPriorityKeyReady(const TDesC& aSection, TInt aAsyncErrorIndex)
       
   834 	{
       
   835 	CActive::TPriority	priority=CActive::EPriorityHigh;
       
   836 	CT_GraphicsUtil::ReadPriority(*this, aSection, KPKPriorityKey(), priority);
       
   837 
       
   838 	iActivePriorityKeyReady->SetPriority(priority);
       
   839 	INFO_PRINTF1(_L("RWsSession::PriorityKeyReady() call"));
       
   840 	iWsSession->PriorityKeyReady(&iActivePriorityKeyReady->iStatus);
       
   841 	iActivePriorityKeyReady->Activate(aAsyncErrorIndex);
       
   842 	IncOutstanding();
       
   843 	}
       
   844 
       
   845 
       
   846 void CT_DataWsSession::DoCmdPriorityKeyReadyCancel()
       
   847 	{
       
   848 	INFO_PRINTF1(_L("RWsSession::PriorityKeyReadyCancel() call"));
       
   849 	iWsSession->PriorityKeyReadyCancel();
       
   850 	}
       
   851 
       
   852 void CT_DataWsSession::DoCmdGetPriorityKeyL(const TDesC& aSection)
       
   853 	{
       
   854 	TWsPriorityKeyEvent  	event;
       
   855 
       
   856 	iWsSession->GetPriorityKey(event);
       
   857 	INFO_PRINTF1(_L("RWsSession::GetPriorityKey() call"));
       
   858 
       
   859 	TWsPriorityKeyEvent *	store=NULL;
       
   860 	if ( CT_GraphicsUtil::GetWsPriorityKeyEventL(*this, aSection, KFldStore(), store) )
       
   861 		{
       
   862 		*store=event;
       
   863 		}
       
   864 	}
       
   865 
       
   866 void CT_DataWsSession::DoCmdFlush()
       
   867 	{
       
   868 	INFO_PRINTF1(_L("RWsSession::Flush() call"));
       
   869 	iWsSession->Flush();
       
   870 	}
       
   871 
       
   872 void CT_DataWsSession::DoCmdSetAutoFlush(const TDesC& aSection)
       
   873 	{
       
   874 	TBool	actualFlushstate;
       
   875 	TBool	setFlushState=EFalse;
       
   876 	TBool	expectedFlush=EFalse;
       
   877 
       
   878 	if ( !GetBoolFromConfig(aSection, KAutoFlushState(), setFlushState) )
       
   879 		{
       
   880 		ERR_PRINTF2(KLogMissingParameter, &KAutoFlushState());
       
   881 		SetBlockResult(EFail);
       
   882 		}
       
   883 	else
       
   884 		{
       
   885 		actualFlushstate = iWsSession->SetAutoFlush(setFlushState);
       
   886 		INFO_PRINTF2(_L("Flush State: %d"),actualFlushstate);
       
   887 		
       
   888 		if ( !GetBoolFromConfig(aSection, KExpectFlushState(), expectedFlush) )
       
   889 			{
       
   890 			ERR_PRINTF2(KLogMissingParameter, &KExpectFlushState());
       
   891 			SetBlockResult(EFail);
       
   892 			}
       
   893 		else
       
   894 			{
       
   895 			if ( actualFlushstate!=expectedFlush)
       
   896 				{
       
   897 				ERR_PRINTF1(_L("SetAutoFlush is not as expected!"));
       
   898 				SetBlockResult(EFail);
       
   899 				}
       
   900 			}
       
   901 		}
       
   902 	}
       
   903 
       
   904 void CT_DataWsSession::DoCmdSetKeyboardRepeatRate(const TDesC& aSection)
       
   905 	{
       
   906     TInt	setInputInterval=iKeyboardRepeateRateInitialTime.Int();
       
   907     GetIntFromConfig(aSection, KSetKBRepRateInterval(), setInputInterval);
       
   908 
       
   909 	TInt	setInputTime=iKeyboardRepeateRateTime.Int();
       
   910 	GetIntFromConfig(aSection, KSetKBRepRateTime(), setInputTime);
       
   911 
       
   912 	TTimeIntervalMicroSeconds32 changeInitialTime(setInputInterval);
       
   913 	TTimeIntervalMicroSeconds32 changeTime(setInputTime);
       
   914 	iWsSession->SetKeyboardRepeatRate(changeInitialTime, changeTime);
       
   915 	}
       
   916 
       
   917 void CT_DataWsSession::DoCmdGetKeyboardRepeatRate(const TDesC& aSection)
       
   918 	{
       
   919 	TTimeIntervalMicroSeconds32	actualInitialTime;
       
   920 	TTimeIntervalMicroSeconds32	actualTime;
       
   921 	iWsSession->GetKeyboardRepeatRate(actualInitialTime, actualTime);
       
   922 	INFO_PRINTF2(_L("actual Interval Time: %d"), actualInitialTime.Int());
       
   923 	INFO_PRINTF2(_L("actual Time: %d"), actualTime.Int());
       
   924 
       
   925 	TInt	expectInitialTime;
       
   926 	if(	GetIntFromConfig(aSection, KWGGetExpectedKBInitialTime(), expectInitialTime))
       
   927 		{
       
   928 		if ( actualInitialTime.Int()!=expectInitialTime )
       
   929 			{
       
   930 			ERR_PRINTF1(_L("GetKeyboardRepeatRate is not as expected!"));
       
   931 			SetBlockResult(EFail);
       
   932 			}
       
   933 		}
       
   934 
       
   935 	TInt	expectTime;
       
   936 	if ( GetIntFromConfig(aSection, KWGGetExpectedKBRepeatTime(), expectTime) )
       
   937 		{
       
   938 		if ( actualTime.Int()!=expectTime)
       
   939 			{
       
   940 			ERR_PRINTF1(_L("GetKeyboardRepeatRate is not as expected!"));
       
   941 			SetBlockResult(EFail);
       
   942 			}
       
   943 		}
       
   944 
       
   945 	TBool	checkWithStore=FALSE;
       
   946 	GetBoolFromConfig(aSection, KFldCheckWithStore(), checkWithStore);
       
   947 	if ( checkWithStore )
       
   948 		{
       
   949 		if ( iKeyboardRepeateRateInitialTime!=actualInitialTime )
       
   950 			{
       
   951 			ERR_PRINTF1(_L("GetKeyboardRepeatRate is not as expected!"));
       
   952 			SetBlockResult(EFail);
       
   953 			}
       
   954 		if ( iKeyboardRepeateRateTime!=actualTime )
       
   955 			{
       
   956 			ERR_PRINTF1(_L("GetKeyboardRepeatRate is not as expected!"));
       
   957 			SetBlockResult(EFail);
       
   958 			}
       
   959 		}
       
   960 
       
   961 	TBool	store=FALSE;
       
   962 	GetBoolFromConfig(aSection, KFldStore(), store);
       
   963 	if ( store )
       
   964 		{
       
   965 		iKeyboardRepeateRateInitialTime=actualInitialTime;
       
   966 		iKeyboardRepeateRateTime=actualTime;
       
   967 		}
       
   968 	}
       
   969 
       
   970 void CT_DataWsSession::DoCmdSetDoubleClick(const TDesC& aSection)
       
   971 	{
       
   972 	TBool	dataOk=ETrue;
       
   973     TInt	setMaxInputInterval;
       
   974     if ( !GetIntFromConfig(aSection, KDblClickInterval(), setMaxInputInterval) )
       
   975 		{
       
   976 		dataOk=EFalse;
       
   977 		ERR_PRINTF2(KLogMissingParameter, &KDblClickInterval());
       
   978 		SetBlockResult(EFail);
       
   979 		}
       
   980 
       
   981 	TInt	setMaxDistance;
       
   982 	if ( !GetIntFromConfig(aSection, KDblClickDistance(), setMaxDistance) )
       
   983 		{
       
   984 		dataOk=EFalse;
       
   985 		ERR_PRINTF2(KLogMissingParameter, &KDblClickDistance());
       
   986 		SetBlockResult(EFail);
       
   987 		}
       
   988 
       
   989 	if ( dataOk )
       
   990 		{
       
   991 		TTimeIntervalMicroSeconds32	changeMaxIntervalTime(setMaxInputInterval);
       
   992 		iWsSession->SetDoubleClick(changeMaxIntervalTime, setMaxDistance);
       
   993 		}
       
   994 	}
       
   995 
       
   996 void CT_DataWsSession::DoCmdGetDoubleClickSettings(const TDesC& aSection)
       
   997 	{
       
   998 	TTimeIntervalMicroSeconds32	actualMaxIntervalValue;
       
   999 	TInt						actualMaxDistanceValue;
       
  1000 	iWsSession->GetDoubleClickSettings(actualMaxIntervalValue, actualMaxDistanceValue);
       
  1001 	INFO_PRINTF2(_L("Maximum interval: %d"), actualMaxIntervalValue.Int());
       
  1002 	INFO_PRINTF2(_L("Maximum distance : %d"), actualMaxDistanceValue);
       
  1003 
       
  1004 	TInt	expectMaxIntervalValue;
       
  1005 	if ( !GetIntFromConfig(aSection, KExpectedDblMaxInitialTime(), expectMaxIntervalValue))
       
  1006 		{
       
  1007 		ERR_PRINTF2(KLogMissingParameter, &KExpectedDblMaxInitialTime());
       
  1008 		SetBlockResult(EFail);
       
  1009 		}
       
  1010 	else
       
  1011 		{
       
  1012 		if ( actualMaxIntervalValue.Int()!=expectMaxIntervalValue )
       
  1013 			{
       
  1014 			ERR_PRINTF1(KLogNotExpectedValue);
       
  1015 			SetBlockResult(EFail);
       
  1016 			}
       
  1017 		}
       
  1018 
       
  1019 	TInt	expectMaxDistanceValue;
       
  1020 	if ( !GetIntFromConfig(aSection, KExpectedDblDistance(), expectMaxDistanceValue))
       
  1021 		{
       
  1022 		ERR_PRINTF2(KLogMissingParameter, &KExpectedDblDistance());
       
  1023 		SetBlockResult(EFail);
       
  1024 		}
       
  1025 	else
       
  1026 		{
       
  1027 		if ( actualMaxDistanceValue!=expectMaxDistanceValue)
       
  1028 			{
       
  1029 			ERR_PRINTF1(KLogNotExpectedValue);
       
  1030 			SetBlockResult(EFail);
       
  1031 			}
       
  1032 		}
       
  1033 	}
       
  1034 
       
  1035 void CT_DataWsSession::DoCmdNumWindowGroups(const TDesC& aSection)
       
  1036 	{
       
  1037 	TBool	dataOk=ETrue;
       
  1038 	TInt	previousCount=iNumWinGroup;
       
  1039 
       
  1040 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  1041 	TInt	priority;
       
  1042 	if ( GetIntFromConfig(aSection, KWGGivenPriority(), priority) )
       
  1043 		{
       
  1044 		TInt	screenNumber=0;
       
  1045 		if ( !GetIntFromConfig(aSection, KWGSpecifieScrnNo(), screenNumber) )
       
  1046 			{
       
  1047 			iNumWinGroup=iWsSession->NumWindowGroups(priority);
       
  1048 			INFO_PRINTF2(_L("NumWindowGroups(TInt aPriority):%d"), iNumWinGroup);
       
  1049 			}
       
  1050 		else
       
  1051 			{
       
  1052 			iNumWinGroup=iWsSession->NumWindowGroups(screenNumber, priority);
       
  1053 			INFO_PRINTF2(_L("NumWindowGroups(TInt aScreenNumber, TInt aPriority):%d"), iNumWinGroup);
       
  1054 			}
       
  1055 		}
       
  1056 	else
       
  1057 #endif
       
  1058 		{
       
  1059 		iNumWinGroup=iWsSession->NumWindowGroups();
       
  1060 		INFO_PRINTF2(_L("NumWindowGroups():%d"), iNumWinGroup);
       
  1061 		}
       
  1062 
       
  1063 	if ( dataOk )
       
  1064 		{
       
  1065 		TInt	difference=0;
       
  1066 		if ( GetIntFromConfig(aSection, KExpectedDiff(), difference) )
       
  1067 			{
       
  1068 			if ( (iNumWinGroup-previousCount)!=difference )
       
  1069 				{
       
  1070 				ERR_PRINTF2(_L("Previous count:%d"), previousCount);
       
  1071 				ERR_PRINTF1(KLogNotExpectedValue);
       
  1072 				SetBlockResult(EFail);
       
  1073 				}
       
  1074 			}
       
  1075 		}
       
  1076 	}
       
  1077 
       
  1078 void CT_DataWsSession::DoCmdWindowGroupListL(const TDesC& aSection)
       
  1079 	{
       
  1080 	INFO_PRINTF2(_L("iNumWinGroup:%d"), iNumWinGroup);
       
  1081 	RArray<RWsSession::TWindowGroupChainInfo>	numWGListRArray(1);
       
  1082 	CArrayFixFlat<TInt>*						numWGListCArray=new (ELeave) CArrayFixFlat<TInt>(iNumWinGroup);
       
  1083 	CleanupStack::PushL(numWGListCArray);
       
  1084 	CleanupClosePushL(numWGListRArray);
       
  1085 
       
  1086 	//True:CArrayFixFlat  Flase:RArray
       
  1087 	TInt	priority;
       
  1088 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  1089 	TBool	hasPriority=CT_GraphicsUtil::ReadPriorities(*this, aSection, KWGListPriority(), priority);
       
  1090 #else
       
  1091 	TBool	hasPriority=GetIntFromConfig(aSection, KWGListPriority(), priority);
       
  1092 #endif
       
  1093 
       
  1094 	TBool	useClassArray;
       
  1095 	if ( !GetBoolFromConfig(aSection, KWGUseArray(), useClassArray) )
       
  1096 		{
       
  1097 		ERR_PRINTF2(KLogMissingParameter, &KWGUseArray());
       
  1098 		SetBlockResult(EFail);
       
  1099 		}
       
  1100 	else
       
  1101 		{
       
  1102 		TInt	err=KErrNone;
       
  1103 		INFO_PRINTF2(_L("Use Class array:%d"), useClassArray);
       
  1104 		
       
  1105 		if ( useClassArray )
       
  1106 			{
       
  1107 			if(	hasPriority )
       
  1108 				{
       
  1109 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  1110 				TInt	theScrnNum;
       
  1111 				if(	GetIntFromConfig(aSection, KWGScreenNumber(), theScrnNum))
       
  1112 					{
       
  1113 					INFO_PRINTF1(_L("WindowGroupList(CArrayFixFlat< TInt >*, TInt, TInt)"));
       
  1114 					err=iWsSession->WindowGroupList(numWGListCArray, theScrnNum, priority);
       
  1115 					}
       
  1116 				else
       
  1117 #endif
       
  1118 					{
       
  1119 					INFO_PRINTF1(_L("WindowGroupList(TInt, CArrayFixFlat<TInt>*)"));
       
  1120 					err=iWsSession->WindowGroupList(priority, numWGListCArray);
       
  1121 					}
       
  1122 				}
       
  1123 			else
       
  1124 				{
       
  1125 				INFO_PRINTF1(_L("WindowGroupList(CArrayFixFlat<TInt>*)"));
       
  1126 				err=iWsSession->WindowGroupList(numWGListCArray);
       
  1127 				}
       
  1128 			}
       
  1129 		else
       
  1130 			{
       
  1131 			if ( hasPriority )
       
  1132 				{
       
  1133 				INFO_PRINTF1(_L("WindowGroupList(TInt, RArray<RWsSession::TWindowGroupChainInfo>*)"));
       
  1134 				err=iWsSession->WindowGroupList(priority, &numWGListRArray);
       
  1135 				}
       
  1136 			else
       
  1137 				{
       
  1138 				INFO_PRINTF1(_L("WindowGroupList(RArray<RWsSession::TWindowGroupChainInfo>)"));
       
  1139 				err=iWsSession->WindowGroupList(&numWGListRArray);
       
  1140 				}
       
  1141 			}
       
  1142 
       
  1143 		if ( err!=KErrNone )
       
  1144 			{
       
  1145 			ERR_PRINTF2(KLogError, err);
       
  1146 			SetError(err);
       
  1147 			}
       
  1148 		else
       
  1149 			{
       
  1150 			if ( useClassArray )
       
  1151 				{
       
  1152 				TInt	actual=0;
       
  1153 				INFO_PRINTF2(_L("numWGListCArray:%d"), numWGListCArray->Count());
       
  1154 				for ( TInt index=0; index<numWGListCArray->Count(); ++index )
       
  1155 					{
       
  1156 					// Gets a list of identifiers of all window groups in all window server sessions
       
  1157 					actual=(*numWGListCArray)[index];
       
  1158 					INFO_PRINTF3(_L("CArrayFixFlat[%d]= :%d"), index, actual);
       
  1159 					}
       
  1160 				}
       
  1161 			else
       
  1162 				{
       
  1163 				RWsSession::TWindowGroupChainInfo	actual;
       
  1164 				INFO_PRINTF2(_L("numWGListRArray:%d"), numWGListRArray.Count());
       
  1165 				for ( TInt index=0; index<numWGListRArray.Count(); ++index )
       
  1166 					{
       
  1167 					// Gets a list of identifiers of all window groups in all window server sessions
       
  1168 					actual=numWGListRArray[index];
       
  1169 					INFO_PRINTF4(_L("RArray{%d] iId:%d iParentId:%d"), index, actual.iId, actual.iParentId);
       
  1170 					}
       
  1171 				}
       
  1172 			}
       
  1173 		}
       
  1174 
       
  1175 	CleanupStack::PopAndDestroy(2, numWGListCArray);
       
  1176 	}
       
  1177 
       
  1178 void CT_DataWsSession::DoCmdGetFocusWindowGroup(const TDesC& aSection)
       
  1179 	{
       
  1180 	TInt	actual=0;
       
  1181 
       
  1182 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  1183 	TInt	theScrnNum=0;
       
  1184 	if ( GetIntFromConfig(aSection, KWGScreenNumber(), theScrnNum) )
       
  1185 		{
       
  1186 		INFO_PRINTF1(_L("RWsSession::GetFocusWindowGroup(TInt aScreenNumber)  call"));
       
  1187 		actual=iWsSession->GetFocusWindowGroup(theScrnNum);
       
  1188 		}
       
  1189 	else
       
  1190 #endif
       
  1191 		{
       
  1192 		INFO_PRINTF1(_L("RWsSession::GetFocusWindowGroup() call"));
       
  1193 		actual=iWsSession->GetFocusWindowGroup();
       
  1194 		}
       
  1195 	INFO_PRINTF2(_L("Window Group Identifier:%d"), actual);
       
  1196 
       
  1197 	TInt 	expected=0;
       
  1198 	if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
       
  1199 		{
       
  1200 		if ( actual!=expected )
       
  1201 			{
       
  1202 			ERR_PRINTF1(_L("Window group identifier is not as expected!"));
       
  1203 			SetBlockResult(EFail);
       
  1204 			}
       
  1205 		}
       
  1206 	}
       
  1207 
       
  1208 void CT_DataWsSession::DoCmdGetDefaultOwningWindow(const TDesC& aSection)
       
  1209 	{
       
  1210 	TInt	actual=0;
       
  1211 	TBool	dataOk=ETrue;
       
  1212 
       
  1213 	TInt	theScrnNum=0;
       
  1214 	if(	GetIntFromConfig(aSection, KWGScreenNumber(), theScrnNum))
       
  1215 		{
       
  1216 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  1217 		INFO_PRINTF1(_L("RWsSession::GetDefaultOwningWindow(TInt aScreenNumber)  call"));
       
  1218 		actual=iWsSession->GetDefaultOwningWindow(theScrnNum);
       
  1219 #else
       
  1220 		dataOk=EFalse;
       
  1221 		ERR_PRINTF1(_L("SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS Not Supported"));
       
  1222 		SetBlockResult(EFail);
       
  1223 #endif
       
  1224 		}
       
  1225 	else
       
  1226 		{
       
  1227 		INFO_PRINTF1(_L("RWsSession::GetDefaultOwningWindow()  call"));
       
  1228 		actual=iWsSession->GetDefaultOwningWindow();
       
  1229 		}
       
  1230 
       
  1231 	if ( dataOk )
       
  1232 		{
       
  1233 		INFO_PRINTF2(_L("default owning window:%d"), actual);
       
  1234 
       
  1235 		TInt	expected=0;
       
  1236 		if ( !GetIntFromConfig(aSection, KFldExpected(), expected) )
       
  1237 			{
       
  1238 			ERR_PRINTF2(KLogMissingParameter, &KFldExpected());
       
  1239 			SetBlockResult(EFail);
       
  1240 			}
       
  1241 		else
       
  1242 			{
       
  1243 			if ( actual!=expected)
       
  1244 				{
       
  1245 				ERR_PRINTF1(_L("Default Owning Window is not as expected!"));
       
  1246 				SetBlockResult(EFail);
       
  1247 				}
       
  1248 			}
       
  1249 		}
       
  1250 	}
       
  1251 
       
  1252 void CT_DataWsSession::DoCmdSetWindowGroupOrdinalPosition(const TDesC& aSection)
       
  1253 	{
       
  1254 	TBool	dataOk=ETrue;
       
  1255 
       
  1256 	TInt		 inputWGId;
       
  1257 	if ( !GetIntFromConfig(aSection, KWGOrdinalId(), inputWGId) )
       
  1258 		{
       
  1259 		TPtrC		 objectName;
       
  1260 		if ( GetStringFromConfig(aSection, KFldWindowGroup(), objectName) )
       
  1261 			 {
       
  1262 			 INFO_PRINTF1(_L("Get CT_DataWindowGroup's wrapper. "));
       
  1263 			 CDataWrapperBase* wrapper = NULL;
       
  1264 			 wrapper = static_cast<CDataWrapperBase*>(GetDataWrapperL(objectName));
       
  1265 			 if(wrapper)
       
  1266 				 {
       
  1267 				 inputWGId=wrapper->GetIdentifier();
       
  1268 				 INFO_PRINTF2(_L("Window group's identifier is: %d"), inputWGId);
       
  1269 				 }
       
  1270 			 else
       
  1271 				 {
       
  1272 				 dataOk=EFalse;
       
  1273 				 ERR_PRINTF1(_L("Window group's wrapper pointer is NULL"));
       
  1274 				 SetBlockResult(EFail);
       
  1275 				 }
       
  1276 			 }
       
  1277 		else
       
  1278 			 {
       
  1279 			 dataOk=EFalse;
       
  1280 			 ERR_PRINTF2(KLogMissingParameter, &KWGOrdinalId());
       
  1281 			 SetBlockResult(EFail);
       
  1282 			 }
       
  1283 		}
       
  1284    	
       
  1285 	TInt	inputWGOrdinalPos;
       
  1286 	if ( !GetIntFromConfig(aSection, KWGOrdinalPosition(), inputWGOrdinalPos) )
       
  1287 		{
       
  1288 		dataOk=EFalse;
       
  1289 		ERR_PRINTF2(KLogMissingParameter, &KWGOrdinalPosition());
       
  1290 		SetBlockResult(EFail);
       
  1291 		}
       
  1292 
       
  1293 	if ( dataOk )
       
  1294 		{
       
  1295 		TInt	err=iWsSession->SetWindowGroupOrdinalPosition(inputWGId, inputWGOrdinalPos);
       
  1296 
       
  1297 		if ( err!=KErrNone )
       
  1298 			{
       
  1299 			ERR_PRINTF2(KLogError, err);
       
  1300 			SetError(err);
       
  1301 			}
       
  1302 		}
       
  1303 	}
       
  1304 
       
  1305 void CT_DataWsSession::DoCmdGetWindowGroupClientThreadId(const TDesC& aSection)
       
  1306 	{
       
  1307 	TInt	inputWindowGroupIdentifier=0;
       
  1308 	if ( !GetIntFromConfig(aSection, KWindowGroupIdentifier(), inputWindowGroupIdentifier) )
       
  1309 		{
       
  1310 		ERR_PRINTF2(KLogMissingParameter, &KWindowGroupIdentifier());
       
  1311 		SetBlockResult(EFail);
       
  1312 		}
       
  1313 	else
       
  1314 		{
       
  1315 		TThreadId	threadId;
       
  1316 		TInt		err=iWsSession->GetWindowGroupClientThreadId(inputWindowGroupIdentifier, threadId);
       
  1317 		TUint64		actual=threadId.Id();
       
  1318 		INFO_PRINTF1(_L("RWsSession::GetWindowGroupClientThreadId"));
       
  1319 		INFO_PRINTF2(_L("actual ThreadId:%d"), actual);
       
  1320 		if ( err!=KErrNone )
       
  1321 			{
       
  1322 			ERR_PRINTF2(KLogError, err);
       
  1323 			SetError(err);
       
  1324 			}
       
  1325 		}
       
  1326 	}
       
  1327 
       
  1328 void CT_DataWsSession::DoCmdGetWindowGroupHandle(const TDesC& aSection)
       
  1329     {
       
  1330 	TInt	inputWGId=0;
       
  1331 	if ( !GetIntFromConfig(aSection, KInputWGId(), inputWGId) )
       
  1332 		{
       
  1333 		ERR_PRINTF2(KLogMissingParameter, &KInputWGId());
       
  1334 		SetBlockResult(EFail);
       
  1335 		}
       
  1336 	else
       
  1337 		{
       
  1338 		TInt	actual=iWsSession->GetWindowGroupHandle(inputWGId);
       
  1339 		INFO_PRINTF2(_L("Window group handle :%d"), actual);
       
  1340 		}
       
  1341     }
       
  1342 
       
  1343 void CT_DataWsSession::DoCmdGetWindowGroupOrdinalPriority(const TDesC& aSection)
       
  1344     {
       
  1345 	TInt	inputWGId=0;
       
  1346 	if ( !GetIntFromConfig(aSection, KWGOrdinalPriority(), inputWGId))
       
  1347 		{
       
  1348 		ERR_PRINTF2(KLogMissingParameter, &KWGOrdinalPriority());
       
  1349 		SetBlockResult(EFail);
       
  1350 		}
       
  1351 	else
       
  1352 		{
       
  1353 		TInt	actual=iWsSession->GetWindowGroupOrdinalPriority(inputWGId);
       
  1354 		INFO_PRINTF2(_L("Window Group Ordinal Priority:%d"), actual);
       
  1355 		
       
  1356 		TInt	expected;
       
  1357 		if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
       
  1358 			{
       
  1359 			if ( actual!=expected )
       
  1360 				{
       
  1361 				ERR_PRINTF1(KLogNotExpectedValue);
       
  1362 				SetBlockResult(EFail);
       
  1363 				}
       
  1364 			}
       
  1365 		}
       
  1366     }
       
  1367 
       
  1368 void CT_DataWsSession::DoCmdGetWindowGroupNameFromIdentifier(const TDesC& aSection)
       
  1369 	{
       
  1370 	TInt 	inquiredWGId=0;
       
  1371 	TInt	rtnStatus;
       
  1372 
       
  1373 	if ( !GetIntFromConfig(aSection, KWGinquiredId(), inquiredWGId) )
       
  1374 		{
       
  1375 		ERR_PRINTF2(KLogMissingParameter, &KWGinquiredId());
       
  1376 		SetBlockResult(EFail);
       
  1377 		}
       
  1378 	else
       
  1379 		{
       
  1380 		TBuf<KGroupNameMaxSize> storeAWindowName;
       
  1381 		INFO_PRINTF2(_L("Window Group inquired Id:%d"),inquiredWGId);
       
  1382 		rtnStatus= iWsSession->GetWindowGroupNameFromIdentifier(inquiredWGId, storeAWindowName);
       
  1383 		INFO_PRINTF2(_L("return status:%d"),rtnStatus);
       
  1384 
       
  1385 		if (rtnStatus==KErrNone)
       
  1386 			{
       
  1387 			INFO_PRINTF2(_L("the length of  buffer:%d"),storeAWindowName.Length());
       
  1388 			INFO_PRINTF1(_L("the name of window group:"));
       
  1389 			INFO_PRINTF1(storeAWindowName);
       
  1390 			}
       
  1391 		else
       
  1392 			{
       
  1393 			ERR_PRINTF1(_L("GetWindowGroupNameFromIdentifier function is fail!"));
       
  1394 			SetBlockResult(EFail);
       
  1395 			}
       
  1396 		}
       
  1397 	}
       
  1398 
       
  1399 void CT_DataWsSession::DoCmdFindWindowGroupIdentifier(const TDesC& aSection)
       
  1400 	{
       
  1401 	TInt	previousId=iWindowGroupIdentifier;
       
  1402 	GetIntFromConfig(aSection, KFindWGPreId(), previousId);
       
  1403 	INFO_PRINTF2(_L("previous window group id:%d"), previousId);
       
  1404 
       
  1405 	TInt	nextId;
       
  1406 	TPtrC	matchString;
       
  1407 	if ( GetStringFromConfig(aSection, KMatchWGString(), matchString) )
       
  1408 		{
       
  1409 		TInt	offset=0;
       
  1410 		GetIntFromConfig(aSection, KFldOffset(), offset);
       
  1411 		nextId=iWsSession->FindWindowGroupIdentifier(previousId, matchString, offset);
       
  1412 		}
       
  1413 	else
       
  1414 		{
       
  1415 		RThread		proc;
       
  1416 		TThreadId	threadId=proc.Id();
       
  1417 
       
  1418 		TInt	id;
       
  1419 		if ( GetIntFromConfig(aSection, KThreadId(), id) )
       
  1420 			{
       
  1421 			threadId=id;
       
  1422 			}
       
  1423 		nextId=iWsSession->FindWindowGroupIdentifier(previousId, threadId);
       
  1424 		}
       
  1425 
       
  1426 	if ( nextId<0 )
       
  1427 		{
       
  1428 		ERR_PRINTF1(_L("failed to find Window group name function !"));
       
  1429 		SetError(nextId);
       
  1430 		}
       
  1431 	else
       
  1432 		{
       
  1433 		iWindowGroupIdentifier=nextId;
       
  1434 		}
       
  1435 	}
       
  1436 
       
  1437 void CT_DataWsSession::DoCmdFetchMessage(const TDesC& aSection)
       
  1438 	{
       
  1439 	TUid		uid;
       
  1440 	TPtr8		params(NULL,0);
       
  1441 	TWsEvent	event;
       
  1442 	TInt		err=iWsSession->FetchMessage(uid, params, event);
       
  1443     TInt expected;
       
  1444 	if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
       
  1445 		{
       
  1446 		if ( err!=expected )
       
  1447 			{
       
  1448 			ERR_PRINTF2(KLogError, err);
       
  1449 			SetBlockResult(EFail);
       
  1450 			}
       
  1451 		}
       
  1452 	}
       
  1453 
       
  1454 void CT_DataWsSession::DoCmdSetShadowVector(const TDesC& aSection)
       
  1455 	{
       
  1456 	// Get test data for command input parameter(s)
       
  1457 	TPoint	setPtShdwVet;
       
  1458 	if ( !GetPointFromConfig(aSection, KSetShadowVec(), setPtShdwVet) )
       
  1459 		{
       
  1460 		ERR_PRINTF2(KLogMissingParameter, &KSetShadowVec());
       
  1461 		SetBlockResult(EFail);
       
  1462 		}
       
  1463 	else
       
  1464 		{
       
  1465 		// Execute command and log parameters
       
  1466 		INFO_PRINTF1(_L("execute SetShadowVector(const TPoint &aVector)"));
       
  1467 		iWsSession->SetShadowVector(setPtShdwVet);
       
  1468 		}
       
  1469     }
       
  1470 
       
  1471 void CT_DataWsSession::DoCmdShadowVector(const TDesC& aSection)
       
  1472 	{
       
  1473 	// Get test data for command input parameter(s)
       
  1474 	TPoint	actual=iWsSession->ShadowVector();
       
  1475 	INFO_PRINTF3(_L("execute ShadowVector() x=%d y=%d"), actual.iX, actual.iY);
       
  1476 
       
  1477 	TPoint	expected;
       
  1478 	if ( !GetPointFromConfig(aSection, KExpectShadowVector(), expected) )
       
  1479 		{
       
  1480 		ERR_PRINTF2(KLogMissingParameter, &KExpectShadowVector());
       
  1481 		SetBlockResult(EFail);
       
  1482 		}
       
  1483 	else
       
  1484 		{
       
  1485 		if ( actual!=expected )
       
  1486 			{
       
  1487 			ERR_PRINTF1(_L("The current value of the shadow vector is not as expected!"));
       
  1488 			SetBlockResult(EFail);
       
  1489 			}
       
  1490 		}
       
  1491     }
       
  1492 
       
  1493 void CT_DataWsSession::DoCmdSetBackgroundColor(const TDesC& aSection)
       
  1494 	{
       
  1495 	TRgb	datColour;
       
  1496 	if ( !GetRgbFromConfig(aSection, KBGColour, datColour) )
       
  1497 		{
       
  1498 		ERR_PRINTF2(KLogMissingParameter, &KBGColour());
       
  1499 		SetBlockResult(EFail);
       
  1500 		}
       
  1501 	else
       
  1502 		{
       
  1503 		// Execute command and log parameters
       
  1504 		INFO_PRINTF1(_L("execute SetColor(TRgb)"));
       
  1505 		iWsSession->SetBackgroundColor(datColour);
       
  1506 		}
       
  1507 	}
       
  1508 
       
  1509 void CT_DataWsSession::DoCmdGetBackgroundColor(const TDesC& aSection)
       
  1510 	{
       
  1511 	// Get test data for command input parameter(s)
       
  1512 	TRgb	actualBgColour=iWsSession->GetBackgroundColor();
       
  1513 
       
  1514 	TRgb	expectBgColour;
       
  1515 	if ( !GetRgbFromConfig(aSection, KExpectBgColour(), expectBgColour) )
       
  1516 		{
       
  1517 		ERR_PRINTF2(KLogMissingParameter, &KExpectBgColour());
       
  1518 		SetBlockResult(EFail);
       
  1519 		}
       
  1520 	else
       
  1521 		{
       
  1522 		if ( actualBgColour!=expectBgColour )
       
  1523 			{
       
  1524 			ERR_PRINTF1(_L("The current value of the shadow vector is not as expected!"));
       
  1525 			SetBlockResult(EFail);
       
  1526 			}
       
  1527 		}
       
  1528 	}
       
  1529 
       
  1530 void CT_DataWsSession::DoCmdSetSystemPointerCursor(const TDesC& aSection)
       
  1531     {
       
  1532     RWsPointerCursor	sysPointerCursor=RWsPointerCursor(*iWsSession);
       
  1533 
       
  1534 	INFO_PRINTF1(_L("RWsSession::SetSystemPointerCursor() call"));
       
  1535 	TInt	inputCursorNumber=0;
       
  1536 	if ( !GetIntFromConfig(aSection, KInputCursorNumber(), inputCursorNumber) )
       
  1537 		{
       
  1538 		ERR_PRINTF2(KLogMissingParameter, &KExpectBgColour());
       
  1539 		SetBlockResult(EFail);
       
  1540 		}
       
  1541 	else
       
  1542 		{
       
  1543 		INFO_PRINTF2(_L("CursorNumber:%d"),inputCursorNumber);
       
  1544 		TInt	err=iWsSession->SetSystemPointerCursor(sysPointerCursor,inputCursorNumber);
       
  1545 		if ( err!=KErrNone )
       
  1546 			{
       
  1547 			ERR_PRINTF2(KLogError, err);
       
  1548 			SetError(err);
       
  1549 			}
       
  1550 		}
       
  1551 	}
       
  1552 
       
  1553 void CT_DataWsSession::DoCmdClearSystemPointerCursor(const TDesC& aSection)
       
  1554 	{
       
  1555 	TInt	inputCursorNumber=0;
       
  1556 
       
  1557 	if ( !GetIntFromConfig(aSection, KInputCursorNumber(), inputCursorNumber) )
       
  1558 		{
       
  1559 		ERR_PRINTF2(KLogMissingParameter, &KInputCursorNumber());
       
  1560 		SetBlockResult(EFail);
       
  1561 		}
       
  1562 	else
       
  1563 		{
       
  1564 		INFO_PRINTF2(_L("CursorNumber:%d"),inputCursorNumber);
       
  1565 		INFO_PRINTF1(_L("RWsSession::ClearSystemPointerCursor"));
       
  1566 		iWsSession->ClearSystemPointerCursor(inputCursorNumber);
       
  1567 		}
       
  1568 	}
       
  1569 
       
  1570 void CT_DataWsSession::DoCmdClaimSystemPointerCursorList()
       
  1571 	{
       
  1572 	INFO_PRINTF1(_L("RWsSession::ClaimSystemPointerCursorList() call"));
       
  1573 	TInt	err=iWsSession->ClaimSystemPointerCursorList();
       
  1574 
       
  1575 	if ( err!=KErrNone )
       
  1576 		{
       
  1577 		ERR_PRINTF2(KLogError, err);
       
  1578 		SetError(err);
       
  1579 		}
       
  1580 	}
       
  1581 
       
  1582 void CT_DataWsSession::DoCmdFreeSystemPointerCursorList()
       
  1583 	{
       
  1584 	INFO_PRINTF1(_L("RWsSession::FreeSystemPointerCursorList() call"));
       
  1585 	iWsSession->FreeSystemPointerCursorList();
       
  1586 	}
       
  1587 
       
  1588 void CT_DataWsSession::DoCmdSetCustomTextCursorL(const TDesC& aSection)
       
  1589 	{
       
  1590 	TBool	dataOk=ETrue;
       
  1591 
       
  1592 	TInt	identifier;
       
  1593 	if ( !GetIntFromConfig(aSection, KFldIdentifier(), identifier) )
       
  1594 		{
       
  1595 		dataOk=EFalse;
       
  1596 		ERR_PRINTF2(KLogMissingParameter, &KFldIdentifier);
       
  1597 		SetBlockResult(EFail);
       
  1598 		}
       
  1599 
       
  1600 	CArrayFixFlat<TSpriteMember>*	spriteMember = new (ELeave) CArrayFixFlat<TSpriteMember>(1);
       
  1601 	if ( !CT_GraphicsUtil::GetSpriteMemberListL(*this, aSection, KFldSpriteMember, *spriteMember) )
       
  1602 		{
       
  1603 		dataOk=EFalse;
       
  1604 		ERR_PRINTF2(KLogMissingParameter, &KFldSpriteMember);
       
  1605 		SetBlockResult(EFail);
       
  1606 		}
       
  1607 	TArray<TSpriteMember>	spriteArray = spriteMember->Array();
       
  1608 
       
  1609 	TSpriteFlags	spriteFlags;
       
  1610 	if ( !CT_GraphicsUtil::ReadSpriteFlags(*this, aSection, KFldSpriteFlags, spriteFlags) )
       
  1611 		{
       
  1612 		dataOk=EFalse;
       
  1613 		ERR_PRINTF2(KLogMissingParameter, &KFldSpriteFlags);
       
  1614 		SetBlockResult(EFail);
       
  1615 		}
       
  1616 
       
  1617 	RWsSession::TCustomTextCursorAlignment	alignment;
       
  1618 	if ( !CT_GraphicsUtil::ReadCustomTextCursorAlignment(*this, aSection, KFldAlignment, alignment) )
       
  1619 		{
       
  1620 		dataOk=EFalse;
       
  1621 		ERR_PRINTF2(KLogMissingParameter, &KFldAlignment);
       
  1622 		SetBlockResult(EFail);
       
  1623 		}
       
  1624 
       
  1625 	if ( dataOk )
       
  1626 		{
       
  1627 		INFO_PRINTF1(_L("SetCustomTextCursor(TInt, TArray< TSpriteMember >, TUint, TCustomTextCursorAlignment)"));
       
  1628 		TInt	err=iWsSession->SetCustomTextCursor(identifier, spriteArray, (TUint)spriteFlags, alignment);
       
  1629 
       
  1630 		if ( err!=KErrNone )
       
  1631 			{
       
  1632 			ERR_PRINTF2(KLogError, err);
       
  1633 			SetError(err);
       
  1634 			}
       
  1635 		}
       
  1636 	}
       
  1637 
       
  1638 void CT_DataWsSession::DoCmdResourceCount(const TDesC& aSection)
       
  1639 	{
       
  1640 	TInt	resourceCount=iWsSession->ResourceCount();
       
  1641 	INFO_PRINTF2(_L("RWsSession::ResourceCount() %d"), resourceCount);
       
  1642 
       
  1643 	// get expected difference from parameters
       
  1644 	TInt	expectedDifference;
       
  1645 	if ( GetIntFromConfig(aSection, KExpectedDiff(), expectedDifference) )
       
  1646 		{
       
  1647 		TInt	actualDifference=resourceCount-iResourceCount;
       
  1648 		if ( actualDifference != expectedDifference )
       
  1649 			{
       
  1650 			ERR_PRINTF3(_L("Resource count difference is not as expected! expected: %d, actual: %d"), expectedDifference, actualDifference);
       
  1651 			SetBlockResult(EFail);
       
  1652 			}
       
  1653 		}
       
  1654 	iResourceCount = resourceCount;
       
  1655 	}
       
  1656 
       
  1657 void CT_DataWsSession::DoCmdPasswordEntered()
       
  1658 	{
       
  1659 	INFO_PRINTF1(_L("RWsSession::PasswordEntered() call"));
       
  1660 	iWsSession->PasswordEntered();
       
  1661 	}
       
  1662 
       
  1663 void CT_DataWsSession::DoCmdComputeMode(const TDesC& aSection)
       
  1664 	{
       
  1665 	RWsSession::TComputeMode	mode;
       
  1666 
       
  1667 	INFO_PRINTF1(_L("RWsSession::ComputeMode() call"));
       
  1668 	if ( !CT_GraphicsUtil::ReadComputeMode(*this, aSection, KComputeMode(), mode) )
       
  1669 		{
       
  1670 		ERR_PRINTF2(KLogMissingParameter, &KComputeMode());
       
  1671 		SetBlockResult(EFail);
       
  1672 		}
       
  1673 	else
       
  1674 		{
       
  1675 		iWsSession->ComputeMode(mode);
       
  1676 		}
       
  1677 	}
       
  1678 
       
  1679 
       
  1680 void CT_DataWsSession::DoCmdHeapCount(const TDesC& aSection)
       
  1681 	{
       
  1682 	TInt	expectedCount;
       
  1683 	TInt	heapCount;
       
  1684 
       
  1685 	if ( !GetIntFromConfig(aSection, KExpectedHeapCount(), expectedCount) )
       
  1686 		{
       
  1687 		ERR_PRINTF2(KLogMissingParameter, &KExpectedHeapCount());
       
  1688 		SetBlockResult(EFail);
       
  1689 		}
       
  1690 	else
       
  1691 		{
       
  1692 		INFO_PRINTF2(_L("expected count: %d"), expectedCount);
       
  1693 		INFO_PRINTF1(_L("RWsSession::HeapCount() call"));
       
  1694 		heapCount=iWsSession->HeapCount();
       
  1695 		INFO_PRINTF2(_L("RWsSession::HeapCount(): %d"), heapCount);
       
  1696 		if ( expectedCount > heapCount )
       
  1697 			{
       
  1698 			ERR_PRINTF3(_L("Heap count is lower than expected! expected: %d, actual: %d"), expectedCount, heapCount);
       
  1699 			SetBlockResult(EFail);
       
  1700 			}
       
  1701 		}
       
  1702 	}
       
  1703 
       
  1704 void CT_DataWsSession::DoCmdSetModifierState(const TDesC& aSection)
       
  1705 	{
       
  1706 	TBool	dataOk=ETrue;
       
  1707 
       
  1708 	TEventModifier	eventModifier;
       
  1709 	if ( !CT_GraphicsUtil::ReadEventModifier(*this, aSection, KInputPermanentModifier(), eventModifier) )
       
  1710 		{
       
  1711 		dataOk=EFalse;
       
  1712 		ERR_PRINTF2(KLogMissingParameter, &KInputPermanentModifier());
       
  1713 		SetBlockResult(EFail);
       
  1714 		}
       
  1715 
       
  1716 	TModifierState	modifierState;
       
  1717 	if(	!CT_GraphicsUtil::ReadModifierState(*this, aSection, KInputPermanentModifierState(), modifierState) )
       
  1718 		{
       
  1719 		dataOk=EFalse;
       
  1720 		ERR_PRINTF2(KLogMissingParameter, &KInputPermanentModifierState());
       
  1721 		SetBlockResult(EFail);
       
  1722 		}
       
  1723 
       
  1724 	if ( dataOk )
       
  1725 		{
       
  1726 		INFO_PRINTF1(_L("RWsSession::SetModifierState"));
       
  1727 		TInt	err = iWsSession->SetModifierState(eventModifier, modifierState);
       
  1728 		if ( err!=KErrNone )
       
  1729 			{
       
  1730 			ERR_PRINTF2(KLogError, err);
       
  1731 			SetError(err);
       
  1732 			}
       
  1733 		}
       
  1734 	}
       
  1735 
       
  1736 void CT_DataWsSession::DoCmdGetModifierState(const TDesC& aSection)
       
  1737     {
       
  1738 	TInt	actual=iWsSession->GetModifierState();
       
  1739 	INFO_PRINTF2(_L("GetModifierState:%d"), actual);
       
  1740 
       
  1741 	TUint 	expected=0;
       
  1742 	if ( CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldExpected(), expected) )
       
  1743 		{
       
  1744 		if ( actual!=(TInt)expected )
       
  1745 			{
       
  1746 			ERR_PRINTF1(_L("ModifierState is not as expected!"));
       
  1747 			SetBlockResult(EFail);
       
  1748 			}
       
  1749 		}
       
  1750 	}
       
  1751 
       
  1752 void CT_DataWsSession::DoCmdRequestOffEventsL(const TDesC& aSection)
       
  1753 	{
       
  1754 	TBool 	eventOffOn;
       
  1755 	if ( !GetBoolFromConfig(aSection, KSetEventOffOn(), eventOffOn) )
       
  1756 		{
       
  1757 		ERR_PRINTF2(KLogMissingParameter, &KSetEventOffOn());
       
  1758 		SetBlockResult(EFail);
       
  1759 		}
       
  1760 	else
       
  1761 		{
       
  1762 		RWindowTreeNode*	treeNodeObj=NULL;
       
  1763 		TPtrC 	treeNodeObjectName;
       
  1764 		if ( GetStringFromConfig(aSection, KWTreeNodeObj(), treeNodeObjectName) )
       
  1765 			{
       
  1766 			treeNodeObj = static_cast<RWindowTreeNode*>(GetDataObjectL(treeNodeObjectName));
       
  1767 			}
       
  1768 
       
  1769 		INFO_PRINTF1(_L("RWsSession::RequestOffEvents(TBool, RWindowTreeNode*) call"));
       
  1770 		TInt	err=iWsSession->RequestOffEvents(eventOffOn, treeNodeObj);
       
  1771 		if ( err!=KErrNone )
       
  1772 			{
       
  1773 			ERR_PRINTF2(KLogError, err);
       
  1774 			SetError(err);
       
  1775 			}
       
  1776 		}
       
  1777 	}
       
  1778 
       
  1779 void CT_DataWsSession::DoCmdGetDefModeMaxNumColors(const TDesC& aSection)
       
  1780 	{
       
  1781 	TInt	colors;
       
  1782 	TInt	grays;
       
  1783 
       
  1784 	INFO_PRINTF1(_L("RWsSession::GetDefModeMaxNumColors(TInt &aColor, TInt &aGray) call"));
       
  1785 		
       
  1786 	TDisplayMode	displayMode;
       
  1787 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  1788 	TInt			theScrnNum=0;
       
  1789 	if ( GetIntFromConfig(aSection, KWGScreenNumber(), theScrnNum) )
       
  1790 		{
       
  1791 		displayMode=iWsSession->GetDefModeMaxNumColors(theScrnNum, colors, grays);
       
  1792 		}
       
  1793 	else
       
  1794 #endif
       
  1795 		{
       
  1796 		displayMode=iWsSession->GetDefModeMaxNumColors(colors, grays);
       
  1797 		}
       
  1798 	INFO_PRINTF4(_L("RWsSession::GetDefModeMaxNumColors() DisplayMode:%d Colors:%d Grays:%d"), displayMode, colors, grays);
       
  1799 
       
  1800 	TDisplayMode	expectedDisplayMode;
       
  1801 	if ( CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KDefDisplayMode(), expectedDisplayMode) )
       
  1802 		{
       
  1803 		if ( expectedDisplayMode!=displayMode )
       
  1804 			{
       
  1805 			ERR_PRINTF1(KLogNotExpectedValue);
       
  1806 			SetBlockResult(EFail);
       
  1807 			}
       
  1808 		}
       
  1809 	TInt	expected=0;
       
  1810 	if ( GetIntFromConfig(aSection, KDefModeMaxNumColor(), expected) )
       
  1811 		{
       
  1812 		if ( expected!=colors )
       
  1813 			{
       
  1814 			ERR_PRINTF1(KLogNotExpectedValue);
       
  1815 			SetBlockResult(EFail);
       
  1816 			}
       
  1817 		}
       
  1818 	if ( GetIntFromConfig(aSection, KDefModeMaxNumGray(), expected) )
       
  1819 		{
       
  1820 		if ( expected!=grays )
       
  1821 			{
       
  1822 			ERR_PRINTF1(KLogNotExpectedValue);
       
  1823 			SetBlockResult(EFail);
       
  1824 			}
       
  1825 		}
       
  1826 	}
       
  1827 
       
  1828 void CT_DataWsSession::DoCmdGetColorModeListL(const TDesC& aSection)
       
  1829 	{
       
  1830 	TBool	nullPointer=EFalse;
       
  1831 	GetBoolFromConfig(aSection, KFldNullPointer(), nullPointer);
       
  1832 
       
  1833 	CArrayFixFlat<TInt>*	modeList=NULL;
       
  1834 	if ( !nullPointer )
       
  1835 		{
       
  1836 		modeList=new (ELeave) CArrayFixFlat<TInt>(iColorModeCount);
       
  1837 		}
       
  1838 	CleanupStack::PushL(modeList);
       
  1839 
       
  1840 	TBool	dataOk=ETrue;
       
  1841 	TInt	err=KErrNone;
       
  1842 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  1843 	TInt	inputScreenNo=0;
       
  1844 	if ( GetIntFromConfig(aSection, KInputScrnNo(), inputScreenNo))
       
  1845 		{
       
  1846 		INFO_PRINTF1(_L("RWsSession::GetColorModeList(TInt aScreenNumber, CArrayFixFlat< TInt > *aModeList) call"));
       
  1847 		err=iWsSession->GetColorModeList(inputScreenNo, modeList);
       
  1848 		}
       
  1849 	else
       
  1850 #endif
       
  1851 		{
       
  1852 		INFO_PRINTF1(_L("RWsSession::GetColorModeList(CArrayFixFlat< TInt > *aModeList) call"));
       
  1853 		err=iWsSession->GetColorModeList(modeList);
       
  1854 		}
       
  1855 
       
  1856 	if ( err<KErrNone )
       
  1857 		{
       
  1858 		ERR_PRINTF2(KLogError, err);
       
  1859 		SetError(err);
       
  1860 		}
       
  1861 	else
       
  1862 		{
       
  1863 		if ( dataOk )
       
  1864 			{
       
  1865 			if ( nullPointer )
       
  1866 				{
       
  1867 				iColorModeCount=err;
       
  1868 				}
       
  1869 			else
       
  1870 				{
       
  1871 				INFO_PRINTF2(_L("Color Mode List array count:%d"), modeList->Count());
       
  1872 				for ( TInt index=0; index<modeList->Count(); ++index )
       
  1873 					{
       
  1874 					INFO_PRINTF2(_L("Content of Color Mode List:%d"), (*modeList)[index]);
       
  1875 					}
       
  1876 				}
       
  1877 			}
       
  1878 		}
       
  1879 
       
  1880 	CleanupStack::PopAndDestroy(modeList);
       
  1881 	}
       
  1882 
       
  1883 void CT_DataWsSession::DoCmdSetPointerCursorArea(const TDesC& aSection)
       
  1884 	{
       
  1885 	// Get test data for command input parameter(s)
       
  1886 	TRect	setRectArea;
       
  1887 	if ( !GetRectFromConfig(aSection, KPtrCurPosArea, setRectArea) )
       
  1888 		{
       
  1889 		ERR_PRINTF2(KLogMissingParameter, &KPtrCurPosArea());
       
  1890 		SetBlockResult(EFail);
       
  1891 		}
       
  1892 	else
       
  1893 		{
       
  1894 		// Execute command and log parameters
       
  1895 		INFO_PRINTF1(_L("execute SetPointerCursorPosition(TPoint)"));
       
  1896 		
       
  1897 		TInt	setScrnSizeMode;
       
  1898 		if ( !GetIntFromConfig(aSection, KSetScrnSizeMode, setScrnSizeMode) )
       
  1899 			{
       
  1900 			iWsSession->SetPointerCursorArea(setRectArea);
       
  1901 			}
       
  1902 		else
       
  1903 			{
       
  1904 			iWsSession->SetPointerCursorArea(setScrnSizeMode,setRectArea);
       
  1905 			}
       
  1906 		}
       
  1907 	}
       
  1908 
       
  1909 void CT_DataWsSession::DoCmdPointerCursorArea(const TDesC& aSection)
       
  1910 	{
       
  1911 	// Get test data for command input parameter(s)
       
  1912 	TRect	actual;
       
  1913 	TInt	theScreenSizeMode=0;
       
  1914 	if ( !GetIntFromConfig(aSection, KSetScrnSizeMode, theScreenSizeMode) )
       
  1915 		{
       
  1916 		actual=iWsSession->PointerCursorArea();
       
  1917 		LogRect(_L("PointerCursorArea()"), actual);
       
  1918 		}
       
  1919 	else
       
  1920 		{
       
  1921 		actual=iWsSession->PointerCursorArea(theScreenSizeMode);
       
  1922 		LogRect(_L("PointerCursorArea(TInt)"), actual);
       
  1923 		}
       
  1924 
       
  1925 	TRect	expected;
       
  1926 	if ( !GetRectFromConfig(aSection, KPtrCurPosArea, expected) )
       
  1927 		{
       
  1928 		ERR_PRINTF2(KLogMissingParameter, &KPtrCurPosArea);
       
  1929 		SetBlockResult(EFail);
       
  1930 		}
       
  1931 	else
       
  1932 		{
       
  1933 		if ( actual!=expected )
       
  1934 			{
       
  1935 			ERR_PRINTF1(KLogNotExpectedValue);
       
  1936 			SetBlockResult(EFail);
       
  1937 			}
       
  1938 		}
       
  1939 	}
       
  1940 
       
  1941 
       
  1942 void CT_DataWsSession::DoCmdSetPointerCursorMode(const TDesC& aSection)
       
  1943 	{
       
  1944 	TPointerCursorMode  mode;
       
  1945 	if ( !CT_GraphicsUtil::ReadPointerCursorMode(*this, aSection, KSetPtrCurMode(), mode) )
       
  1946 		{
       
  1947 		ERR_PRINTF2(KLogMissingParameter, &KSetPtrCurMode());
       
  1948 		SetBlockResult(EFail);
       
  1949 		}
       
  1950 	else
       
  1951 		{
       
  1952 		iWsSession->SetPointerCursorMode(mode);
       
  1953 		}
       
  1954 	}
       
  1955 
       
  1956 void CT_DataWsSession::DoCmdSetClientCursorMode(const TDesC& aSection)
       
  1957 	{
       
  1958 	TPointerCursorMode  mode;
       
  1959 	if ( !CT_GraphicsUtil::ReadPointerCursorMode(*this, aSection, KSetCltCurMode(), mode) )
       
  1960 		{
       
  1961 		ERR_PRINTF2(KLogMissingParameter, &KSetCltCurMode());
       
  1962 		SetBlockResult(EFail);
       
  1963 		}
       
  1964 	else
       
  1965 		{
       
  1966 		iWsSession->SetClientCursorMode(mode);
       
  1967 		}
       
  1968 	}
       
  1969 
       
  1970 void CT_DataWsSession::DoCmdPointerCursorMode(const TDesC& aSection)
       
  1971     {
       
  1972 	INFO_PRINTF1(_L("RWsSession::PointerCursorMode() call"));
       
  1973 	TPointerCursorMode	actual=iWsSession->PointerCursorMode();
       
  1974 	INFO_PRINTF2(_L("actual Pointer Cursor Mode:%d"), actual);
       
  1975 
       
  1976 	TPointerCursorMode  expected;
       
  1977 	if ( !CT_GraphicsUtil::ReadPointerCursorMode(*this, aSection, KFldExpected(), expected) )
       
  1978 		{
       
  1979 		ERR_PRINTF2(KLogMissingParameter, &KExpectPtrCursorMode());
       
  1980 		SetBlockResult(EFail);
       
  1981 		}
       
  1982 	else
       
  1983 		{
       
  1984 		if ( actual!=expected )
       
  1985 			{
       
  1986 			ERR_PRINTF1(_L("Pointer cursor mode is not as expected!"));
       
  1987 			SetBlockResult(EFail);
       
  1988 			}
       
  1989 		}
       
  1990 	}
       
  1991 
       
  1992 void CT_DataWsSession::DoCmdSetDefaultSystemPointerCursor(const TDesC& aSection)
       
  1993 	{
       
  1994 	TInt	inputDefCursorNumber=0;
       
  1995 	INFO_PRINTF1(_L("RWsSession::SetDefaultSystemPointerCursor() call"));
       
  1996 
       
  1997 	if ( !GetIntFromConfig(aSection, KInputDefaultCursorNumber(), inputDefCursorNumber))
       
  1998 		{
       
  1999 		ERR_PRINTF2(KLogMissingParameter, &KInputDefaultCursorNumber());
       
  2000 		SetBlockResult(EFail);
       
  2001 		}
       
  2002 	else
       
  2003 		{
       
  2004 		iWsSession->SetDefaultSystemPointerCursor(inputDefCursorNumber);
       
  2005 		}
       
  2006 	}
       
  2007 
       
  2008 void CT_DataWsSession::DoCmdClearDefaultSystemPointerCursor()
       
  2009 	{
       
  2010 	INFO_PRINTF1(_L("RWsSession::ClearDefaultSystemPointerCursor() call"));
       
  2011 	iWsSession->ClearDefaultSystemPointerCursor();
       
  2012 	}
       
  2013 
       
  2014 void CT_DataWsSession::DoCmdSetPointerCursorPosition(const TDesC& aSection)
       
  2015 	{
       
  2016 	// Get test data for command input parameter(s)
       
  2017 	TPoint	ptrCurPost;
       
  2018 	if ( !GetPointFromConfig(aSection, KSetPtrCurPosValue, ptrCurPost) )
       
  2019 		{
       
  2020 		ERR_PRINTF2(KLogMissingParameter, &KSetPtrCurPosValue);
       
  2021 		SetBlockResult(EFail);
       
  2022 		}
       
  2023 	else
       
  2024 		{
       
  2025 		// Execute command and log parameters
       
  2026 		INFO_PRINTF1(_L("execute SetPointerCursorPosition(TPoint)"));
       
  2027 		iWsSession->SetPointerCursorPosition(ptrCurPost);
       
  2028 		}
       
  2029 	}
       
  2030 
       
  2031 void CT_DataWsSession::DoCmdPointerCursorPosition(const TDesC& aSection)
       
  2032 	{
       
  2033 	// Get test data for command input parameter(s)
       
  2034 	TPoint	actualPtrCurPost=iWsSession->PointerCursorPosition();
       
  2035 
       
  2036 	TPoint	expectPtrCurPost;
       
  2037 	if ( !GetPointFromConfig(aSection, KTPoint, expectPtrCurPost) )
       
  2038 		{
       
  2039 		ERR_PRINTF2(KLogMissingParameter, &KTPoint);
       
  2040 		SetBlockResult(EFail);
       
  2041 		}
       
  2042 	else
       
  2043 		{
       
  2044 		// Execute command and log parameters
       
  2045 		INFO_PRINTF1(_L("execute SetPointerCursorPosition(TPoint)"));
       
  2046 		if ((expectPtrCurPost.iX!=expectPtrCurPost.iX)||(expectPtrCurPost.iY!=expectPtrCurPost.iY))
       
  2047 				{
       
  2048 				ERR_PRINTF1(_L("The cursor position is not as expected!"));
       
  2049 				SetBlockResult(EFail);
       
  2050 				}
       
  2051 		}
       
  2052 	}
       
  2053 
       
  2054 void CT_DataWsSession::DoCmdSetDefaultFadingParameters(const TDesC& aSection)
       
  2055 	{
       
  2056 	TBool dataOk=ETrue;
       
  2057 	TInt	setBlackMap;
       
  2058 	TInt	setWhiteMap;
       
  2059 	
       
  2060 	if ( !GetIntFromConfig(aSection, KSetDefblackMapFading(), setBlackMap) )
       
  2061 		{
       
  2062 		dataOk=EFalse;
       
  2063 		ERR_PRINTF2(KLogMissingParameter, &KSetDefblackMapFading);
       
  2064 		SetBlockResult(EFail);
       
  2065 		}
       
  2066 
       
  2067 	if ( !GetIntFromConfig(aSection, KSetDefwhiteMapFading(), setWhiteMap) )
       
  2068 		{
       
  2069 		dataOk=EFalse;
       
  2070 		ERR_PRINTF2(KLogMissingParameter, &KSetDefwhiteMapFading);
       
  2071 		SetBlockResult(EFail);
       
  2072 		}
       
  2073 
       
  2074 	if ( dataOk )
       
  2075 		{
       
  2076 		iWsSession->SetDefaultFadingParameters(setBlackMap, setWhiteMap);
       
  2077 		}
       
  2078 	}
       
  2079 
       
  2080 void CT_DataWsSession::DoCmdPrepareForSwitchOff()
       
  2081 	{
       
  2082 	INFO_PRINTF1(_L("RWsSession::PrepareForSwitchOff() call"));
       
  2083 	iWsSession->PrepareForSwitchOff();
       
  2084 	}
       
  2085 
       
  2086 
       
  2087 void CT_DataWsSession::DoCmdSetBufferSizeL(const TDesC& aSection)
       
  2088 	{
       
  2089 	TInt	theBuffersize;
       
  2090 
       
  2091 	if ( !GetIntFromConfig(aSection, KSetBuffer(), theBuffersize) )
       
  2092 		{
       
  2093 		ERR_PRINTF2(KLogMissingParameter, &KSetBuffer);
       
  2094 		SetBlockResult(EFail);
       
  2095 		}
       
  2096 	else
       
  2097 		{
       
  2098 		iWsSession->SetBufferSizeL(theBuffersize);
       
  2099 		INFO_PRINTF1(_L("RWsSession::SetBufferSizeL"));
       
  2100 		}
       
  2101 	}
       
  2102 
       
  2103 void CT_DataWsSession::DoCmdSetMaxBufferSizeL(const TDesC& aSection)
       
  2104 	{
       
  2105 	TInt	theMaxBuffersize;
       
  2106 
       
  2107 	if ( !GetIntFromConfig(aSection, KSetMaxBuffer(), theMaxBuffersize) )
       
  2108 		{
       
  2109 		ERR_PRINTF2(KLogMissingParameter, &KSetBuffer);
       
  2110 		SetBlockResult(EFail);
       
  2111 		}
       
  2112 	else
       
  2113 		{
       
  2114 		iWsSession->SetMaxBufferSizeL(theMaxBuffersize);
       
  2115 		INFO_PRINTF1(_L("RWsSession::SetMaxBufferSizeL"));
       
  2116 		}
       
  2117 	}
       
  2118 
       
  2119 void CT_DataWsSession::DoCmdSetSystemFaded(const TDesC& aSection)
       
  2120 	{
       
  2121 	TBool 	systemFadOffOn;
       
  2122 	TInt	blackMap;
       
  2123 	TInt	whiteMap;
       
  2124 
       
  2125 	if ( !GetBoolFromConfig(aSection, KSetSysFading(), systemFadOffOn) )
       
  2126 		{
       
  2127 		ERR_PRINTF2(KLogMissingParameter, &KSetSysFading());
       
  2128 		SetBlockResult(EFail);
       
  2129 		}
       
  2130 	else
       
  2131 		{
       
  2132 		INFO_PRINTF2(_L("the status of fad window :%d"),systemFadOffOn);
       
  2133 		if(	GetIntFromConfig(aSection, KSetblackMapFading(), blackMap))
       
  2134 			{
       
  2135 			if ( !GetIntFromConfig(aSection, KSetwhiteMapFading(), whiteMap) )
       
  2136 				{
       
  2137 				ERR_PRINTF2(KLogMissingParameter, &KSetwhiteMapFading);
       
  2138 				SetBlockResult(EFail);
       
  2139 				}
       
  2140 			else
       
  2141 				{
       
  2142 				iWsSession->SetSystemFaded(systemFadOffOn,blackMap,whiteMap);
       
  2143 				INFO_PRINTF1(_L("RWsSession::SetSystemFaded"));
       
  2144 				}
       
  2145 			}
       
  2146 		else
       
  2147 			{
       
  2148 			iWsSession->SetSystemFaded(systemFadOffOn);
       
  2149 			INFO_PRINTF1(_L("RWsSession::SetSystemFaded"));
       
  2150 			}
       
  2151 		}
       
  2152 	}
       
  2153 
       
  2154 void CT_DataWsSession::DoCmdSetFocusScreen(const TDesC& aSection)
       
  2155     {
       
  2156 	TInt	theScreenNo;
       
  2157 	if ( !GetIntFromConfig(aSection, KSetFocusScreen(), theScreenNo) )
       
  2158 		{
       
  2159 		ERR_PRINTF2(KLogMissingParameter, &KSetFocusScreen());
       
  2160 		SetBlockResult(EFail);
       
  2161 		}
       
  2162 	else
       
  2163 		{
       
  2164 		iWsSession->SetFocusScreen(theScreenNo);
       
  2165 		INFO_PRINTF1(_L("RWsSession::SetFocusScreen"));
       
  2166 		}
       
  2167 	}
       
  2168 
       
  2169 void CT_DataWsSession::DoCmdGetFocusScreen(const TDesC& aSection)
       
  2170 	{
       
  2171 	TInt 	actual=iWsSession->GetFocusScreen();
       
  2172 	INFO_PRINTF2(_L("RWsSession::GetFocusScreen()=%d"), actual);
       
  2173 
       
  2174 	TInt	expected;
       
  2175 	if ( !GetIntFromConfig(aSection, KFldExpected(), expected) )
       
  2176 		{
       
  2177 		ERR_PRINTF2(KLogMissingParameter, &KFldExpected());
       
  2178 		SetBlockResult(EFail);
       
  2179 		}
       
  2180 	else
       
  2181 		{
       
  2182 		if ( actual!=expected )
       
  2183 			{
       
  2184 			ERR_PRINTF1(_L("GetFocusScreen is not as expected!"));
       
  2185 			SetBlockResult(EFail);
       
  2186 			}
       
  2187 		}
       
  2188 	}
       
  2189 
       
  2190 void CT_DataWsSession::DoCmdClearAllRedrawStores()
       
  2191 	{
       
  2192 	INFO_PRINTF1(_L("RWsSession::ClearAllRedrawStores() call"));
       
  2193 	iWsSession->ClearAllRedrawStores();
       
  2194 	}
       
  2195 
       
  2196 
       
  2197 void CT_DataWsSession::DoCmdLogCommand(const TDesC& aSection)
       
  2198 	{
       
  2199 	RWsSession::TLoggingCommand	inputCommand;
       
  2200 	if ( !CT_GraphicsUtil::ReadLoggingCommand(*this, aSection, KLogCommand(), inputCommand) )
       
  2201 		{
       
  2202 		ERR_PRINTF2(KLogMissingParameter, &KLogCommand());
       
  2203 		SetBlockResult(EFail);
       
  2204 		}
       
  2205 	else
       
  2206 		{
       
  2207 		INFO_PRINTF1(_L("RWsSession::LogCommand() call"));
       
  2208 		iWsSession->LogCommand(inputCommand);
       
  2209 		}
       
  2210 	}
       
  2211 
       
  2212 
       
  2213 void CT_DataWsSession::DoCmdLogMessage(const TDesC& aSection)
       
  2214     {
       
  2215 	TPtrC	theMessage;
       
  2216 
       
  2217 	if ( !GetStringFromConfig(aSection, KLogMessage(), theMessage) )
       
  2218 		{
       
  2219 		ERR_PRINTF2(KLogMissingParameter, &KLogMessage());
       
  2220 		SetBlockResult(EFail);
       
  2221 		}
       
  2222 	else
       
  2223 		{
       
  2224 		INFO_PRINTF1(_L("RWsSession::LogMessage() call"));
       
  2225 		iWsSession->LogMessage(theMessage);
       
  2226 		}
       
  2227 	}
       
  2228 
       
  2229 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS)
       
  2230 void CT_DataWsSession::DoCmdNumberOfScreens(const TDesC& aSection)
       
  2231 	{
       
  2232 	TInt    actual=iWsSession->NumberOfScreens();
       
  2233 	INFO_PRINTF2(_L("NumberOfScreens:%d"), actual);
       
  2234 
       
  2235 	TInt	expected=0;
       
  2236 	if ( !GetIntFromConfig(aSection, KFldExpected(), expected) )
       
  2237 		{
       
  2238 		ERR_PRINTF2(KLogMissingParameter, &KFldExpected());
       
  2239 		SetBlockResult(EFail);
       
  2240 		}
       
  2241 	else
       
  2242 		{
       
  2243 		if ( actual!=expected )
       
  2244 			{
       
  2245 			ERR_PRINTF1(_L("NumberOfScreens is not as expected!"));
       
  2246 			SetBlockResult(EFail);
       
  2247 			}
       
  2248 		}
       
  2249 	}
       
  2250 #else
       
  2251 void CT_DataWsSession::DoCmdNumberOfScreens(const TDesC& /*aSection*/)
       
  2252 	{
       
  2253 	ERR_PRINTF1(_L("SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS Not Supported"));
       
  2254 	SetBlockResult(EFail);
       
  2255 	}
       
  2256 #endif
       
  2257 
       
  2258 void CT_DataWsSession::DoCmdSimulateRawEvent(const TDesC& aSection)
       
  2259 	{
       
  2260 	TBool		dataOk=ETrue;
       
  2261 	TRawEvent	event;
       
  2262 
       
  2263 	TRawEvent::TType	type=TRawEvent::ENone;
       
  2264 	if ( !CT_GraphicsUtil::ReadType(*this, aSection, KFldType(), type) )
       
  2265 		{
       
  2266 		dataOk=EFalse;
       
  2267 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldType());
       
  2268 		SetBlockResult(EFail);
       
  2269 		}
       
  2270 	else
       
  2271 		{
       
  2272 		event.Set(type);
       
  2273 		}
       
  2274 
       
  2275 	TStdScanCode	stdScanCode;
       
  2276 	if ( CT_GraphicsUtil::ReadStdScanCode(*this, aSection, KFldStdScanCode(), stdScanCode) )
       
  2277 		{
       
  2278 		event.Set(type, stdScanCode);
       
  2279 		}
       
  2280 
       
  2281 	TInt	deviceNumber;
       
  2282 	if ( GetIntFromConfig(aSection, KFldDeviceNumber, deviceNumber) )
       
  2283 		{
       
  2284 		event.SetDeviceNumber(deviceNumber);
       
  2285 		}
       
  2286 
       
  2287 	TPoint	pointerPos(0,0);
       
  2288 	if ( GetPointFromConfig(aSection, KFldPos, pointerPos) )
       
  2289 		{
       
  2290 		event.Set(type, pointerPos.iX, pointerPos.iY);
       
  2291 		}
       
  2292 
       
  2293 	TBool	tip;
       
  2294 	if ( GetBoolFromConfig(aSection, KFldTip, tip) )
       
  2295 		{
       
  2296 		event.SetTip(tip);
       
  2297 		}
       
  2298 
       
  2299 	if ( dataOk )
       
  2300 		{
       
  2301 		INFO_PRINTF1(_L("RWsSession::SimulateRawEvent(TRawEvent) call"));
       
  2302 		iWsSession->SimulateRawEvent(event);
       
  2303 		}
       
  2304 	}
       
  2305 
       
  2306 void CT_DataWsSession::DoCmdSimulateKeyEvent(const TDesC& aSection)
       
  2307 	{
       
  2308 	TBool	dataOk=ETrue;
       
  2309 
       
  2310 	TKeyCode	keyCode;
       
  2311 	if ( !CT_GraphicsUtil::ReadKeyCode(*this, aSection, KFldKeyCode(), keyCode) )
       
  2312 		{
       
  2313 		dataOk=EFalse;
       
  2314 		ERR_PRINTF2(KLogMissingParameter, &KFldKeyCode());
       
  2315 		SetBlockResult(EFail);
       
  2316 		}
       
  2317 
       
  2318 	TUint	modifiers=0;
       
  2319 	CT_GraphicsUtil::ReadEventModifier(*this, aSection, KFldModifiers(), modifiers);
       
  2320 
       
  2321 	TInt	repeats=0;
       
  2322 	GetIntFromConfig(aSection, KFldRepeats(), repeats);
       
  2323 
       
  2324 	if ( dataOk )
       
  2325 		{
       
  2326 		TKeyEvent	event;
       
  2327 
       
  2328 		event.iCode=keyCode;
       
  2329 		event.iScanCode=keyCode;
       
  2330 		event.iModifiers=modifiers;
       
  2331 		event.iRepeats=repeats;
       
  2332 		INFO_PRINTF1(_L("RWsSession::SimulateKeyEvent(TKeyEvent) call"));
       
  2333 		iWsSession->SimulateKeyEvent(event);
       
  2334 		}
       
  2335 	}
       
  2336 
       
  2337 /**
       
  2338  Virtual RunL - Called on completion of an asynchronous command
       
  2339  @see MTPActiveCallback
       
  2340  @param aActive Active Object that RunL has been called on
       
  2341  @pre N/A
       
  2342  @post N/A
       
  2343  @leave system wide error code
       
  2344 */
       
  2345 void CT_DataWsSession::RunL(CActive* aActive, const TInt aIndex)
       
  2346 	{
       
  2347 	if ( aActive==iActiveEventReady )
       
  2348 		{
       
  2349 		RunEventReady(aIndex);
       
  2350 		}
       
  2351 	else if ( aActive==iActivePriorityKeyReady )
       
  2352 		{
       
  2353 		RunPriorityKeyReady(aIndex);
       
  2354 		}
       
  2355 	else if ( aActive==iActiveRedrawReady )
       
  2356 		{
       
  2357 		RunRedrawReady(aIndex);
       
  2358 		}
       
  2359 	else
       
  2360 		{
       
  2361 		ERR_PRINTF1(_L("Stray signal"));
       
  2362 		SetBlockResult(EFail);
       
  2363 		}
       
  2364 	DecOutstanding();
       
  2365 	}
       
  2366 
       
  2367 /**
       
  2368  Virtual DoCancel - Request to cancel the asynchronous command
       
  2369  @see - MTPActiveCallback
       
  2370  @param aActive Active Object that DoCancel has been called on
       
  2371  @pre - N/A
       
  2372  @post - N/A
       
  2373  @leave system wide error code
       
  2374 */
       
  2375 void CT_DataWsSession::DoCancel(CActive* aActive, const TInt aIndex)
       
  2376 	{
       
  2377 	if ( aActive==iActiveEventReady )
       
  2378 		{
       
  2379 		DoCancelEventReady(aIndex);
       
  2380 		}
       
  2381 	else if ( aActive==iActivePriorityKeyReady )
       
  2382 		{
       
  2383 		DoCancelPriorityKeyReady(aIndex);
       
  2384 		}
       
  2385 	else if ( aActive==iActiveRedrawReady )
       
  2386 		{
       
  2387 		DoCancelRedrawReady(aIndex);
       
  2388 		}
       
  2389 	else
       
  2390 		{
       
  2391 		ERR_PRINTF1(_L("Stray signal"));
       
  2392 		SetBlockResult(EFail);
       
  2393 		}
       
  2394 	DecOutstanding();
       
  2395 	}
       
  2396 
       
  2397 void CT_DataWsSession::RunEventReady(const TInt aIndex)
       
  2398 	{
       
  2399 	TInt	err=iActiveEventReady->iStatus.Int();
       
  2400 	INFO_PRINTF2(_L("RunEventReady %d"), err);
       
  2401 	if ( err!=KErrNone )
       
  2402 		{
       
  2403 		ERR_PRINTF2(_L("RunL Error %d"), err);
       
  2404 		SetAsyncError(aIndex, err);
       
  2405 		}
       
  2406 	}
       
  2407 
       
  2408 void CT_DataWsSession::DoCancelEventReady(const TInt /*aIndex*/)
       
  2409 	{
       
  2410 	}
       
  2411 
       
  2412 void CT_DataWsSession::RunPriorityKeyReady(const TInt aIndex)
       
  2413 	{
       
  2414 	TInt	err=iActivePriorityKeyReady->iStatus.Int();
       
  2415 	INFO_PRINTF2(_L("RunPriorityKeyReady %d"), err);
       
  2416 	if ( err!=KErrNone )
       
  2417 		{
       
  2418 		ERR_PRINTF2(_L("RunL Error %d"), err);
       
  2419 		SetAsyncError(aIndex, err);
       
  2420 		}
       
  2421 	}
       
  2422 
       
  2423 void CT_DataWsSession::DoCancelPriorityKeyReady(const TInt /*aIndex*/)
       
  2424 	{
       
  2425 	}
       
  2426 
       
  2427 void CT_DataWsSession::RunRedrawReady(const TInt aIndex)
       
  2428 	{
       
  2429 	TInt	err=iActiveRedrawReady->iStatus.Int();
       
  2430 	INFO_PRINTF2(_L("RunRedrawReady %d"), err);
       
  2431 	if ( err!=KErrNone )
       
  2432 		{
       
  2433 		ERR_PRINTF2(_L("RunL Error %d"), err);
       
  2434 		SetAsyncError(aIndex, err);
       
  2435 		}
       
  2436 	}
       
  2437 
       
  2438 void CT_DataWsSession::DoCancelRedrawReady(const TInt /*aIndex*/)
       
  2439 	{
       
  2440 	}