Exemple #1
0
hsError pfPatcherWorker::Run()
{
    // So here's the rub:
    // We have one or many manifests in the fRequests deque. We begin issuing those requests one-by one, starting here.
    // As we receive the answer, the NetCli thread populates fQueuedFiles and pings the fFileSignal semaphore, then issues the next request...
    // In this non-UI/non-Net thread, we do the stutter-prone/time-consuming IO/hashing operations. (Typically, the UI thread == Net thread)
    // As we find files that need updating, we add them to fRequests.
    // If there is no net request from ME when we find a file, we issue the request
    // Once a file is downloaded, the next request is issued.
    // When there are no files in my deque and no requests in my deque, we exit without errors.

    PatcherLogWhite("--- Patch Started (%i requests) ---", fRequests.size());
    fStarted = true;
    IssueRequest();

    // Now, work until we're done processing files
    do {
        fFileSignal.Wait();

        hsTempMutexLock fileLock(fFileMut);
        if (!fQueuedFiles.empty()) {
            ProcessFile();
            continue;
        }

        // This makes sure both queues are empty before exiting.
        if (!fRequestActive)
            if(!IssueRequest())
                break;
    } while (fStarted);

    EndPatch(kNetSuccess);
    return hsOK;
}
void TeamWorkApi::GetProjects(){
   typeCurrentRequest = TypeOfRequest::TmpmGetProjects;
   if( !bMultiPage )
      hashTempProjects.clear();

   IssueRequest( "/projects.xml" );
}
// ---------------------------------------------------------------------------
// CEventChannel::OpenChannel()
// ?implementation_description
// ---------------------------------------------------------------------------
//
TInt CEventChannel::OpenChannel()
	{
	TBuf<16> location;
    location.Copy( iChannelInfo.iLocation );
	COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::OpenChannel() - %S" ), &location ) );
	
	TInt err( KErrNone );
	
	if( iChannelState == EChannelIdle )
	    {
	    COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::OpenChannel() iChannelState = EChannelOpening" ) ) );
	    iChannelState = EChannelOpening;
	    IssueRequest();
	    
	    RProperty::Set( KPSUidSensrvTest, KSensrvLatestOpenedChannel, iChannelInfo.iChannelId );
	    }
	else
	    {
	    COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::OpenChannel() Incorrect channel state" ) ) );
	    err = KErrGeneral;
	    }
	    
				
	COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::OpenChannel() - Return %d" ), err ) );
	return err;
	}
// ----------------------------------------------------------------------------------
// CSSYChannel::StopChannelDataL()
// ----------------------------------------------------------------------------------
// 
void CSSYChannel::StopChannelDataL( const TSensrvChannelId aChannelId )
    {
    SSY_TRACE_IN();
    SSY_TRACE( EExtended, "ORIENTATIONSSY::ChannelId %d", iChannelInfo.iChannelId ); 

    if ( ChannelId() != aChannelId )
        {
        SSY_TRACE( EError, "ORIENTATIONSSY::ERROR: StartChannelDataL wrong channelId!" );
        User::Leave( KErrArgument );
        }

    if ( iChannelState & KChannelCanBeStopped )
        {
        iOrientationHandler->StopListeningL();
        SetChannelState( EChannelStopListening );
        IssueRequest();
        }
    else
        {
        SSY_TRACE( EError, "ORIENTATIONSSY:ERROR: Trying to stop listening a channel that is not listened! channelId: %d, state: %S",
                   aChannelId,
                   ConvertChannelStateIntoString( iChannelState ) );

        User::Leave( KErrGeneral );
        }

    SSY_TRACE_OUT();
    }
// ----------------------------------------------------------------------------------
// CSSYChannel::ForceBufferFilledL()
// ----------------------------------------------------------------------------------
// 
void CSSYChannel::ForceBufferFilledL( const TSensrvChannelId aChannelId )
    {
    SSY_TRACE_IN();
    SSY_TRACE( EExtended, "ORIENTATIONSSY:ChannelId %d", iChannelInfo.iChannelId ); 

    if ( ChannelId() != aChannelId )
        {
        SSY_TRACE( EError, "ORIENTATIONSSY:ERROR: StartChannelDataL wrong channelId!" );
        User::Leave( KErrArgument );
        }

    if( iChannelState & KChannelCanBeFilled )
        {
        SetChannelState( EChannelForceBufferFilled );
        IssueRequest();
        }
    else
        {
        SSY_TRACE( EError, "ORIENTATIONSSY:ERROR: ForceBufferFilledL called in incorrected state! channelId: %d, state: %S",
                   aChannelId,
                   ConvertChannelStateIntoString( iChannelState ) );

        User::Leave( KErrGeneral );
        }

    SSY_TRACE_OUT();
    }
// ----------------------------------------------------------------------------------
// CSSYChannel::OpenChannel()
// ----------------------------------------------------------------------------------
// 
TInt CSSYChannel::OpenChannel()
	{
	SSY_TRACE_IN();
	SSY_TRACE( EExtended, "ORIENTATIONSSY:ChannelId %d", iChannelInfo.iChannelId ); 

	TInt err( KErrNone );

	if ( iChannelState & KChannelCanBeOpened )
	    {
        TRAP( err, iOrientationHandler->OpenChannelL() );
        if ( err == KErrNone )
            {
            SetChannelState( EChannelOpening );
            IssueRequest();
            }
	    }
	else
	    {	    
        SSY_TRACE( EExtended, "ORIENTATIONSSY:ERROR: Trying to open a channel in a wrong state! channelId: %d, state: %S",
                   iChannelInfo.iChannelId,
                   ConvertChannelStateIntoString( iChannelState ) );

	    err = KErrGeneral;
	    }

	SSY_TRACE_OUT();
	return err;
	}
// --------------------------------------------------------------------------
// Event ready in window server event queue
// --------------------------------------------------------------------------
void CAknCompaSrvWsEventHandler::RunL()
    {
    // Window server event queue read to purge it in case wsrv sends
    // something. As we dont have window group created this is probably
    // unneccesary as there seem to be no events.
    TWsEvent wsEvent;
    iWsSession.GetEvent(wsEvent);
    IssueRequest();
    }
void plResPatcher::Start()
{
    hsAssert(!fPatching, "Too many calls to plResPatcher::Start");
    fPatching = true;
    PatcherLog(kHeader, "--- Patch Started (%i requests) ---", fRequests.size());
    fProgress = plProgressMgr::GetInstance()->RegisterOperation(0.0, "Checking for updates...",
        plProgressMgr::kUpdateText, false, true);
    IssueRequest();
}
// ---------------------------------------------------------------------------
// CCsConversationCacheHelper::HandleProcessConversationL()
// Process Conversation and update cache
// ---------------------------------------------------------------------------
//
void CCsConversationCacheHelper::HandleProcessConversationL()
{
    iConversationEvent = GetNextEvent();
    // check to see if all the events are consumed
    // then mark cache as caching done..
    if (!iConversationEvent)
    {
        iConversationCache->CachingCompletedL();
        return;
    }

    CCsConversationEntry* conEntry =
            iConversationEvent->ClientConversation()->GetConversationEntry();

    //handle add, modify events
    if (iConversationEvent->Event() != KConversationEventDelete)
    {
        TUint8 SpecialId = NeedsSpecialProcessing(conEntry);

        if (SpecialId)
        {
            // this is for draft(unlnown)/BT/IR processing            
            iState = ECsSpecialConversation;
        }
        // check only if contact is a valid address
        else if (conEntry->Contact())
        {
            iCurrentConversationIndex
                    = iConversationCache->FindConversation(* (conEntry->Contact()));
            if (iCurrentConversationIndex != KErrNotFound)
            {
                iState = ECsConversationFoundInCache;
            }
            else
            {
                iState = ECsResolveConversation;
            }
        }
        else
        {
            // this is when contact number is NULL
            // delete the entry from temp list
            DeleteEvent(*iConversationEvent);
            iState = ECsProcessConversation;
        }
    }
    else
    {
        //handle delete event
        DeleteConversationEntryL(conEntry);
        DeleteEvent(*iConversationEvent);
        iState = ECsProcessConversation;
    }
    //move to other state
    IssueRequest();
}
Exemple #10
0
void pfPatcherWorker::ProcessFile()
{
    do {
        NetCliFileManifestEntry& entry = fQueuedFiles.front();

        // eap sucks
        plFileName clName = plString::FromWchar(entry.clientName);
        plString dlName = plString::FromWchar(entry.downloadName);

        // Check to see if ours matches
        plFileInfo mine(clName);
        if (mine.FileSize() == entry.fileSize) {
            plMD5Checksum cliMD5(clName);
            plMD5Checksum srvMD5;
            srvMD5.SetFromHexString(plString::FromWchar(entry.md5, 32).c_str());

            if (cliMD5 == srvMD5) {
                WhitelistFile(clName, false);
                fQueuedFiles.pop_front();
                continue;
            }
        }

        // It's different... but do we want it?
        if (fFileDownloadDesired) {
            if (!fFileDownloadDesired(clName)) {
                PatcherLogRed("\tDeclined '%S'", entry.clientName);
                fQueuedFiles.pop_front();
                continue;
            }
        }

        // If you got here, they're different and we want it.
        PatcherLogYellow("\tEnqueuing '%S'", entry.clientName);
        plFileSystem::CreateDir(plFileName(clName).StripFileName());

        // If someone registered for SelfPatch notifications, then we should probably
        // let them handle the gruntwork... Otherwise, go nuts!
        if (fSelfPatch) {
            if (clName == plFileSystem::GetCurrentAppPath().GetFileName()) {
                clName += ".tmp"; // don't overwrite myself!
                entry.flags |= kSelfPatch;
            }
        }

        pfPatcherStream* s = new pfPatcherStream(this, dlName, entry);
        s->Open(clName, "wb");

        hsTempMutexLock lock(fRequestMut);
        fRequests.push_back(Request(dlName, Request::kFile, s));
        fQueuedFiles.pop_front();

        if (!fRequestActive)
            IssueRequest();
    } while (!fQueuedFiles.empty());
}
// ---------------------------------------------------------------------------
// CEventChannel::DataError()
// ?implementation_description
// ---------------------------------------------------------------------------
//
void CEventChannel::DataError( CSensrvChannel& /*aChannel*/, TSensrvErrorSeverity aError )
    {
    COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::DataReceived(): aError = %d" ), aError ) );
    if( aError == ESensrvErrorSeverityFatal )
        {
        COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::CloseChannel() iChannelState = EChannelClosing" ) ) );
	    iChannelState = EChannelClosing;
	    IssueRequest();
        }
    }
