×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    129

    Switch off event not capturing.

    Hi I have implemented following class derived from CActive for capturing switch off event.
    But its not working.
    When I switch off the emulator, the RunL() doesnt execute.
    Please help...

    CSystemEventHandler* CSystemEventHandler::NewL()
    {
    CSystemEventHandler* self = CSystemEventHandler::NewLC();
    CleanupStack::Pop(self);
    return self;
    }

    CSystemEventHandler* CSystemEventHandler::NewLC()
    {
    CSystemEventHandler* self = new ( ELeave ) CSystemEventHandler;
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
    }

    CSystemEventHandler::CSystemEventHandler():CActive(EPriorityStandard)
    {
    }

    CSystemEventHandler::~CSystemEventHandler()
    {
    Cancel();
    iWs.Close();
    }

    void CSystemEventHandler::ConstructL()
    {
    CActiveScheduler::Add(this);
    iWs.Connect();

    StartMonitoring();
    }

    void CSystemEventHandler::StartMonitoring()
    {
    // listen for WSERV events
    iWs.EventReady(&iStatus);
    SetActive();
    }

    void CSystemEventHandler::RunL()
    {
    if (iStatus.Int() == KErrNone)
    {
    TWsEvent event;
    iWs.GetEvent(event);
    switch(*(TApaSystemEvent*)(event.EventData()))
    {
    case EApaSystemEventSecureShutdown:

    // do things here
    break;
    default:
    break;
    }
    }
    StartMonitoring();
    }

    void CSystemEventHandler:oCancel()
    {
    iWs.EventReadyCancel();
    }

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: Switch off event not capturing.

    Hi,

    check this post:
    http://discussion.forum.nokia.com/fo...d.php?p=518654

    I have fight with the shutdown issue for some time. The background and the reason for capturing it was that in some cases it is good client behavior while being connected to the IMS system it sends something which is called SIP deregister message, when being phone shutted down.

    You have to understand that there is limited time to handle this and using the asynchronous callbacks (Active Scheduler) in the main appication thread we were able to catch around 10% of shutdown events (tested approx. 50 times). When I have separated the code in the standalone EXE file, together with increasitng the priority and using the synchronous WaitForRequest() method I was able to chatch approx. 80-90% of all shutdown events.

    BR
    STeN

  3. #3
    Regular Contributor
    Join Date
    Jul 2008
    Posts
    179

    Re: Switch off event not capturing.

    Hi,

    Use
    TKeyEvent::iCode

    TKeyCode for Switch Off key is EKeyDevice2.

Similar Threads

  1. error PRJ0019 error while creating sis file
    By mrshine in forum Symbian
    Replies: 3
    Last Post: 2008-10-17, 17:16
  2. How to capture phone switch off event
    By NevePankaj in forum Symbian
    Replies: 9
    Last Post: 2008-08-07, 11:01
  3. Catching device switch off event.
    By vaibhavjain in forum Symbian
    Replies: 5
    Last Post: 2008-07-13, 18:44
  4. CLogEvent problem
    By silviuccia in forum Symbian
    Replies: 2
    Last Post: 2006-12-22, 15:28
  5. Switch on event on Nokia 9500
    By acvwieringen in forum Symbian
    Replies: 2
    Last Post: 2005-02-04, 13:44

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •