×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    2

    [3650] keyboard problem

    Hi all,

    I have a problem with N3650 keyboard. I've read many posts about it, but no one of it helps me to resolve the problem. I do not have N3650 device.

    My application uses all the standard keys (0-9, * and #) and must recognize which key has been pressed by the user.

    I use both keyCode and getGameAction(keyCode). here the code:
    protected void keyPressed(int keyCode) {
    int action = canvas.getGameAction(keyCode);
    oldCommand = commandPlayer;
    if (action==canvas.FIRE||keyCode==canvas.KEY_NUM5) commandPlayer=MiaMIDlet.FIRE;
    else if (action==canvas.LEFT || keyCode==canvas.KEY_NUM4) commandPlayer=MiaMIDlet.MOVELEFT;
    else if (action==canvas.RIGHT||keyCode==canvas.KEY_NUM6) commandPlayer=MiaMIDlet.MOVERIGHT;
    else if (action==canvas.UP||keyCode==canvas.KEY_NUM2) commandPlayer=MiaMIDlet.MOVEUP;
    else if (action==canvas.DOWN||keyCode==canvas.KEY_NUM8) commandPlayer=MiaMIDlet.MOVEDOWN;
    else if (keyCode==canvas.KEY_NUM1) commandPlayer=MiaMIDlet.MOVEUPLEFT;
    else if (keyCode==canvas.KEY_NUM3) commandPlayer=MiaMIDlet.MOVEUPRIGHT;
    else if (keyCode==canvas.KEY_NUM7) commandPlayer=MiaMIDlet.MOVEDOWNLEFT;
    else if (keyCode==canvas.KEY_NUM9) commandPlayer=MiaMIDlet.MOVEDOWNRIGHT;
    else if (keyCode==canvas.KEY_NUM0) commandPlayer=MiaMIDlet.ALTFIRE;
    else if (keyCode==canvas.KEY_STAR) commandPlayer=MiaMIDlet.STAR;
    else if (keyCode==canvas.KEY_POUND) commandPlayer=MiaMIDlet.POUND;
    }//end keyPressed


    This method runs in many devices (all Nokia s40 and s60, Motorola, Sonyericsson, standard wkt emulator and so on) but not on N3650. This because it returns different keyCode numbers, I think.

    I've noticed that gameActions doesn't cover all the keys, and it iterprets the key values according to the device type. I.e.: in nokia emulator, GAME_A, GAME_B, GAME_C and GAME_D returns when I press 7, 9, * and # keys; in standard emulators, they returns for 1, 3, 7, 9 keys.

    Here my debug for standard emu:
    [1] - keyPressed(keyCode=49 action=9)
    [2] - keyPressed(keyCode=50 action=1)
    [3] - keyPressed(keyCode=51 action=10)
    [4] - keyPressed(keyCode=52 action=2)
    [5] - keyPressed(keyCode=53 action=8)
    [6] - keyPressed(keyCode=54 action=5)
    [7] - keyPressed(keyCode=55 action=11)
    [8] - keyPressed(keyCode=56 action=6)
    [9] - keyPressed(keyCode=57 action=12)
    [0] - keyPressed(keyCode=48 action=0)[*] - keyPressed(keyCode=42 action=0)
    [#] - keyPressed(keyCode=35 action=0)


    here the debug for Nokia 7210 emu:
    [1] - keyPressed(keyCode=49 action=0)
    [2] - keyPressed(keyCode=50 action=1)
    [3] - keyPressed(keyCode=51 action=0)
    [4] - keyPressed(keyCode=52 action=2)
    [5] - keyPressed(keyCode=53 action=8)
    [6] - keyPressed(keyCode=54 action=5)
    [7] - keyPressed(keyCode=55 action=9)
    [8] - keyPressed(keyCode=56 action=6)
    [9] - keyPressed(keyCode=57 action=10)
    [0] - keyPressed(keyCode=48 action=0)[*] - keyPressed(keyCode=42 action=11)
    [#] - keyPressed(keyCode=35 action=12)


    The DEBUG CODE I've used:
    System.out.println("keyPressed(keyCode="+keyCode+" action="+Canvas.getGameAction(keyCode)+")");

    So, gameActions:
    1) excludes 2 keys
    2) returns different values according to the device.


    What can I do? I'm about to test this application with java verified.. It runs well on all the phones I've tested and I decided to develop a special version for 3650 (and 3660?) to solve the problem.

    So, if anyone has a 3650 model, and some time to spend for me, can please do the test using my DEBUG CODE in keyPressed function of any kind of application, and posts its results?

    I think I need to know keyCodes of 3650 and test its value (not excellent, but working). Finally I hope this post helps people with the same problem.


    Thank you in advance

  2. #2
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    51

    Re: [3650] keyboard problem

    hei,i dindt know this help u or not
    i have the list to specified the key code for several phone, only for joystick and not for specific type. i dont know if that will be different for N3650..take a look at this.

    private static final void defineNokiaKeys(){
    UP = -1;
    DOWN = -2;
    LEFT = -3;
    RIGHT = -4;
    CENTER = -5;
    CLEAR = -8;
    SOFTKEY1 = -6;
    SOFTKEY2 = -7;
    }

    private static final void defineSonyEricssonKeys(){
    UP = -1;
    DOWN = -2;
    LEFT = -3;
    RIGHT = -4;
    CENTER = -5;
    CLEAR = -8;
    SOFTKEY1 = -6;
    SOFTKEY2 = -7;
    }

    private static final void defineLGKeys(){
    UP = -1;
    DOWN = -2;
    LEFT = -3;
    RIGHT = -4;
    CENTER = -5;
    CLEAR = -16;
    SOFTKEY1 = -6;
    SOFTKEY2 = -7;
    }
    private static final void defineSamsungKeys(){
    UP = -1;
    DOWN = -2;
    LEFT = -3;
    RIGHT = -4;
    CENTER = -5;
    CLEAR = -8;
    SOFTKEY1 = -6;
    SOFTKEY2 = -7;
    }

    private static final void defineSiemensKeys(){
    UP = -59;
    DOWN = -60;
    LEFT = -61;
    RIGHT = 62;
    CENTER = -26;
    CLEAR = 0;
    SOFTKEY1 = -1;
    SOFTKEY2 = -4;
    }

    private static final void definePanasonicKeys(){
    UP = -1;
    DOWN = -2;
    LEFT = -3;
    RIGHT = -4;
    CENTER = -5;
    CLEAR = 0; // NOT SUPPORTED
    SOFTKEY1 = -21;
    SOFTKEY2 = -22;
    }

    private static final void defineMotorolaKeys(){
    UP = -1;
    DOWN = -6;
    LEFT = -2;
    RIGHT = -5;
    CENTER = -20;
    CLEAR = 0;
    SOFTKEY1 = -21;
    SOFTKEY2 = -22;
    }


    -regards-
    Last edited by laili_aidi; 2008-05-23 at 04:12. Reason: make it more relevance

Posting Permissions

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