×

Discussion Board

Results 1 to 13 of 13

Hybrid View

  1. #1
    Regular Contributor
    Join Date
    May 2008
    Posts
    90

    Question RWsSession in a console/headless application

    Hi,

    I'm working on a background application and have to use RWsSession to send key events to another application, but it doesn't seem to work. I tried several methods suggested in the wiki (http://wiki.forum.nokia.com/index.ph...ate_a_keypress) with no luck. I tried the TKeyEvent and both TRawEvent approaches (using UserSvr and RWsSession), but neither produced any results.

    The TKeyEvent approach, that I tried last, behaves in an interesting way: I connect to the WS using the following code:
    RWsSession ws;
    UserLeaveIfError( ws.Connect() );
    The code does not leave. Then I send the event using ws.SimulateEvent and in the end I call ws.Flush() which never returns. Also int the other experiments I found that RWsSession.Close() would do the same: when I pushed it to the cleanup stack using CleanupClosePushL, the PopAndDestroy() call would block infinitely.

    Is there any special magic that has to be done so that I can connect to the window server from a non-gui application? The WS is running, because I'm starting the application from the phone menu (it has a launcher icon both in the emulator and on the real phone), so I'm not running the whole emulator in console mode, just this app.

    It's quite strange that the RWsSession seems to connect without any problem and then it freezes. Maybe it needs some active object magic?

    Thanks,
    Laszlo

  2. #2
    Registered User
    Join Date
    Oct 2007
    Posts
    20

    Re: RWsSession in a console/headless application

    Maybe you need SwEvent capabilities.

  3. #3
    Regular Contributor
    Join Date
    May 2008
    Posts
    90

    Re: RWsSession in a console/headless application

    Sure and I have it. The SIS is self signed and does have SwEvent capability. I guess if there was a problem with it then the SimulateEvent methods would panic or something, but they don't. The problem is explicitly with the Flush and Close calls.

  4. #4
    Registered User
    Join Date
    Mar 2005
    Posts
    29

    Re: RWsSession in a console/headless application

    Although I don't have the solution of your problem, I do experience the same problem once.

    It seems it is quite safe only listening to any window events in a console application using RWsSession. But, that is all. ;-)

  5. #5
    Regular Contributor
    Join Date
    May 2008
    Posts
    90

    Re: RWsSession in a console/headless application

    Thanks. It doesn't sound too good. II wonder if it's a bug or just a shortcoming of the documentation.

  6. #6
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    217

    Re: RWsSession in a console/headless application

    Hi Atleta,

    In my console exe i had a scenario to simulate right soft key and I am using code below which works perfect on my N95. Not sure if this will help you but here it is for your reference.

    Code:
    void MyClass::RightSoftKeyPressL()
    {
    
        TWsEvent        event;
        RWsSession      wsSession;
    
        User::LeaveIfError(wsSession.Connect());
    
        TInt id = wsSession.GetFocusWindowGroup();
        event.SetType(EEventKey);
        event.SetTimeNow();
        event.Key()->iCode = EKeyDevice1;
        event.Key()->iModifiers = 0;
        event.Key()->iRepeats = 0;
        event.Key()->iScanCode = EStdKeyDevice1;
        wsSession.SendEventToWindowGroup(id, event);
        wsSession.Close();
    
    }

Similar Threads

  1. AutoStart My application at bootup
    By prakashs in forum Symbian
    Replies: 7
    Last Post: 2009-03-24, 10:06
  2. Replies: 37
    Last Post: 2008-07-16, 05:17
  3. Replies: 1
    Last Post: 2008-05-08, 12:32
  4. 3250: Too many SMSs received crash the application
    By kewldeep in forum Mobile Java General
    Replies: 4
    Last Post: 2007-01-27, 00:00
  5. Replies: 0
    Last Post: 2005-05-28, 10:20

Posting Permissions

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