void TeamWorkApi::GetTasks( int idProject, int iPage ){
   typeCurrentRequest = TypeOfRequest::TmpmGetTaskLists;
   idCurrent = idProject;
   if( !bMultiPage )
      hashTempTasks.clear();

   QString strRequest = QString( "/projects/%1/todo_lists.xml?status=all" ).arg( idProject );
   if( 1 < iPage )
      strRequest += QString( "&page=%1" ).arg( iPage );

   IssueRequest( strRequest );
}
// ----------------------------------------------------------------------------------
// CSensrvTestObserver::CSensrvTestObserver() 
// ----------------------------------------------------------------------------------	
CSensrvTestObserver::CSensrvTestObserver(TInt aProcessID) :
  CActive( CActive::EPriorityStandard ),
  iMyProcessID(aProcessID)
	{						
	TInt retval(KErrNone);
	
    retval =  iProperty.Attach( KPSUidSensrvTest, KSensrvTestProcessCommand );
    User::LeaveIfError(retval);           
    
	CActiveScheduler::Add( this );
	
	IssueRequest();
	}
// ---------------------------------------------------------------------------
// From class CActive.
// Gets called when NVRAM has changed
// ---------------------------------------------------------------------------
//
void CDunAtNvramListen::RunL()
    {
    FTRACE(FPrint( _L("CDunAtNvramListen::RunL()") ));
    iNvramHandleState = EDunStateIdle;
    TInt retTemp = iStatus.Int();
    if ( retTemp != KErrNone )
        {
        FTRACE(FPrint( _L("CDunAtNvramListen::RunL() (ERROR) complete (%d)"), retTemp ));
        return;
        }
    iAtCmdExt->BroadcastNvramStatusChange( iNvramBuffer );
    IssueRequest();
    FTRACE(FPrint( _L("CDunAtNvramListen::RunL() complete") ));
    }
/****************************************************************************\
|	Function:	CExampleWsClient::RunL()
 |				Called by active scheduler when an even occurs
 |	Purpose:	Processes events according to their type
 |				For key events: calls HandleKeyEventL() (global to client)
 |				For pointer event: calls HandlePointerEvent() for window
 |                                  event occurred in.
 \****************************************************************************/
