Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Regular Contributor ssn.kishore's Avatar
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340
    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
    Nokia Developer Moderator skumar_rao's Avatar
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968
    Symbian OS v9.1 » Symbian OS reference » C++ component reference » Base E32 » TStdScanCode

  3. #3
    Nokia Developer Champion kkrish's Avatar
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,029
    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.

  4. #4
    Regular Contributor ssn.kishore's Avatar
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340
    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
    Nokia Developer Moderator skumar_rao's Avatar
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968
    the link i have given is from SDK help.

  6. #6
    Registered User yogpan's Avatar
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043
    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 sriky27's Avatar
    Join Date
    Dec 2005
    Posts
    1,236
    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 Paul.Todd's Avatar
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644
    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 sriky27's Avatar
    Join Date
    Dec 2005
    Posts
    1,236
    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 wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    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 ssn.kishore's Avatar
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340
    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 yogpan's Avatar
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043
    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 ssn.kishore's Avatar
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340
    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 nuker85's Avatar
    Join Date
    May 2007
    Location
    Poland
    Posts
    606
    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 yogpan's Avatar
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043
    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

Page 1 of 2 12 LastLast

Similar Threads

  1. Nokia N81 soft keys
    By ronanocie in forum Mobile Java General
    Replies: 7
    Last Post: 2009-03-30, 12:39
  2. Replies: 6
    Last Post: 2008-05-11, 21:44
  3. N93 - using external display and keys
    By gotzinger in forum Python
    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 C++
    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
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved