|
LinksPoint GPS Toolkit Reference
|
extern "C" void GpsNotification(GPSNOTIFYCODE gncCode, long lParam1, long lParam2, long lParam3) { switch (gncCode) { case GPSNOTIFY_DATA_CHANGED: { GPSPOSITION gpPos; gpPos = GpsGetPosition(GPSFORMAT_DEGREES); printf("Latitude %lf, Longitude %lf, HDOP %.1lfn", gpPos.dLatitude, gpPos.dLongitude, GpsGetHDOP()); } break; default: printf("%sn", (LPSTR)lParam2); } } int main(int argc, char* argv[]) { GpsSetNotificationCallback((GPSNOTIFYPROC)GpsNotification, 0); if (GpsInitialize(0, 4800, GPSPROTOCOL_UNKNOWN, GPSENABLE_FALSE) != GPSERROR_NONE) { printf("GPS failed to initializen"); return 0; } printf("Press enter to start the GPS...n"); getchar(); // Start up the GPS Engine GpsEnable(GPSENABLE_TRUE); printf("Press enter to stop the GPS...n"); getchar(); // Shut down everything GpsTerminate(); return 0; }
typedef long (* GPSNOTIFYPROC)(GPSNOTIFYCODE sNotifyCode, long lParam1, long lParam2, long lParam3);