NO

Author Topic: pocket pc and gps  (Read 7776 times)

drgott

  • Guest
pocket pc and gps
« on: December 11, 2009, 09:03:08 PM »
The sample GPS program uses a for(;;) loop to handle messages.  I was wondering why.  Can events triggered by the GPS driver only be handled with MsgWaitForMultipleObjects() ?  Why do we even have to wait for the GPS events?  They'll come when and if they'll come, just like the user tapping a button.  And why wait INFINITEly?   

Mavis Enderby

  • Guest
Re: pocket pc and gps
« Reply #1 on: April 01, 2010, 11:40:40 PM »
I am not sure that the GPS sample gives the best advice for the message passing loop. After looking through MSDN the following code appears to be the recommended way of handling the events.

Code: [Select]
int notFinished = 0;
do {
/* Wait for GPS or message queue events */
switch (MsgWaitForMultipleObjects(NUM_EVENTS, ahEvents, FALSE, INFINITE, QS_ALLINPUT)) {
case WAIT_OBJECT_0 + EVENT_NEWPOSITION:
/* Change in GPS position -- update dialog */
GPSPosition(hDevice, hwndDlg);
notFinished = 1;
break;
case WAIT_OBJECT_0 + EVENT_NEWSTATE:
/* Change in GPS state -- update dialog */
GPSState(hDevice, hwndDlg);
notFinished = 1;
break;
case WAIT_OBJECT_0 + NUM_EVENTS:
/* New message in queue */
/* need to use PeekMessage loop instead of simple GetMessage:
* multiple messages might have arrived in between,
* so GetMessage would lead to delayed processing */
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT) {
notFinished = 0;;
break;
} else {
if (!IsWindow(hwndDlg) || !IsDialogMessage(hwndDlg, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
notFinished = 1;
}
}
break;
default:
notFinished = 0;
}
} while (notFinished > 0);

Hope this helps.








Offline AlexN

  • Global Moderator
  • Member
  • *****
  • Posts: 394
    • Alex's Link Sammlung
Re: pocket pc and gps
« Reply #2 on: April 02, 2010, 07:01:41 PM »
I don't know if it helps you, but at Pelles homepage at the capter Source code -> Pocket PC Samples -> GPS there is an example for handling GPS-datas.
best regards
 Alex ;)

sergey

  • Guest
Re: pocket pc and gps
« Reply #3 on: April 25, 2010, 08:09:29 PM »

saliha

  • Guest
Re: pocket pc and gps
« Reply #4 on: February 24, 2011, 10:48:51 AM »
The site covering PocketPC (Pocket PC) products that are related GPS or to Navigation. In some cases these products may also be used with WinCE palmtops. The terms "pocket pc," sometimes called ppc, and "WinCE" may be used interchangeably in this context however some products may be specific to one platform or the other.

reeta

  • Guest
Re: pocket pc and gps
« Reply #5 on: January 31, 2014, 12:53:05 PM »
I would first look into amalgamating them into one app since they all work to a common output.
If that was not possible I would look at designing a common data base for them all to access.
Finally I wold look at Frankie's suggestion.