|
|
2008-11-18
, 16:10
|
|
Posts: 27 |
Thanked: 0 times |
Joined on Oct 2008
@ Munich, Germany
|
#182
|
rc5 is out now.
I am writing out a structure to /tmp/mgpstate upon change and idle, but generally it will reflect any changes. There is a header file which defines the structure and contains all the position and fix information.
|
|
2008-11-18
, 17:06
|
|
|
Posts: 716 |
Thanked: 236 times |
Joined on Dec 2007
|
#183
|
|
|
2008-11-18
, 20:10
|
|
Posts: 28 |
Thanked: 16 times |
Joined on Sep 2008
|
#184
|
rc5 is out now. Updates will NOT kill the hildon desktop to update the icons (I don't know how else to do this) automatically. Shutting off and restarting, or using an xterm to "killall hildon-desktop" will work.
gtk-update-icon-cache -f /usr/share/icons/hicolor
|
|
2008-11-18
, 20:18
|
|
|
Posts: 716 |
Thanked: 236 times |
Joined on Dec 2007
|
#185
|
|
|
2008-11-23
, 17:37
|
|
|
Posts: 3,397 |
Thanked: 1,212 times |
Joined on Jul 2008
@ Netherlands
|
#186
|
|
|
2008-11-30
, 18:18
|
|
|
Posts: 716 |
Thanked: 236 times |
Joined on Dec 2007
|
#187
|
|
|
2008-12-12
, 17:34
|
|
|
Posts: 546 |
Thanked: 85 times |
Joined on Feb 2008
@ Winnipeg, Canada
|
#188
|
|
|
2008-12-14
, 04:55
|
|
|
Posts: 716 |
Thanked: 236 times |
Joined on Dec 2007
|
#189
|
| The Following User Says Thank You to tz1 For This Useful Post: | ||
|
|
2008-12-17
, 13:50
|
|
Posts: 27 |
Thanked: 0 times |
Joined on Oct 2008
@ Munich, Germany
|
#190
|
The OBD adapters I know get 12 volts through the 16 pin J1962 connector since it is supposed to go to the battery. I added a passthrough wire to power the bluetooth adapter (pin 9, 3-12v for aircable and many others). On my harley, it has a 4 pin connector, only 3 used, ground, switched 12v, and j1850. The problem with cars and "forget about it" is that it will still draw power - only a little, but enough you wouldn't want to leave it for a week.

I wanted to wait to have a python-efficient interface, but I managed to do it early. The icon is updated in the python app/applet now. And adding very fast updates to other applications will be very easy.
(Note I put logging first, so if kml is enabled, that will be saved first and most accurately, but the UI will also update rapidly, just not at the highest priority)
I am writing out a structure to /tmp/mgpstate upon change and idle, but generally it will reflect any changes. There is a header file which defines the structure and contains all the position and fix information.
For general use, all you need to do is open the file and mmap it to a structure pointer, then just use the data. Python can use struct to access it. To update the data in an application, all that is needed is a copy and convert.
Here is the structure:
struct satinfo { // satellite number, elevation, azmuith, and signal // satellite number is NEGATIVE if used short num, el, az, sn; }; struct gpsstate { // latitude, longitude in micro-degrees. Altitude in feet * 1000 int llat, llon, alt; // dilution of precision * 1000 int pdop, hdop, vdop; // speed, mph * 1000, track, degrees * 1000 int gspd, gtrk; // year (in century, 08 not 2008), month, day, hour, minute, second, thousanths int yr, mo, dy, hr, mn, sc, scth; // lock, 0-1. fix from GPGSA int lock, fix; // -1 if device not connected int gpsfd, obdfd; // number of sats visible, number being used in fix int nsats, nused; // satellite table struct satinfo sats[20]; };#!/usr/bin/env python import struct import mmap import time file = open("/tmp/mgpstate", "r+") data = mmap.mmap(file.fileno(), 244) print "lat,lon" while True: gpstate = struct.unpack("21i80h",data) print "lat=",float(gpstate[0])/1000000 print "lon=",float(gpstate[1])/1000000 print "alt=",float(gpstate[2])/1000 print "pdop=",float(gpstate[3])/1000 print "hdop=",float(gpstate[4])/1000 print "vdop=",float(gpstate[5])/1000 print "spd=",float(gpstate[6])/1000 print "trk=",float(gpstate[7])/1000 print gpstate[10],"/", gpstate[9], "/",gpstate[8] print gpstate[11],":", gpstate[12], ":",gpstate[13], ".", str(gpstate[14]).zfill(3) print "lock=",gpstate[15] print "fix=", gpstate[16] # BT gps, obd status print gpstate[17], gpstate[18] sats = gpstate[19] print "sats=", sats," used=", gpstate[20] for i in range(sats): j=21+i*4 print gpstate[j],gpstate[j+1],gpstate[j+2],gpstate[j+3] time.sleep(1) #use 0.2 for 5hz, etc.Last edited by tz1; 2008-11-18 at 15:55. Reason: mention reset hildon desktop