×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Regular Contributor
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340

    Key(s) Simulation "Globally"

    Hello Folks,

    I want to simulate all the keys on the keypad for the Nokia 73 (basically S603rd edition) globally. I am not able to simulate any key other than the "RED" key. The following code works,

    Code:
    RWsSession wsSession = CCoeEnv::Static()->WsSession();
    TKeyEvent keyEvent;
    keyEvent.iCode = EKeyNo;  //member of TKeyCode
    keyEvent.iScanCode = EStdKeyNo;
    keyEvent.iModifiers = 0;
    keyEvent.iRepeats = 0;
    wsSession.SimulateKeyEvent(keyEvent);
    wsSession.Flush();
    Is it not possible to simulate all the keys? If it is, then can someone point me towards a "sane" mapping table for the keys?
    For e.g. KEY: Numeric Key 1 ScanCode: ABC Code = XYZ

    Thanks in advance.
    Regards,
    Sainagakishore Srikantham (Kishore)

    Don't Hope, KNOW!!! ---------- Visit me at http://ssnkishore.blogspot.com ----------

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Key(s) Simulation "Globally"

    Symbian OS v9.1 » Symbian OS reference » C++ component reference » Base E32 » TStdScanCode

  3. #3
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: Key(s) Simulation "Globally"

    Hi,

    Try to debug your application and put a break point in OfferKeyEventL and when you press any key you can find the keycode in debug window.
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  4. #4
    Regular Contributor
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340

    Re: Key(s) Simulation "Globally"

    Quote Originally Posted by kkrish View Post
    Hi,

    Try to debug your application and put a break point in OfferKeyEventL and when you press any key you can find the keycode in debug window.
    Thanks for the reply Krish!

    I have the scancodes I want to simulate. For e.g. the scan code printed when I press the "1" key on the numeric keypad is 49, while the scan code for the same given in e32keys.h is EStdKeyNkp1. Secondly, there is no corresponding value to fill in the iCode member of the TKeyEvent.

    Lastly, the Symbian website is down
    Regards,
    Sainagakishore Srikantham (Kishore)

    Don't Hope, KNOW!!! ---------- Visit me at http://ssnkishore.blogspot.com ----------

  5. #5
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Key(s) Simulation "Globally"

    the link i have given is from SDK help.

  6. #6
    Registered User
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043

    Re: Key(s) Simulation "Globally"

    Hi,
    Implement HandleWsEventL() in your AppUi and when you will debug your application keeping a breakpoint you can get all the codes for all of the keys in numeric keypad. Anyways first check the SDK help link which skumar_rao has provided. You can get that in your SDK help no need for going through web link.
    Maximus
    S60 Developer
    Impossible is nothing

  7. #7
    Registered User
    Join Date
    Dec 2005
    Posts
    1,236

    Re: Key(s) Simulation "Globally"

    Quote Originally Posted by ssn.kishore View Post


    Thanks for the reply Krish!

    I have the scancodes I want to simulate. For e.g. the scan code printed when I press the "1" key on the numeric keypad is 49, while the scan code for the same given in e32keys.h is EStdKeyNkp1. Secondly, there is no corresponding value to fill in the iCode member of the TKeyEvent.

    Lastly, the Symbian website is down
    Hi,

    Lately even I have noticed that iCode is always zero for all the key events. Any one knows anything about this ?
    Regards,
    Sriky

  8. #8
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: Key(s) Simulation "Globally"

    If the TEventCode code is EEventKeyUp or EEventKeyDown then the iCode will be 0
    Download Symbian OS now! [url]http://developer.symbian.org[/url]

  9. #9
    Registered User
    Join Date
    Dec 2005
    Posts
    1,236

    Re: Key(s) Simulation "Globally"

    Hi Paul,

    I was debugging and I have noticed that for all the three events types the iCode was zero anyways I will debug once again and post the result.
    Regards,
    Sriky

  10. #10
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: Key(s) Simulation "Globally"

    It is OK that iCode is zero for EEventKeyDown and EEventKeyUp. However it should be non-zero for EEventKey. Where have you tested that?

  11. #11
    Regular Contributor
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340

    Re: Key(s) Simulation "Globally"

    Code:
    RWsSession wsSession = CCoeEnv::Static()->WsSession();
    TKeyEvent keyEvent;
    keyEvent.iCode = 49;  //member of TKeyCode
    keyEvent.iScanCode = 49;
    keyEvent.iModifiers = 1;
    keyEvent.iRepeats = 0;
    wsSession.SimulateKeyEvent(keyEvent);
    wsSession.Flush();
    Why doesn't the above code simulate the "1" numeric key?

    49 is the scan code and iCode for it I received in the OfferKeyEventL() function of my View class. Am I doing something wrong?

    @Yogpan, the HandleWsSessionEventL() example given on Wiki doesn't seem to work for me
    Regards,
    Sainagakishore Srikantham (Kishore)

    Don't Hope, KNOW!!! ---------- Visit me at http://ssnkishore.blogspot.com ----------

  12. #12
    Registered User
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043

    Re: Key(s) Simulation "Globally"

    Hi,
    Can you try with the iCode to be put as 0. It seems that the iCode for the keys is coming as 0. And what problem did u face in putting HandleWsEventL() in your AppUi. It has the parameter as TWsEvent form which you can get the Key() and then get all the necessary values.
    Maximus
    S60 Developer
    Impossible is nothing

  13. #13
    Regular Contributor
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340

    Re: Key(s) Simulation "Globally"

    Hi Yogpan,

    I don't have a problem retrieving the values of the keys being pressed, they can be retrieved in OfferKeyEventL() itself.

    On this link, the guy claims that he has successfully "simulated" numeric keys. I am trying to get his code working, but it ain't budging!

    I was able to simulate the "green key" using the following code,

    Code:
    RWsSession sess=CCoeEnv::Static()->WsSession();
    TWsEvent event;
    TInt id = sess.FindWindowGroupIdentifier( 0, _L("*Telephone*") );
    event.SetType(EEventKey);
    event.SetTimeNow();
    event.Key()->iCode = EKeyYes;
    event.Key()->iModifiers = 1;
    event.Key()->iRepeats = 0;
    event.Key()->iScanCode = EStdKeyYes;
    sess.SendEventToWindowGroup( id, event );
    I wish to "replay" all the recorded keys i.e. the sequence of key presses from time A to time B programmatically.

    Could you tell me what is the iCode for the scan code EStdKeyNkp1 (scan code for numeric 1) ?
    Regards,
    Sainagakishore Srikantham (Kishore)

    Don't Hope, KNOW!!! ---------- Visit me at http://ssnkishore.blogspot.com ----------

  14. #14
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: Key(s) Simulation "Globally"

    The reason why you get 49 as a "1" key is that it is decimal value for character "1" in ASCII.
    Here you can find all codes:
    http://en.wikipedia.org/wiki/ASCII

    good luck

  15. #15
    Registered User
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043

    Re: Key(s) Simulation "Globally"

    Hi,
    I understood your requirement but have you tried to get all the values of the key press by logging. You can write a small code to check this. Meanwhile I will also try to retreive these values for you.
    Maximus
    S60 Developer
    Impossible is nothing

Similar Threads

  1. Nokia N81 soft keys
    By ronanocie in forum Mobile Java General
    Replies: 7
    Last Post: 2009-03-30, 12:39
  2. Can I use the softkeys / red and green keys?
    By jtullis in forum Symbian
    Replies: 6
    Last Post: 2008-05-11, 21:44
  3. N93 - using external display and keys
    By gotzinger in forum Symbian
    Replies: 4
    Last Post: 2008-05-07, 18:15
  4. midlet program navigation keys
    By sebiskaa in forum Mobile Java General
    Replies: 2
    Last Post: 2008-05-07, 14:58
  5. keys simulation not working.
    By pistha in forum Symbian
    Replies: 2
    Last Post: 2007-04-26, 11:39

Posting Permissions

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