void CExampleWsClient::RunL()
	{
	// get the event
	iWs.GetEvent(iWsEvent);
	TInt eventType = iWsEvent.Type();
	// take action on it
	switch (eventType)
		{
		// events global within window group
		case EEventNull:
		case EEventKey:
		case EEventModifiersChanged:
		case EEventKeyUp:
		case EEventKeyDown:
		case EEventFocusLost:
		case EEventFocusGained:
		case EEventSwitchOn:
		case EEventPassword:
		case EEventWindowGroupsChanged:
		case EEventErrorMessage:
			break;
		
			// events local to specific windows
		case EEventPointer:
			{
			CWindow* window = (CWindow*) (iWsEvent.Handle()); // get window
			TPointerEvent& pointerEvent = *iWsEvent.Pointer();
			window->HandlePointerEvent(pointerEvent);
			}
			break;

		case EEventPointerExit:
		case EEventPointerEnter:
			break;
		
		case EEventPointerBufferReady:
			{
			CWindow* window = (CWindow*) (iWsEvent.Handle()); // get window
			window->HandlePointerMoveBufferReady();
			}
			break;

		case EEventDragDrop:
			break;
		
		default:
			break;
		}
	IssueRequest(); // maintain outstanding request
	}
//
// ----------------------------------------------------------------------------------
// CSensrvTestObserver::RunL()
// ----------------------------------------------------------------------------------
void CSensrvTestObserver::RunL()
    {                      
	COMPONENT_TRACE( ( _L( "CSensrvTestObserver::RunL()" ) ) );
	
	TInt retval(KErrNone);	
    TPckgBuf<TSensrvProcessData> buf;
	retval = iProperty.Get( KPSUidSensrvTest, KSensrvTestProcessCommand, buf );	
	User::LeaveIfError(retval);			
	
	//if( iMyProcessID & buf().iProcessID )
	if( iMyProcessID == buf().iProcessID )
	    {
	    //Command is for this process
        switch( buf().iCommand )
            {
            case KProcessCommandOpenChannel:
                {
                DoOpenChannelL( buf().iExpectedResult );
                }
                break;
            
            case KProcessCommandCloseChannel:
                {
                DoCloseChannelL( buf().iExpectedResult );
                }
                break;
            
            case KProcessCommandSetProperty:
                {
                DoSetPropertyL( buf().iExpectedResult, buf().iProperty );
                }
                break;

            case KProcessCommandFindChannel:
                {
                DoFindChannelL();
                }
                break;                
            
            default:
                {
                COMPONENT_TRACE( ( _L( "CSensrvTestObserver::RunL - ERROR: unknown command" ) ) );
                }
                break;
            }
        RProperty::Set( KPSUidSensrvTest, KSensrvTestComplete1, KErrNone );//only KSensrvTestComplete1 supported at the momont
	    }
	
	IssueRequest();
    }        
