Author |
Topic |
|
ctacke
877 Posts |
|
padrino121
8 Posts |
Posted - 14 Jun 2004 : 20:33:44
|
I already setup a polling thread and marshal the key codes to the proper event handlers however I was wondering how you could use the keybd_event method to dispatch messages to a command line app similar to the test app you have here. As I understand it in a GUI application keybd_event would properly inform the top window of the key presses however how would one make this work using a console app like the one provided?
Thanks. |
|
|
ctacke
877 Posts |
Posted - 15 Jun 2004 : 12:31:34
|
Under CE, the "console" is simply another application running in a window. If it's at the top of the z-order, it should receive key presses just like any other application. Are you not seeing the correct behavior? What Platform and ADS CE Build number are you using? |
|
|
padrino121
8 Posts |
Posted - 16 Jun 2004 : 13:32:06
|
quote: [i]Originally posted by ctacke[/i] [br]Under CE, the "console" is simply another application running in a window. If it's at the top of the z-order, it should receive key presses just like any other application. Are you not seeing the correct behavior? What Platform and ADS CE Build number are you using?
I'm on a BitsyX running 4.1.36. I added a debug statement to the keypad.cpp file to print when a key is received and it is indeed received and the keybd_event is correct run however my app never receives the key press. Maybe I'm missing something but GetMessage should get the message just like it does in my MFC based version and work the same. |
|
|
timslater
6 Posts |
Posted - 08 Oct 2004 : 13:49:03
|
Is this helper class polling the keyboard?
I am on BitsyX and wondering about conserving battery power (as well as response time if I set the poll timer to large)
Is there a way to get an interrupt to know when to do an SIOReadKeypad() ?
|
|
|
akidder
1519 Posts |
Posted - 08 Oct 2004 : 18:06:50
|
Hi Tim. The SIOReadKeypad function is a blocking call. The SIOSetSSPTimeout function determines how long it should wait before returning.
I can see why you might think the keypad function is polling in this application. While there is a while(true) loop that repeatedly calls the keypad read function, the keypad function itself blocks for several seconds if no key is pressed. What may have been confusing here is that the timeout is not set explicity.
You can set the timeout a number of ways:- Use the default timeout, which is typically set in the built-in registry (consult the reginit.ini that came with your CE build):
[HKEY_LOCAL_MACHINE\Platform\Smartio] "SSPTimeout"=dword:1388 ; 0x1388 = 5000 msec, 0xffffffff "infinite"
You can override the default setting by setting your own timeout in adsload.reg.
Finally, you can call SIOSetSSPTimeout explicitly.
To summarize, use the keypad function in a helper thread, as demonstrated in this application. The timeout gives the effect of an event-driven, block-till-satisfied function call. |
|
|
timslater
6 Posts |
Posted - 11 Oct 2004 : 16:49:15
|
Thanks. But of course more questions...
I see in the ADSmartio specification that with version 0x8003 I can get KepPressed and KeyRelease codes from SIOReadKeypad().
1. How do I know if I have version 0x8003 ? (From the debug port, all I see is "SMARTIO Detected : PartType=0x8535 Firmware=0x0010 Revision=2"
2. Assuming I can get KeyPressed and KeyReleased codes, does that mean I can pretty easily implement key combinations (Key1 down, Key2 down before Key1 up implies both keys are down, right ?
|
|
|
|
Topic |
|