none
Which API I have to choose For keypad in Mobile Device?(wince 6.0) RRS feed

  • Question

  • HI.,

             How to set a timer for keypad in Mobile device ( in WINCE 6.0 --Microsoft visual studio)....

    I want to know the timer API for keypad (Mobile device)...

     

    Regards

    Saravanan G 

    Tuesday, July 20, 2010 7:01 AM

Answers

  • Of course GetTickCount() returns different values - that is what it is supposed to do.

    1. Get the tick count for when the first key (Tick1) is pressed.
    2. Get the tick count when the nth key (TickN) is pressed.
    3. The number of milliseconds between key 1 and key n is ( TickN - Tick1 )

    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    Wednesday, July 21, 2010 1:28 PM
    Moderator

All replies

  • What are you trying to do? What is a timer for the keypad?

    Try to explain what you are trying to achieve so we can direct you better.

    Shai

    Tuesday, July 20, 2010 7:57 AM
  • Hi.,

             I am doing a keypad driver code for handheld device(WINCE 6.0)....I need to know abt timer API's.,because In our real life we are using cellphone.,

    we are press a key in cell phone with or without delay,alphabets will be printed in on our screen,..

    For eg., cell phone--If  i press the key no 2  three times mean (without delay),it will show a 'c' alphabet only in display,based on timing.. In my driver if i press the key 3 times mean i will show 'a' ,'b'&'c' alphabet,Instead of 'c' only...here i have to choose timer operation for printing 'c' only...can u help me for this issue..

     

     

    Regards

    Saravanan G

    Tuesday, July 20, 2010 10:57 AM
  • I have not implemented such functionality myself, but had I needed to I would implement this in the application that displays the text. Every time you get a keyboard event (keypress) call GetTickCount . Next time you get a keyboard event call it again and check the time difference between the two calls. You can then act according to the functionality you desire and the difference between the presses.

    For example:

    • Button pressed 1
    • Call GetTickCount
    • Display the character
    • Button Pressed again
    • Call GetTickCount
    • If the difference <0.5 seconds ->change the character
    • Otherwise add another character that the key represents.
    Shai
    Tuesday, July 20, 2010 12:11 PM
  • Hi.,

             Thank for your reply.... Today i was tried using a GetTickCount in my application,Every time i was changing a key depend upon scan code ...I cant able calculate exact key....

    For eg.,

    Scan code is nothing but for key 1-1A,key 2-14,Key 3-1B.....

     

    My code is----------------------------------------------------------

    Whenever i pressing the key infinite loop is running.....

    while(1)

    {

    Tick = GetTickCount();

     

    if( ((check==0x1A)&& (rgfKeyUp[iEvent]==0)) || ((check==0x14)&& (rgfKeyUp[iEvent]==0))||( (check==0x0E)&&(rgfKeyUp[iEvent]==0) )|| ( (check==0x1B)&& (rgfKeyUp[iEvent]==0) )|| ( (check==0x15)&& (rgfKeyUp[iEvent]==0) )|| ( (check==0x0F)&& (rgfKeyUp[iEvent]==0))|| ( (check==0x1C)&& (rgfKeyUp[iEvent]==0))||( (check==0x16)&& (rgfKeyUp[iEvent]==0) )|| ( (check==0x10)&& (rgfKeyUp[iEvent]==0)) || ( (check==0x17)&& (rgfKeyUp[iEvent]==0))|| ( (check==0x1D)&& (rgfKeyUp[iEvent]==0) ) )

    {

     

    Chk=check;

     

    c++;

     

     

    for(k=0;k<n;k++)

    {

     

    if(Chk==a[k])

    {

     

    t=k;

     

    break;

    }

     

    }

     

     

     

     

     

    p=& lower[t][u];

    RETAILMSG(MSG_FUN,(TEXT(

    "The Current address is %x\r\n"),lower[t][u]));

     

     

     

    if((c==1))

     

    {

     

     

    RETAILMSG(MSG_FUN,(TEXT("**** YOUR PRESSED KEY IS 1 **** ==%c \r\n"),*(p+0)));

     

    RETAILMSG(MSG_FUN,(TEXT(

    "TICK VALUE IS GET TICK COUNT 1**---%d---%f\r\n"),T1,T1));

     

    }

     

     

    else if((c==2))

    {

     

    RETAILMSG(MSG_FUN,(TEXT("**** YOUR PRESSED KEY IS 2 ***** ==%c\r\n"),*(p+1)));

    RETAILMSG(MSG_FUN,(TEXT(

    "TICK VALUE IS GET TICK COUNT 2*** %d---%f\r\n"),T2,T2));

     

     

    }

     

    else if((c==3))

    {

     

    RETAILMSG(MSG_FUN,(TEXT("**** UR PRESSED KEY IS 3 **** ==%c\r\n"),*(p+2)));

    RETAILMSG(MSG_FUN,(TEXT(

    "TICK VALUE IS GET TICK COUNT 3*** %d---%f\r\n"),T3,T3));

     

     

    }

     

    else if((c==4))

    {

     

    RETAILMSG(MSG_FUN,(TEXT(" **** UR PRESSED KEY IS 4 **** ==%c\r\n"),*(p+3)));

    RETAILMSG(MSG_FUN,(TEXT(

    "TICK VALUE IS GET TICK COUNT 4*** %d---%f\r\n"),T4,T4));

     

     

    c=0;

     

    }

    Wednesday, July 21, 2010 10:43 AM
  • Hi.,

    whenever i press the key the while condition is running,after that i check the scancode using if condition-if my scan code is correct ..

    it will find the key(which key is user pressed) using for loop ... then using pointer i go directly to the corresponding location..... and i am printing the value...

    In this module where i have to use GetTickCount ....

     

     

    Regards

    Saravanan G

    Wednesday, July 21, 2010 10:49 AM
  • What is the question?

    It is hard for me to follow your code, but in case there is a chance of 2 or more consecutive iterations in the while loop, I would add a sleep to let other threads have some breathing space and time to run. Even a Sleep(0) just to let the scheduler run will make the loop better- system performance wise.

     

    Shai

    Wednesday, July 21, 2010 11:06 AM
  • Hi.,

              OK... I tried API (Get Tick Count) in my application.,Every time i press the(either same r different) key in  keypad ,Get Tick Count  give some different values ..so i cant  able to identify the difference of key time(between 10 keys) ,I Need to know the correct timing for seperate key ..Kindly reply...

     

     

     

    Regards

    Saravanan G

    Wednesday, July 21, 2010 1:20 PM
  • Of course GetTickCount() returns different values - that is what it is supposed to do.

    1. Get the tick count for when the first key (Tick1) is pressed.
    2. Get the tick count when the nth key (TickN) is pressed.
    3. The number of milliseconds between key 1 and key n is ( TickN - Tick1 )

    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    Wednesday, July 21, 2010 1:28 PM
    Moderator