// ---------------------------------------------------------------------------
// CCsConversationCacheHelper::HandleConversationInCacheL()
// Handle the case when the conversation is found in the cache
// so there is no need for resolving the contact
// ---------------------------------------------------------------------------
//
void CCsConversationCacheHelper::HandleConversationInCacheL()
{
    CCsConversationEntry* conEntry =
            iConversationEvent->ClientConversation()->GetConversationEntry();

    AddConversationEntryL(conEntry, iCurrentConversationIndex);

    DeleteEvent(*iConversationEvent);

    // reset back the conversation index
    iCurrentConversationIndex = KErrNotFound;
    iState = ECsProcessConversation;
    IssueRequest();
}
// -----------------------------------------------------------------------------
// CCbsRecEtelMonitor::RunL
// Becomes active when EPOC Telephony Server has copied a CB message to 
// iMsgData. The message is then given to CCbsRecEtel for
// processing.
// Finally this function re-issues the ReceiveMessage request.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CCbsRecEtelMonitor::RunL()
    {
    CBSLOGSTRING2("CBSSERVER: >>> CCbsRecEtelMonitor::RunL(), iStatus: %d", iStatus.Int() );

    if ( iStatus == KErrNone )
        {
        CCbsMessage* currentMessage = NULL;
        TCbsMessageType msgType( ECbsMessageTypeUnspecified );
		
        CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::RunL(): Calling CreateMessageL()..." );
        currentMessage = iFactory.CreateMessageL( iMsgData, iAttributes, msgType );        
        CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::RunL(): CreateMessageL() called OK." );

        if ( currentMessage )
            {            
            if ( msgType == ECbsMessageLivecast )
                {				
                CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::RunL(): LC message" );

				if ( iNewstickerSupported )
					{
	                // Ownership of currentMessage transferred to iLivecastHandler
	                CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::RunL(): Calling HandleLivecastMessageL()..." );
	                TInt lcResult( KErrNone );
	                TRAP( lcResult, iLivecastHandler.HandleLivecastMessageL( currentMessage ) );                
	                CBSLOGSTRING2("CBSSERVER: CCbsRecEtelMonitor::RunL(): HandleLivecastMessageL() finished, result: %d", lcResult );
					}
                else 
                	{
                	CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::RunL(): NewsSticker is not supported" );
                	}
                }
            else
                {				
                CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::RunL(): Normal message" );

                // Ownership of currentMessage transferred to iEtel
                CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::RunL(): Calling HandleMessageReceivedL()..." );
                TInt result( KErrNone );
                TRAP( result, iEtel.HandleMessageReceivedL( currentMessage ) );                
                CBSLOGSTRING2("CBSSERVER: CCbsRecEtelMonitor::RunL(): HandleMessageReceivedL() finished, result: %d", result );
                }            
            }

        // Renew the request
        IssueRequest();
        }
	CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtelMonitor::RunL()");
    }
EXPORT_C void TestMsvOperationTimer::RunL()
	{
	// display the current progress
	TMsvId temp;	
	TPckgC<TMsvId> paramPack(temp);

	const TDesC8& progBuf = iMsvOperation->ProgressL();	
	paramPack.Set(progBuf);
	TMsvId progress=paramPack();	

	iRTest.Console()->SetPos(0, 10);
	iRTest.Printf(_L("   MessageId %d		\n"),progress);

	IssueRequest();
	};
// ----------------------------------------------------------------------------------
// CSSYChannel::StartChannelDataL()
// ----------------------------------------------------------------------------------
// 
void CSSYChannel::StartChannelDataL( const TSensrvChannelId aChannelId, 
                                     TUint8* aBuffer, 
                                     TInt aCount )
    {
    SSY_TRACE_IN();
    SSY_TRACE( EExtended, "ORIENTATIONSSY:ChannelId %d", iChannelInfo.iChannelId ); 

    if ( ChannelId() != aChannelId )
        {
        SSY_TRACE( EError, "ORIENTATIONSSY:ERROR: StartChannelDataL wrong channelId!" );
        User::Leave( KErrArgument );
        }

    ASSERT_DEBUG_SSY( aBuffer );
    ASSERT_DEBUG_SSY( aCount );

    if ( !aBuffer || !aCount )
        {
        User::Leave( KErrArgument );
        }

    iBuffer = aBuffer;
    iCount  = aCount;

    SSY_TRACE( EExtended, "ORIENTATIONSSY:New data buffer: 0x%x", iBuffer );
    SSY_TRACE( EExtended, "ORIENTATIONSSY:New data count : %d", iCount );

    if ( iChannelState & KChannelCanBeListened )
        {
        iOrientationHandler->StartListeningL();
        SetChannelState( EChannelListening );
        IssueRequest();
        }
    else
        {
        SSY_TRACE( EError, "ORIENTATIONSSY:ERROR: Trying to listen a channel that is not open! channelId: %d, state: %S", 
                   aChannelId,
                   ConvertChannelStateIntoString( iChannelState ) );

        User::Leave( KErrGeneral );
        }

    SSY_TRACE_OUT();
    }
