Model: DG-100
Product: GPS data logger
| Version | Change History | Issue Date | Remark |
|---|---|---|---|
| 0.1 | Initiation | Jan 30, 2007 | Preliminary |
| 0.1(unofficial) | Corrections | March 7, 2008 | Unofficial |
n.b. This version of the spec is unofficial - I have added PK's notes and added the 'mouse mode' commands.
The general format of communication sent to DG 100 is:
| Start Sequence | Payload Length | Payload Message | Checksum | End Sequence |
|---|---|---|---|---|
| 0xA0,0xA2 | Two-bytes | Up to 1023 | Two-bytes | 0xB0,0xB3 |
The general format of communication received from DG 100 is:
| Start Sequence | Payload Length | Payload Message | Checksum | End Sequence |
|---|---|---|---|---|
| 0xA0,0xA2 | Two-bytes | Up to 1023 | Two-bytes | 0xB0,0xB3 |
Assume PAYLOAD is an array that is transmitted, and PAYLOAD_LEN is the length of this array:
checksum = PAYLOAD [0];
For ( i =1; i < PAYLOAD_LEN; i++)
{
checksum = checksum + PAYLOAD [i];
}
checksum = checksum & (1<<15 - 1);
The last line of the checksum funtcion masks bit 15 (i.e. the most significant bit in the checksum.) This means that the checksum will never be larger than 32767 (decmial.)
The exchange data format used in DG is:
| Command ID | Parameter |
|---|---|
| One-byte | n-bytes value |
| Command ID | Parameter |
|---|---|
| 0xB7 | None |
| Command ID | Parameter |
|---|---|
| 0xB7 | 44-bytes value |
| Information Type | Byte 0 |
|---|---|
| Speed Threshold Flag | Byte 1 |
| Speed Threshold | Byte 2-byte 5 |
| Distance Threshold flag | Byte 6 |
| Distance Threshold | Byte 7-byte 10 |
| Time Interval 1 | Byte 11-byte 14 |
| Time Interval 2 | Byte 15-byte 18 |
| Time Interval 3 | Byte 19-byte 22 |
| Not used | Byte 23 |
| Not used | Byte 24 |
| Interval by time1/distance1 flag | Byte 25 |
| Interval by time2/distance2 flag | Byte 26 |
| Interval by time3/distance3 flag | Byte 27 |
| Interval by distance1 | Byte 28-byte 31 |
| Interval by distance2 | Byte 32-byte 35 |
| Interval by distance3 | Byte 36-byte 39 |
| Not used | Byte 40 |
| Memory usage | Byte 41 |
| Not used | Byte 42 |
| Not used | Byte 43 |
A0A2 0035 B7
02 00 00000000 00 00000000
00007530 00002710 000003E8 00 00
00 00 00 00000000 00000000
00000000 00 5D 01 01
03CD B0B3
| Command ID | Parameter |
|---|---|
| 0xB8 | 41-bytes value |
| Command ID | Parameter |
|---|---|
| 0xB7 or 0xB8 | 4-bytes value |
| Information Type | Byte 0 |
|---|---|
| Speed Threshold Flag | Byte 1 |
| Speed Threshold | Byte 2 - byte 5 |
| Distance Threshold Flag | Byte 6 |
| Distance Threshold | Byte 7 - byte 10 |
| Time Interval 1 | Byte 11 - byte 14 |
| Time Interval 2 | Byte 15 - byte 18 |
| Time Interval 1 | Byte 19 - byte 22 |
| Not used | Byte 23 |
| Not used | Byte 24 |
| Interval by time1/distance1 flag | Byte 25 |
| Interval by time2/distance2 flag | Byte 26 |
| Interval by time3/distance3 flag | Byte 27 |
| Interval by distance1 | Byte 28 - byte 31 |
| Interval by distance2 | Byte 32 - byte 35 |
| Interval by distance3 | Byte 36 - byte 35 |
| Not used, set to 0x01 | Byte 40 |
| Result | Byte 0 - byte 3 |
|---|
| Command ID | Parameter |
|---|---|
| 0xBB | 2-bytes value |
| Command ID | Parameter |
|---|---|
| 0xBB | (12*N+4)-bytes value |
| The index of the first train file in this iteration |
|---|
| Byte 0 - byte 1 |
| The number of track file headers returned (N) | Byte 0 - byte 1 |
|---|---|
| The index of the next track can be got | Byte 2 - byte 3 |
| The track file header | Byte 4 - byte(12*N+3) |
BB 0004
00040002EBC4000384070000
0000000162500003AB170000
0001000167E60003AB170000
00020001AFC70003AB170000
0003EBE70D00
| Command ID | Parameter |
|---|---|
| 0xB5 | 2-bytes value |
| Command ID | Parameter |
|---|---|
| 0xB5 | 1024-bytes value |
| The index of the track file |
|---|
| Byte 0 - byte 1 |
| Track file |
|---|
| Byte 0 - byte 1023 |
The track file is return in two sessions, so the two sessions should be combined together to parse data.
The End sequence for this command is 6-bytes values.
Parse track records in a track file:
| Track record 1 | Byte 0 - byte31 |
|---|---|
| Track record 2 | Byte 32 - byte M |
| Track record 3 | Byte M - byte 2047 |
| ... | ... |
| Track record n |
The format of the first track record must be FORMAT C (32 bytes). The format of other track records in this track file is decided by the field "STYLE" of the first track record. There are three formats for storing track records:
a. Position only(8 bytes):
| Latitude | Byte 0 - byte 3 |
|---|---|
| Longitude | Byte 4 - byte 7 |
b. Position, date/time and speed(20 bytes):
| Latitude | Byte 0 - byte 3 |
|---|---|
| Longitude | Byte 4 - byte 7 |
| UTime | Byte 8 - byte 11 |
| UDate | Byte 12 - byte 15 |
| Speed | Byte 16 - byte 19 |
c. Position, date/time, speed and altitude(32 bytes):
| Latitude | Byte 0 - byte 3 |
|---|---|
| Longitude | Byte 4 - byte 7 |
| UTime | Byte 8 - byte 11 |
| UDate | Byte 12 - byte 15 |
| Speed | Byte 16 - byte 19 |
| Altitude | Byte 20 - byte 23 |
| Not Used | Byte 24 - byte 27 |
| Style | Byte 28 - byte 31 |
The format of all fields are described as following, and the type of all fields are number.
How the get the track record?
The raw data (HEX format) is like this: it is FORMAT C
0026239B00B95F380001B2070001D97600000000000000000000000100000002
So parsing:(0026239B)(00B95F38)(0001B1A1)(0001D912)(00000064)(00006400)(00000001)(00000002)
| field | hex | decimal | human |
|---|---|---|---|
| Latitude | 0x0026239B | 2499483 | 24°99.483 |
| Longitude | 0x00B95F38 | 12148536 | 121°48.536 |
| UTime | 0x0001B1A1 | 111009 | 11:10:09(hour:minute:second) |
| UDate | 0x0001D912 | 121106 | 2006/11/12 |
| Speed | 0x00000064 | 100 | 1 (km/hour) |
| Altitude | 0x00006400 | 25600 | 2.56 meters |
| Style | 0x00000002 | 2 | Format C |
| Command ID | Parameter |
|---|---|
| 0xBA | 0xFF,0xFF |
| Command ID | Parameter |
|---|---|
| 0xBA | 4-bytes value |
| Result |
|---|
| Byte 0 - byte 3 |
If Result = 1, it is OK.
| Command ID | Parameter |
|---|---|
| 0xBF | None |
| Command ID | Parameter |
|---|---|
| 0xBF | 8-bytes value |
| ID of DG100 |
|---|
| Byte 0 - byte7 |
| Command ID | Parameter |
|---|---|
| 0xC0 | 8-bytes value |
| Command ID | Parameter |
|---|---|
| 0xC0 | 4-bytes value |
| Result |
|---|
| Byte 0 - byte 3 |
| Command ID | Parameter |
|---|---|
| 0xBC | 2 byte value |
| Command ID | Parameter |
|---|---|
| 0xBC | 2-bytes value |
| Toggle |
|---|
| Byte 0 - byte 1 |
| Result |
|---|
| Byte 0 - byte 1 |