sysanadatacapture/piprofiler/piprofiler/plugins/BUPplugin/src/BupPlugin.cpp
changeset 2 6a82cd05fb1e
parent 1 3ff3fecb12fe
equal deleted inserted replaced
1:3ff3fecb12fe 2:6a82cd05fb1e
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18  
       
    19 #include "BupPlugin.h"	
       
    20 #include <piprofiler/EngineUIDs.h>
       
    21 
       
    22 #include <w32std.h> 	// key eventtien kuunteluun
       
    23 #include <apgwgnam.h> 	// for CApaWindowGroupName
       
    24 	
       
    25 // LITERALS
       
    26 _LIT8(KEnabled, "enabled");
       
    27 _LIT8(KBracketOpen, "[");
       
    28 _LIT8(KBracketClose, "]");
       
    29 _LIT8(KSettingItemSeparator, "=");
       
    30 
       
    31 /*
       
    32  *	
       
    33  *	class CBupPlugin implementation
       
    34  * 
       
    35  */
       
    36 
       
    37 CBupPlugin* CBupPlugin::NewL(const TUid /*aImplementationUid*/, TAny* /*aInitParams*/)
       
    38 	{
       
    39 	LOGTEXT(_L("CBupPlugin::NewL() - entry"));
       
    40     CBupPlugin* self = new (ELeave) CBupPlugin();
       
    41     CleanupStack::PushL( self );
       
    42     self->ConstructL();
       
    43     CleanupStack::Pop();
       
    44 	LOGTEXT(_L("CBupPlugin::NewL() - exit"));
       
    45     return self;
       
    46 	}
       
    47 
       
    48 CBupPlugin::CBupPlugin() :
       
    49 	iVersionDescriptor(&(this->iVersion[1]),0,19), 	
       
    50 	iSamplerType(PROFILER_USER_MODE_SAMPLER)
       
    51 	{
       
    52 	iSamplerId = PROFILER_BUP_SAMPLER_ID;
       
    53     iEnabled = EFalse;
       
    54 	LOGTEXT(_L("CBupPlugin::CBupPlugin() - konstruktori"));
       
    55 	}
       
    56 
       
    57 void CBupPlugin::ConstructL() 
       
    58 	{
       
    59 	LOGTEXT(_L("CBupPlugin::ConstructL() - entry"));
       
    60 	
       
    61 	// initiate sampler attributes array
       
    62 	iSamplerAttributes = new(ELeave) CArrayFixFlat<TSamplerAttributes>(1); // only one sampler
       
    63 	
       
    64 	// insert default attributes to array
       
    65 	InitiateSamplerAttributesL();
       
    66 	
       
    67 	LOGTEXT(_L("CBupPlugin::ConstructL() - exit"));
       
    68 	}
       
    69 
       
    70 
       
    71 CBupPlugin::~CBupPlugin()
       
    72 	{
       
    73 	LOGTEXT(_L("CBupPlugin::~CBupPlugin() - entry"));
       
    74 	if(iButtonListener)
       
    75 	    {
       
    76 	    // check if button listener still running
       
    77 	    if(Enabled())
       
    78 	        {
       
    79 	        // stop profiling
       
    80 	        iButtonListener->Stop();
       
    81 	        }
       
    82         delete iButtonListener;
       
    83 	    }
       
    84 	
       
    85 	if(iSamplerAttributes)
       
    86 	    {
       
    87 	    iSamplerAttributes->Reset();
       
    88 	    }
       
    89     delete iSamplerAttributes;
       
    90 	
       
    91 	LOGTEXT(_L("CBupPlugin::~CBupPlugin() - exit"));
       
    92 	}
       
    93 
       
    94 TUid CBupPlugin::Id(TInt /*aUid*/) const
       
    95 	{
       
    96     LOGSTRING2("CBupPlugin::Id():0x%X", KSamplerBupPluginUid.iUid );
       
    97     return KSamplerBupPluginUid;
       
    98 	}
       
    99 
       
   100 void CBupPlugin::InitiateSamplerAttributesL()
       
   101     {
       
   102     // create sampler attribute container
       
   103     TSamplerAttributes attr(KSamplerBupPluginUid.iUid,
       
   104             KBUPShortName(),
       
   105             KBUPLongName(),
       
   106             KBUPDescription(),
       
   107             -1,
       
   108             ETrue,
       
   109             EFalse,
       
   110             0); // default item count
       
   111     this->iSamplerAttributes->AppendL(attr);
       
   112     }
       
   113 
       
   114 // returns setting array
       
   115 void CBupPlugin::GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes)
       
   116     {
       
   117     // append my own attributes to complete array, requested by profiler engine
       
   118     aAttributes->AppendL(iSamplerAttributes->At(0));
       
   119     }
       
   120 
       
   121 TInt CBupPlugin::SetAttributesL(TSamplerAttributes aAttributes)
       
   122     {
       
   123     TSamplerAttributes attr;
       
   124 
       
   125     attr = iSamplerAttributes->At(0);
       
   126     // if UIDs match replace the old 
       
   127     if(attr.iUid == aAttributes.iUid)
       
   128         {
       
   129         // replace the old attribute container
       
   130         iSamplerAttributes->Delete(0);
       
   131         iSamplerAttributes->InsertL(0, aAttributes);
       
   132         return KErrNone;
       
   133         }
       
   134     return KErrNotFound;
       
   135     }
       
   136 
       
   137 /* 
       
   138  * Method for parsing and transforming text array settings into TSamplerAttributes (per each sub sampler),
       
   139  * called by CSamplerController class
       
   140  * 
       
   141  * @param array of raw text setting lines, e.g. [gpp]\nenabled=true\nsampling_period_ms=1\n
       
   142  */
       
   143 //void CGeneralsPlugin::ParseSettingsText(CDesC8ArrayFlat* aRawSettings)
       
   144 TInt CBupPlugin::ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aAllSettingsArray)
       
   145     {
       
   146     // local literals
       
   147     _LIT8(KBUPShort, "bup");
       
   148 
       
   149     TInt err(KErrNone);
       
   150     TBuf8<16> samplerSearchName;
       
   151     samplerSearchName.Copy(KBUPShort);
       
   152     
       
   153     // get sampler specific settings  
       
   154     err = DoSetSamplerSettings(aAllSettingsArray, samplerSearchName, 0);
       
   155     
       
   156     // returns KErrNone if settings found, otherwise KErrNotFound
       
   157     return err;
       
   158     }
       
   159 
       
   160 TInt CBupPlugin::DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex)
       
   161     {
       
   162     // 
       
   163     TBuf8<16> samplerSearch;
       
   164     samplerSearch.Copy(KBracketOpen);
       
   165     samplerSearch.Append(aSamplerName);
       
   166     samplerSearch.Append(KBracketClose);
       
   167     
       
   168     // read a line
       
   169     for (TInt i(0); i<aAllSettings->MdcaCount(); i++)
       
   170         {
       
   171         // check if this line has a setting block start, i.e. contains [xxx] in it
       
   172         if (aAllSettings->MdcaPoint(i).CompareF(samplerSearch) == 0)
       
   173             {
       
   174             // right settings block found, now loop until the next block is found
       
   175             for(TInt j(i+1);j<aAllSettings->MdcaCount();j++)
       
   176                 {
       
   177                 // check if the next settings block was found
       
   178                 if(aAllSettings->MdcaPoint(j).Left(1).CompareF(KBracketOpen) != 0)
       
   179                     {
       
   180                     // save found setting value directly to its owners attributes
       
   181                     SaveSettingToAttributes(aAllSettings->MdcaPoint(j), aIndex);
       
   182                     }
       
   183                 else
       
   184                     {
       
   185                     // next block found, return KErrNone
       
   186                     return KErrNone;
       
   187                     }
       
   188                 }
       
   189             }
       
   190         }
       
   191     
       
   192     return KErrNotFound;
       
   193     }
       
   194 
       
   195 /**
       
   196  * Method for setting a specific descriptor (from settings file) to attribute structure
       
   197  * 
       
   198  * @param aSetting  
       
   199  * @param aName  
       
   200  */
       
   201 void CBupPlugin::SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex)
       
   202     {
       
   203     // find the equal mark from the setting line
       
   204     TInt sepPos = aSetting.Find(KSettingItemSeparator);
       
   205     // check that '=' is found
       
   206     if (sepPos > 0)
       
   207         {
       
   208         // check that the element matches
       
   209         if (aSetting.Left(sepPos).CompareF(KEnabled) == 0)
       
   210             {
       
   211             TBool en;
       
   212             CSamplerPluginInterface::Str2Bool(aSetting.Right(aSetting.Length()-sepPos-1), en);
       
   213             if(iSamplerAttributes->At(aIndex).iEnabled != en)
       
   214                 {
       
   215                 iSamplerAttributes->At(aIndex).iEnabled = en;
       
   216                 }
       
   217             }
       
   218         }
       
   219     }
       
   220 
       
   221 TInt CBupPlugin::GetSamplerType()
       
   222 	{
       
   223 	return iSamplerType;
       
   224 	}
       
   225 
       
   226 void CBupPlugin::GetCaption( TDes& aCaption, TInt /*aType*/, TInt /*aUid*/ ) const
       
   227     {
       
   228     aCaption.Copy(KBUPShortName);
       
   229     aCaption.TrimRight();
       
   230     LOGSTRING2("CBupPlugin::GetCaptionL() - Plugin name: %S", &aCaption);
       
   231     }
       
   232 
       
   233 TInt CBupPlugin::ResetAndActivateL(CProfilerSampleStream& aStream) 
       
   234 	{
       
   235 	LOGTEXT(_L("CBupPlugin::ResetAndActivate() - entry"));
       
   236 	TInt ret(KErrNone);
       
   237 	
       
   238 	// check if sampler enabled
       
   239 	if(iSamplerAttributes->At(0).iEnabled)
       
   240 	    {
       
   241         // create first the listener instance
       
   242         iButtonListener = CProfilerButtonListener::NewL(this);
       
   243         
       
   244         LOGTEXT(_L("CBupPlugin::ResetAndActivate() - listener created"));
       
   245         
       
   246         iStream = &aStream;
       
   247         TInt length = this->CreateFirstSample();
       
   248         iVersion[0] = (TUint8)length;
       
   249         LOGSTRING2("CBupPlugin::ResetAndActivate() - AddSample, length %d",length);
       
   250         ret = AddSample(iVersion, length+1, 0);
       
   251         if(ret != KErrNone)
       
   252             return ret;
       
   253         
       
   254         // activate button listener
       
   255         ret = iButtonListener->StartL();
       
   256 
       
   257         iEnabled = ETrue;
       
   258         
       
   259         LOGTEXT(_L("CBupPlugin::ResetAndActivate() - exit"));
       
   260 	    }
       
   261 	return ret;
       
   262 
       
   263 	}
       
   264 	
       
   265 TInt CBupPlugin::CreateFirstSample()
       
   266 	{
       
   267 	LOGTEXT(_L("CBupPlugin::CreateFirstSample - entry"));
       
   268 	this->iVersionDescriptor.Zero();
       
   269 	this->iVersionDescriptor.Append(_L8("Bappea_BUP_V"));
       
   270 	this->iVersionDescriptor.Append(PROFILER_BUP_SAMPLER_VERSION);
       
   271 	LOGTEXT(_L("CBupPlugin::CreateFirstSample - exit"));
       
   272 	return (TInt)(this->iVersionDescriptor.Length());
       
   273 	}
       
   274 
       
   275 TInt CBupPlugin::StopSampling() 
       
   276 	{
       
   277 	if(iButtonListener)
       
   278 		{
       
   279 		iButtonListener->Stop();
       
   280 		delete iButtonListener;	// delete listener after every trace
       
   281 		iButtonListener = NULL;
       
   282 		}
       
   283 	
       
   284     // set disabled
       
   285     iEnabled = EFalse;
       
   286 
       
   287 	return KErrNone;
       
   288 	}
       
   289 
       
   290 void CBupPlugin::FillThisStreamBuffer(TBapBuf* /*aBapBuf*/, TRequestStatus& /*aStatus*/)
       
   291 	{
       
   292 	}
       
   293 
       
   294 /*
       
   295  * 
       
   296  * Implementation of class CProfilerButtonListener
       
   297  * 
       
   298  */
       
   299 CProfilerButtonListener::CProfilerButtonListener(CBupPlugin* aSampler) 
       
   300 	{
       
   301 	LOGTEXT(_L("CProfilerButtonListener::CProfilerButtonListener() - konstuktori"));
       
   302 	this->iSampler = aSampler;
       
   303 	iSampleStartTime = 0;
       
   304 	LOGTEXT(_L("CProfilerButtonListener::CProfilerButtonListener() - konstuktori exit"));
       
   305 	}
       
   306 
       
   307 CProfilerButtonListener* CProfilerButtonListener::NewL(CBupPlugin* aSampler)
       
   308 	{
       
   309 	LOGTEXT(_L("CProfilerButtonListener::NewL() - entry"));
       
   310 	CProfilerButtonListener* self = new (ELeave) CProfilerButtonListener(aSampler);
       
   311 	CleanupStack::PushL( self );
       
   312 	self->ConstructL();
       
   313 	CleanupStack::Pop();
       
   314 	LOGTEXT(_L("CProfilerButtonListener::NewL() - exit"));
       
   315 	return self;
       
   316 	}
       
   317 
       
   318 CProfilerButtonListener::~CProfilerButtonListener() 
       
   319 	{
       
   320 	LOGTEXT(_L("CProfilerButtonListener::~CProfilerButtonListener() - entry af"));
       
   321 
       
   322 	if(iMainWindow)
       
   323 		{
       
   324 		LOGTEXT(_L("CProfilerButtonListener::~CProfilerButtonListener(): flushing iWs"));
       
   325 		iWs.Flush();
       
   326 		LOGTEXT(_L("CProfilerButtonListener::~CProfilerButtonListener(): finishing"));
       
   327 		}
       
   328 	delete iMainWindow;
       
   329 	LOGTEXT(_L("CProfilerButtonListener::~CProfilerButtonListener() - exit"));
       
   330 	}
       
   331 	
       
   332 void CProfilerButtonListener::ConstructMainWindowL()
       
   333 	{
       
   334     LOGTEXT(_L("CProfilerButtonListener::ConstructMainWindowL() - Entry"));
       
   335 
       
   336     CWindow* window = new (ELeave) CWindow(this);
       
   337     CleanupStack::PushL( window );
       
   338 	window->ConstructL(TRect(TPoint(0,0), TSize(0,0)));
       
   339     delete iMainWindow;
       
   340     iMainWindow = window;
       
   341     CleanupStack::Pop( window );
       
   342 	
       
   343     LOGTEXT(_L("CProfilerButtonListener::ConstructMainWindowL() - Exit"));
       
   344 	}
       
   345 
       
   346 void CProfilerButtonListener::HandleKeyEventL (TKeyEvent& /*aKeyEvent*/)
       
   347     {
       
   348     LOGTEXT(_L("CProfilerButtonListener::HandleKeyEventL() - Start"));
       
   349     LOGTEXT(_L("CProfilerButtonListener::HandleKeyEventL() - End"));
       
   350 	}
       
   351 
       
   352 
       
   353 TInt CProfilerButtonListener::RunError(TInt aError)
       
   354     {
       
   355     // get rid of everything we allocated
       
   356     // deactivate the anim dll before killing window, otherwise anim dll dies too early
       
   357     iAnim->Deactivate();
       
   358     iAnim->Close();
       
   359 
       
   360     iAnimDll->Close();
       
   361     
       
   362     return aError;
       
   363     }
       
   364 
       
   365 void CProfilerButtonListener::RunL() 
       
   366 	{	
       
   367     // resubscribe before processing new value to prevent missing updates
       
   368 	IssueRequest();
       
   369 	
       
   370 	TInt c = 0;
       
   371 	if(RProperty::Get(KProfilerKeyEventPropertyCat, EProfilerKeyEventPropertySample, c) == KErrNone)
       
   372 		{
       
   373 		// do something with event
       
   374 		LOGSTRING2("CProfilerButtonListener::RunL() - event [%d] received",c);
       
   375 	
       
   376 		iSample[0] = c;
       
   377 		iSample[1] = c >> 8;
       
   378 		iSample[2] = c >> 16;
       
   379 		iSample[3] = c >> 24;
       
   380 		
       
   381 		// Space for GPP sample time		
       
   382 		TUint32 sampleTime = User::NTickCount() - iSampleStartTime; 
       
   383 		LOGSTRING2("CProfilerButtonListener::RunL() - sample time is %d",sampleTime);
       
   384 		
       
   385 		iSample[4] = sampleTime;
       
   386 		iSample[5] = sampleTime >> 8;
       
   387 		iSample[6] = sampleTime >> 16;
       
   388 		iSample[7] = sampleTime >> 24;
       
   389 		
       
   390 		iSampler->AddSample(iSample, 8, 0xb0);
       
   391 		}
       
   392 	}
       
   393 	
       
   394 TInt CProfilerButtonListener::StartL()
       
   395 	{
       
   396 	LOGTEXT(_L("CProfilerButtonListener::StartL() - Activate touch server dll"));
       
   397 	TInt err(KErrNone);
       
   398 	
       
   399 	// get the property value
       
   400 	TInt r = RProperty::Get(KGppPropertyCat, EGppPropertySyncSampleNumber, iSampleStartTime);
       
   401 	if(r != KErrNone)
       
   402 		{
       
   403 		LOGSTRING2("CProfilerButtonListener::StartL() - getting iSyncOffset failed, error %d", r);
       
   404 		}
       
   405 	
       
   406 	iAnimDll = new (ELeave) RAnimDll(iWs);
       
   407 	LOGTEXT(_L("CProfilerButtonListener::StartL() - #1"));
       
   408 	
       
   409 	TParse* fp = new (ELeave) TParse();
       
   410 	CleanupStack::PushL(fp);
       
   411 	fp->Set( KDllName, &KDC_SHARED_LIB_DIR , NULL );    
       
   412 	LOGSTRING2("CProfilerButtonListener::StartL() - touch event server: %S" , &(fp->FullName()));
       
   413 
       
   414 	err = iAnimDll->Load(fp->FullName());
       
   415 	// check if anim dll load failed
       
   416 	if(err != KErrNone)
       
   417 	    {
       
   418         CleanupStack::PopAndDestroy(fp);
       
   419 	    // stop plugin if failed
       
   420 	    iAnimDll->Close();
       
   421 	    return KErrGeneral;
       
   422 	    }
       
   423     CleanupStack::PopAndDestroy(fp);
       
   424  	LOGTEXT(_L("CProfilerButtonListener::StartL() - #2"));
       
   425 
       
   426 	iAnim = new (ELeave) RProfilerTouchEventAnim(*iAnimDll);
       
   427  	LOGTEXT(_L("CProfilerButtonListener::StartL() - #3"));
       
   428 	iAnim->ConstructL(iMainWindow->Window());
       
   429 	
       
   430 	// activate the animation dll for collecting touch and key events
       
   431 	iAnim->Activate();
       
   432 
       
   433 	// wait for a new sample
       
   434 	IssueRequest();
       
   435 	
       
   436 	// hide this window group from the app switcher
       
   437 	iMainWindow->Client()->Group().SetOrdinalPosition(-1);
       
   438 	iMainWindow->Client()->Group().EnableReceiptOfFocus(EFalse);
       
   439 	return KErrNone;
       
   440 	}
       
   441 
       
   442 TInt CProfilerButtonListener::Stop() 
       
   443 	{
       
   444 	LOGTEXT(_L("CProfilerButtonListener::Stop() - enter"));
       
   445 	// deactivate the anim dll before killing window, otherwise anim dll dies too early
       
   446 	iAnim->Deactivate();
       
   447 	iAnim->Close();
       
   448 
       
   449 	iAnimDll->Close();
       
   450 
       
   451 	Cancel();
       
   452 	LOGTEXT(_L("CProfilerButtonListener::Stop() - exit"));
       
   453 	return KErrNone;
       
   454 	}
       
   455 
       
   456 
       
   457 ///////////////////////////////////////////////////////////////////////////////
       
   458 ////////////////////////// CWindow implementation /////////////////////////////
       
   459 ///////////////////////////////////////////////////////////////////////////////
       
   460 
       
   461 CWindow::CWindow(CWsClient* aClient)
       
   462 : iClient(aClient)
       
   463 	{
       
   464     LOGTEXT(_L("CWindow::CWindow()"));
       
   465 	}
       
   466 
       
   467 void CWindow::ConstructL (const TRect& aRect, CWindow* aParent)
       
   468 	{
       
   469 	LOGTEXT(_L("CWindow::ConstructL(): Start"));
       
   470 
       
   471 	// If a parent window was specified, use it; if not, use the window group
       
   472 	// (aParent defaults to 0).
       
   473 	RWindowTreeNode* parent= aParent ? (RWindowTreeNode*) &(aParent->Window()) : &(iClient->iGroup);
       
   474 	iWindow=RWindow(iClient->iWs); // use app's session to window server
       
   475 	User::LeaveIfError(iWindow.Construct(*parent,(TUint32)this));
       
   476 	LOGSTRING2("CWindow::ConstructL(): Start - window handle is: 0x%08x", this);
       
   477 	iRect = aRect;
       
   478 	iWindow.SetExtent(iRect.iTl, iRect.Size()); // set extent relative to group coords
       
   479 	iWindow.Activate(); // window is now active
       
   480 	LOGTEXT(_L("CWindow::ConstructL(): End"));
       
   481 	}
       
   482 
       
   483 
       
   484 CWindow::~CWindow()
       
   485 	{
       
   486     LOGTEXT(_L("CWindow::~CWindow(): Start"));
       
   487 	iWindow.Close(); // close our window
       
   488     LOGTEXT(_L("CWindow::~CWindow(): End"));
       
   489 	}
       
   490 
       
   491 RWindow& CWindow::Window()
       
   492 	{
       
   493     LOGTEXT(_L("CWindow::Window()"));
       
   494 	return iWindow;
       
   495 	}
       
   496 
       
   497 CWindowGc* CWindow::SystemGc()
       
   498 	{
       
   499     LOGTEXT(_L("CWindow::SystemGc()"));
       
   500 	return iClient->iGc;
       
   501 	}
       
   502 
       
   503 /////////////////////////////////////////////////////////////////////////////////////
       
   504 /////////////////////////// CWsClient implementation ////////////////////////////////
       
   505 /////////////////////////////////////////////////////////////////////////////////////
       
   506 CWsClient::CWsClient()
       
   507 : CActive(CActive::EPriorityStandard)
       
   508 	{
       
   509     LOGTEXT(_L("CWsClient::CWsClient()"));
       
   510 	}
       
   511 
       
   512 void CWsClient::ConstructL()
       
   513 	{
       
   514     LOGTEXT(_L("CWsClient::ConstructL() - Start"));
       
   515     TInt r = RProperty::Define(EProfilerKeyEventPropertySample, RProperty::EInt, KAllowAllPolicy, KCapabilityNone);
       
   516     if (r!=KErrAlreadyExists)
       
   517         {
       
   518         User::LeaveIfError(r);
       
   519         }
       
   520     
       
   521 	CActiveScheduler::Add(this);
       
   522 
       
   523 	// attach to 
       
   524 	User::LeaveIfError(iProperty.Attach(KProfilerKeyEventPropertyCat,EProfilerKeyEventPropertySample));
       
   525     
       
   526 	// get a session going
       
   527 	User::LeaveIfError(iWs.Connect());
       
   528 
       
   529 	// construct screen device and graphics context
       
   530 	iScreen=new (ELeave) CWsScreenDevice(iWs); // make device for this session
       
   531 	User::LeaveIfError(iScreen->Construct( 0 )); // and complete its construction
       
   532 	User::LeaveIfError(iScreen->CreateContext(iGc)); // create graphics context
       
   533 
       
   534 	// construct our one and only window group
       
   535 	iGroup=RWindowGroup(iWs);
       
   536 	User::LeaveIfError(iGroup.Construct((TInt)this, EFalse)); // meaningless handle; enable focus
       
   537 	
       
   538 	// construct main window
       
   539 	ConstructMainWindowL();
       
   540 
       
   541 	LOGTEXT(_L("CWsClient::CWsClient() - End"));
       
   542 	}
       
   543 
       
   544 CWsClient::~CWsClient()
       
   545 	{
       
   546     LOGTEXT(_L("CWsClient::~CWsClient() - Start"));
       
   547     
       
   548 	// get rid of everything we allocated
       
   549 	delete iGc;
       
   550 	delete iScreen;
       
   551 	
       
   552 	iGroup.Close();
       
   553 	// finish with window server
       
   554 	iWs.Close();
       
   555 	
       
   556     LOGTEXT(_L("CWsClient::~CWsClient() - Exit"));
       
   557 	}
       
   558 
       
   559 void CWsClient::Exit()
       
   560 	{
       
   561     LOGTEXT(_L("CWsClient::Exit() - Start"));
       
   562 
       
   563 	// destroy window group
       
   564 	iGroup.Close();
       
   565 	// finish with window server
       
   566     iProperty.Close();
       
   567 	iWs.Close();
       
   568     LOGTEXT(_L("CWsClient::Exit() - Exit"));
       
   569 	}
       
   570 
       
   571 void CWsClient::IssueRequest()
       
   572 	{
       
   573     LOGTEXT(_L("CWsClient::IssueRequest() - Start"));
       
   574     iProperty.Subscribe( iStatus );
       
   575     SetActive(); // so we're now active
       
   576     LOGTEXT(_L("CWsClient::IssueRequest() - Exit"));
       
   577 	}
       
   578 
       
   579 void CWsClient::DoCancel()
       
   580 	{
       
   581     LOGTEXT(_L("CWsClient::DoCancel() - Start"));
       
   582 	// clean up the sample property
       
   583     iProperty.Cancel();
       
   584     iProperty.Close();
       
   585     LOGTEXT(_L("CWsClient::DoCancel() - Exit"));
       
   586 	}
       
   587 
       
   588 void CWsClient::ConstructMainWindowL()
       
   589 	{
       
   590     LOGTEXT(_L("CWsClient::ConstructMainWindowL()"));
       
   591 	}
       
   592