// ---------------------------------------------------------------------------
// CCsConversationCacheHelper::HandleSpecialConversationL()
// Hnadle the case when the conversation has no contact,
// BlueTooth/IrDa messages
// ---------------------------------------------------------------------------
//
void CCsConversationCacheHelper::HandleSpecialConversationL()
{
    CCsConversationEntry* conEntry =
        iConversationEvent->ClientConversation()->GetConversationEntry();

    if (ECsBlueTooth == conEntry->GetType()|| ECsBlueTooth_VCard == conEntry->GetType()|| ECsBlueTooth_VCal == conEntry->GetType())
    {
        AddConversationEntryL(conEntry, KBluetoothMsgsConversationId);
    }
    else
    {
        AddConversationEntryL(conEntry, KUnknownConversationId);
    }
    DeleteEvent(*iConversationEvent);
    iState = ECsProcessConversation;
    IssueRequest();

    PRINT ( _L("CCsConversationCacheHelper::HandleSpecialConversationL") );
}
Exemple #22
0
void CWsRedrawer::RunL()
    {
    // find out what needs to be done in response to the event
    TWsRedrawEvent redrawEvent;
    iClient->iWs.GetRedraw(redrawEvent); // get event
    CWindow* window = (CWindow*) (redrawEvent.Handle()); // get window
    if (window)
        {
        TRect rect = redrawEvent.Rect(); // and rectangle that needs redrawing
        // now do drawing
        iClient->iGc->Activate(window->Window());
        window->Window().BeginRedraw();
        window->Draw(rect);
        window->Window().EndRedraw();
        iClient->iGc->Deactivate();
        }
    // maintain outstanding request
    IssueRequest();
    }
void TeamWorkApi::PostTime( QString strDesc, int iHours, int iMinutes, int idProject, int idTask, bool bIsBillable ){
   typeCurrentRequest = TypeOfRequest::TmpmPostTime;

   QString strData = QString( "<request><time-entry><description>%1</description><person-id>%2</person-id><date>%3</date><hours>%4</hours><minutes>%5</minutes><time>%6</time><isbillable type=\"boolean\">%7</isbillable></time-entry></request>" )
      .arg( strDesc )
      .arg( idPerson )
      .arg( QDate::currentDate().toString( "yyyyMMdd" ) )
      .arg( iHours )
      .arg( iMinutes )
      .arg( "08:00" )
      .arg( bIsBillable ? "yes" : "no" );

   QString strRequest;
   if( idTask )
      strRequest = QString( "/todo_items/%1/time_entries.xml" ).arg( idTask );
   else
      strRequest = QString( "/projects/%1/time_entries.xml" ).arg( idProject );

   IssueRequest( strRequest, strData );
}
void TestUiTimer::RunL()
	{
	// display the current progress
	TImCacheManagerProgress temp;	
	TPckgC<TImCacheManagerProgress> paramPack(temp);

	const TDesC8& progBuf = iCacheManager->ProgressL();	
	paramPack.Set(progBuf);
	TImCacheManagerProgress progress=paramPack();	

    TBuf<128> strProgress;
    strProgress.Format(K_T_MIUT10_PROGRESS, progress.iMessagesProcessed,
                progress.iTotalMessages);
                
    test.Printf(strProgress);
    
    // write progress info to log file, too (to test DEF042552)
    testUtils->WriteComment(strProgress);
 
	IssueRequest();
	};
Exemple #25
0
void CWsClient::ConstructL()
    {
    //  add ourselves to active scheduler 
    CActiveScheduler::Add(this);
    // get a session going
    User::LeaveIfError(iWs.Connect());
    // construct our one and only window group
    iGroup = RWindowGroup(iWs);
    User::LeaveIfError(iGroup.Construct(2, ETrue)); // '2' is a meaningless handle
    // construct screen device and graphics context
    iScreen = new (ELeave) CWsScreenDevice(iWs); // make device for this session
    User::LeaveIfError(iScreen->Construct()); // and complete its construction
    User::LeaveIfError(iScreen->CreateContext(iGc)); // create graphics context
    // construct redrawer
    iRedrawer = new (ELeave) CWsRedrawer;
    iRedrawer->ConstructL(this);
    // construct main window
    ConstructMainWindowL();
    // request first event and start scheduler
    IssueRequest();
    }
