[bug-dev] Problems retrieving GPS Location
Paul Bayliss
prbayliss at mac.com
Fri Dec 12 16:57:11 EST 2008
Hi All,
I forgot to mention that GPS_Fix from the menu shows true and the
Module's LED blinks green. I can also get raw GPS feed data and write
it successfully to the concierge log.
Regards,
Paul
On Dec 12, 2008, at 4:48 PM, Paul Bayliss wrote:
> Hello All,
>
> I'm trying the access the GPS Module and I'm seeing some strange
> issues.
>
> I have the following code in one of my bundles (The snippet is taken
> from the GPS Demo application).
>
>
> logService.log(LogService.LOG_DEBUG, "Retrieving GPS Latitude
> Longitude");
>
> LatLon latitudeLongitude = positionProvider.getLatitudeLongitude();
>
> // print out GPS coordinates
> System.out.println();
> System.out.println("GPS position coordinates:");
> System.out.println("-------------------------");
> System.out.println("GPS latitude: " + latitudeLongitude.latitude);
> System.out.println("GPS longitude: " + latitudeLongitude.longitude);
>
> When this code runs on an actual bug (Haven't tried the emulator) I
> receive the following exception in concierge log.
>
> [Thu Jan 01 00:06:12 GMT 1970] [DEBUG] Retrieving GPS Latitude
> Longitude
> Exception in thread "Location Retrieval Thread"
> java.lang.NumberFormatException: unable to parse double
> at java.lang.VMDouble.parseDouble(Native Method)
> at java.lang.Double.parseDouble(Double.java:333)
> at
> com
> .buglabs
> .bug.module.gps.GPSModlet.getLatitudeLongitude(GPSModlet.java:405)
> at com.antennasoftware.osgi.locationtracker.LocationTracker
> $SendLocationTimerTask$1.run(LocationTracker.java:73)
> at java.lang.Thread.run(Thread.java:743)
> at java.lang.VMThread.run(VMThread.java:120)
>
> If I replace the code with this...
>
> final Position position = positionProvider.getPosition();
> logService.log(LogService.LOG_DEBUG, "Retrieved Position");
>
> if(position != null) {
> logService.log(LogService.LOG_DEBUG, "position is not null");
> Measurement latitude = position.getLatitude();
> if(latitude != null) {
> logService.log(LogService.LOG_DEBUG, "Latitude: " +
> latitude.getValue());
> } else {
> logService.log(LogService.LOG_DEBUG, "Latitude is null");
> }
>
> } else {
> logService.log(LogService.LOG_DEBUG, "Position is null");
> }
>
> When it runs I get see the following output in the concierge log. I
> takes a few minutes for OSGi to be killed - I'm not sure what kills
> it.
>
> [Thu Jan 01 00:11:24 GMT 1970] [DEBUG] Retrieved Position
> [Thu Jan 01 00:11:24 GMT 1970] [DEBUG] position is not null
> Killed
> root at bug:/usr/share/java#
>
> Is anyone familiar with this problem or even better have a solution?
>
> Here's some version information...
>
> Concierge OSGi 1.0.0.RC3 on Linux 2.6.27.2
> root at bug:~# cacao -version
> java version "1.5.0"
> CACAO version 0.99.3
>
> Incidentally the BGPSDemo application does not install...
>
> [Thu Jan 01 01:01:54 GMT 1970] [DEBUG] AppManager checking /usr/
> share/java/apps/GPSDemo.jar
> [Thu Jan 01 01:01:54 GMT 1970] [DEBUG] GPSDemo [class
> gpsdemo.servicetracker.GpsdemoServiceTracker] Tracker found service:
> com.buglabs.bug.module.gps.pub.INMEARawFeed
> [Thu Jan 01 01:01:54 GMT 1970] [DEBUG] GPSDemo [class
> gpsdemo.servicetracker.GpsdemoServiceTracker] Service added to
> service map: com.buglabs.bug.module.gps.pub.INMEARawFeed
> [Thu Jan 01 01:01:54 GMT 1970] [DEBUG] GPSDemo [class
> gpsdemo.servicetracker.GpsdemoServiceTracker] Tracker found service:
> com.buglabs.bug.module.gps.pub.IPositionProvider
> [Thu Jan 01 01:01:54 GMT 1970] [DEBUG] GPSDemo [class
> gpsdemo.servicetracker.GpsdemoServiceTracker] Service added to
> service map: com.buglabs.bug.module.gps.pub.IPositionProvider
> [Thu Jan 01 01:01:54 GMT 1970] [DEBUG] GPSDemo [class
> gpsdemo.servicetracker.GpsdemoServiceTracker] Starting tracker, all
> services are available.
> [Thu Jan 01 01:01:55 GMT 1970] [ERROR] Failed to start application
> bundle: /usr/share/java/apps/GPSDemo.jar
> Exception: Error starting bundle Bundle [35]: file:/usr/share/java/
> apps/GPSDemo.jar
> org.osgi.framework.BundleException: Error starting bundle Bundle
> [35]: file:/usr/share/java/apps/GPSDemo.jar
> at
> ch
> .ethz.iks.concierge.framework.BundleImpl.startBundle(BundleImpl.java:
> 473)
> at
> ch.ethz.iks.concierge.framework.BundleImpl.start(BundleImpl.java:418)
> at
> com.buglabs.bug.program.UserAppManager.startApp(UserAppManager.java:
> 174)
> at
> com
> .buglabs.bug.program.UserAppManager.processQueue(UserAppManager.java:
> 114)
> at com.buglabs.bug.program.UserAppManager.run(UserAppManager.java:
> 91)
> at
> com.buglabs.bug.program.ProgramServlet.doPost(ProgramServlet.java:140)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> com.buglabs.osgi.http.HttpServer.processRequest(HttpServer.java:399)
> at com.buglabs.osgi.http.HttpServer.run(HttpServer.java:204)
> at java.lang.VMThread.run(VMThread.java:120)
>
>
> Please let me know if there's any more information I can provide.
>
> Many thanks for any assistance,
> Paul
>
> _______________________________________________
> bug-dev mailing list
> bug-dev at lists.buglabs.net
> http://lists.buglabs.net/cgi-bin/mailman/listinfo/bug-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.buglabs.net/pipermail/bug-dev/attachments/20081212/8181dfa7/attachment-0001.htm
More information about the bug-dev
mailing list