// ----------------------------------------------------------------------------------
// CSSYChannel::CloseChannel()
// ----------------------------------------------------------------------------------
// 
TInt CSSYChannel::CloseChannel()
	{
	SSY_TRACE_IN();
	SSY_TRACE( EExtended, "ORIENTATIONSSY:ChannelId %d", iChannelInfo.iChannelId ); 

	TInt err( KErrNone );

	if( iChannelState & KChannelCanBeClosed )
	    {
        TRAP( err, iOrientationHandler->CloseChannelL() ); 
        if ( err == KErrNone )
            {
            iBuffer        = NULL; // Reassigned in data listening
            iCount         = 0;
            iCountReceived = 0;
            SetChannelState( EChannelClosing );
            IssueRequest();
            }
        else
            {
            SSY_TRACE( EError, "ORIENTATIONSSY:ERROR: Trying to close a channel! err: %d, channelId: %d, state: %S",
                       err,
                       iChannelInfo.iChannelId,
                       ConvertChannelStateIntoString( iChannelState ) );
            }
	    }
	else
	    {
	    SSY_TRACE( EExtended, "ORIENTATIONSSY:ERROR: Trying to close a channel in a wrong state! channelId: %d, state: %S",
                   iChannelInfo.iChannelId,
                   ConvertChannelStateIntoString( iChannelState ) );

	    err = KErrGeneral;
	    }

	SSY_TRACE_OUT();
	return err;
	}
void CEventChannel::ForceBufferFilledL( const TSensrvChannelId /*aChannelId*/ )
#endif
    {
    TBuf<16> location;
    location.Copy( iChannelInfo.iLocation );
    COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::ForceBufferFilledL() - %S: channelId = %d" ), &location, aChannelId ) );
    
        
    if( iChannelState == EChannelListening ||
        iChannelState == EChannelBufferFilled ||
        iChannelState == EChannelForceBufferFilled )
        {
        COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::ForceBufferFilledL() iChannelState = EChannelForceBufferFilled" ) ) );
        iChannelState = EChannelForceBufferFilled;
        IssueRequest();
        }
    else
        {
        COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::ForceBufferFilledL() Incorrect channel state: %d - Leave" ), iChannelState ) );
        User::Leave( KErrGeneral );
        }
            
    }
// ---------------------------------------------------------------------------
// CEventChannel::CloseChannel()
// ?implementation_description
// ---------------------------------------------------------------------------
//
TInt CEventChannel::CloseChannel()
	{
	TBuf<16> location;
    location.Copy( iChannelInfo.iLocation );
	COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::CloseChannel() - %S" ), &location ) );
	
	TInt err( KErrNone );
	
	if( iChannelState != EChannelIdle )
	    {
	    COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::CloseChannel() iChannelState = EChannelClosing" ) ) );
	    iChannelState = EChannelClosing;
	    IssueRequest();
	    }
	else
	    {
	    COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::CloseChannel() Incorrect channel state" ) ) );
	    err = KErrGeneral;
	    }
		
    COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::CloseChannel() - Return %d " ),err ) );
	return err;
	}
void CEventChannel::StopChannelDataL( const TSensrvChannelId /*aChannelId*/ )
#endif
    {
    TBuf<16> location;
    location.Copy( iChannelInfo.iLocation );
    COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::StopChannelDataL() - %S: channelId = %d" ), &location, aChannelId ) );
    
    
    if( iChannelState == EChannelListening )
        {
        COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::StopChannelDataL() iChannelState = EChannelStopListening" ) ) );
        iChannelState = EChannelStopListening;
        // Stop data buffering
        IssueRequest();
        
        }
    else
        {
        COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::StopChannelDataL() Incorrect channel state - Leave" ) ) );
        User::Leave( KErrGeneral );
        }
            
    }
void CEventChannel::StartChannelDataL( const TSensrvChannelId /*aChannelId*/, 
                                       TUint8* aBuffer, TInt aCount)
#endif
    {
    TBuf<16> location;
    location.Copy( iChannelInfo.iLocation );
    COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::StartChannelDataL() - %S: channelId = %d" ), &location, aChannelId ) );
    COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::StartChannelDataL() - aBuffer = %x, aCount = %d" ), aBuffer, aCount ) );
    
    
    if( iChannelState == EChannelOpen )
        {
        COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::StartChannelDataL() iChannelState = EChannelListening" ) ) );
        iChannelState = EChannelListening;
        iDataBuffer = aBuffer;
        iMaxDataCount = aCount;
        iCounter = 0;
        
        if( iChannel )
            {
            iChannel->StartDataListeningL( this, 1, 20, 10000 );
            }
        else
            {
            User::Leave( KErrGeneral );
            }
        
        IssueRequest();
        
        }
    else
        {
        COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::StartChannelDataL() Incorrect channel state - Leave" ) ) );
        User::Leave( KErrGeneral );
        }
            
    }