0% found this document useful (0 votes)
15 views8 pages

Xexun GPS Protocol

The Xexun GPS Protocol outlines data types, message structures, and communication methods for GPS devices. It includes details on various data types such as GPS, WiFi, LBS, and alarm data, along with examples of message formats. The protocol also specifies server responses and commands for device management, ensuring efficient data transmission and device control.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views8 pages

Xexun GPS Protocol

The Xexun GPS Protocol outlines data types, message structures, and communication methods for GPS devices. It includes details on various data types such as GPS, WiFi, LBS, and alarm data, along with examples of message formats. The protocol also specifies server responses and commands for device management, ensuring efficient data transmission and device control.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Xexun GPS Protocol

Data Types
Data Types Describe
U8 Unsigned single byte integer ( byte , 8 bits )
U16 Unsigned double - byte integer ( byte , 16 bits )
U32 Unsigned four - byte integer ( double byte , 32 bits )
FLOAT Single-precision floating-point number (four bytes, 32 bits)
U8 [n] N byte
BCD [n] 8421 code , n byte
STRING UTF- 8 encoding , if it is data , leave it blank

Message structure
Each message consists of a flag bit + a message header + a message body + a flag bit.

Flags
The first and last flags are both FAAF. The FAAF in the body is converted to FBBF02 , and the FBBF in the
body is converted to FBBF01.

Message Header
No. Start Byte Name Data Types
0 Message ID U16 , the positioning and alarm upload data
1 message ID is 0020 , the server sends the
command message ID is 0021
2 2 Serial Number 0-65535 U16

3 4 IMEI+0 BCD[8]

4 12 Text length U16

5 14 ECC check of the entire U16


message

Protocol Detection
The terminal sends the following data when it connects to the platform for the first time :
FA AF 00 14 00 01 86 27 71 07 54 26 75 20 00 0C FF F5 01 00 09 00 00 00 00 00 00 00 00 00 FA AF
The platform resolves the message ID to 0014 and responds with 02:
FA AF 00 14 00 01 86 27 71 07 54 26 75 20 00 01 FF FD 02 FA AF

Message body
No. Name Type Number
1 Data Type ID U8 1
2 Data length U8 1
When the data content length is 0, there is no
3 * *
DATA field

1
GPS Data Type ID : 00
No. Name Type Number Example
1 Timestamp of successful positioning U32 4 6675360C
2 latitude FLOAT 4 463229B7
3 longitude FLOAT 4 450BA72B
4 altitude FLOAT 4 424F999A
5 Number of satellites U8 1 06
Average signal-to-noise ratio of the four
6 U8 1 23
satellites with the best signals
7 Speed, 10*(km/h) U16 2 0001
8 Angle, 10*(degree) U16 2 0000
Ephemeris synchronization flag, 0 = not
9 U8 1 00
synchronized 1=Synchronized
The number of seconds it takes to successfully
10 U8 1 07
locate
11 Dilution of Precision U16 2 001D
The strongest signal-to-noise ratio of the four
12 U8[4] 4 26242121
satellites
1 is normal, 2 is modified , 4 is differential, 5 is
13 U8 1 01
sub-meter (only available for RTK )
14 Differential delay (only available for RTK ) U8 1 02
Full example:
00206675360C463229B7450BA72B424F999A0623000100000007001D262421210102

WIFI data type ID : 01


No. Name Type Number Example
1 The timestamp of the collected data U32 4 6675360C
2 Number of WIFI U8 2 06
3 WIFI MAC U8[6] 6 F4BFBB0D4DF1
4 WIFI signal U8 1 CC
5 WIFI MAC U8[6] 6 A0C5F2B078E0
6 WIFI signal U8 1 CC
7 WIFI MAC U8[6] 6 A2C5F2B078E0
8 WIFI signal U8 1 CC
9 WIFI MAC U8[6] 6 7C1E0682D571
10 WIFI signal U8 1 C5
7 WIFI MAC U8[6] 6 0C4B543F2881
8 WIFI signal U8 1 C4
9 WIFI MAC U8[6] 6 0E4B543F2881
10 WIFI signal U8 1 C4
Example:
012F6675360C06F4BFBB0D4DF1CCA0C5F2B078E0CCA2C5F2B078E0CC7C1E0682D571C50C4B543F2881C
40E4B543F2881C4

LBS data type ID : 0 2


No. Name Type Number Example
1 The timestamp of the collected data U32 4 6675360C
2 MCC U16 2 01CC
3 MNC U16 2 0000
4 LAC U32 4 000026 2E

2
5 CID U32 4 0A82AB1A
6 RSSI U8 1 twenty three
7 LAT FLOAT 4 463229B7
8 LON FLOAT 4 450BA72B
Example:
02196675360C01CC00000000262E0A82AB1A23463229B7450BA72B

TOF data type ID: 03


No. Name Type Number Example
1 Timestamp of successful ranging U32 4 6675360C
2 Related ID U32 4 98374657
3 Distance (cm) U16 2 0014
4 Power U16 2 0067
Example:
030C6675360C9837465700140067

Alarm data type ID: 04


No. Name Type Number Example
1 Timestamp of the alarm U32 4 6675360C
2 Alarm data U32 4 00000001
Example:
04086675360C00000001
Alarm Location(Right to Left) :
Location Alarm Location Alarm
0 SOS 16 Light sensor switch
1 Reserve 17 Light sensor is effective
2 Reserve 18 Light sensor is invalid
3 Reserve 19 Escort shackle tag distance failed
4 Reserve 20 Escort shackles tag over distance
5 Reserve 21 Reserve
6 Reserve 22 Car external power failure
7 Reserve 23 Fall alarm
8 Reserve 24 ACC starts alarm after warn
9 Strap removal 25 Door alarm after warn
26 Alarm when ephemeris download
10 Strap connection
fails for 3 times in a row
11 Reserve 27 Reserve
12 Curfew anchor Motion Alarm 28 Reserve
13 Reserve 29 Reserve
14 Reserve 30 Reserve
15 Reserve 31 Reserve

Vital signs data type ID: 05


No. Name Type Number Example
1 The timestamp of the collected data U32 4 6675360C
2 Heart rate value U8 1 45
3 Low pressure value U8 1 32
4 High pressure value U8 1 56
5 Blood oxygen level U8 1 63
Example: 05086675360C45325663

3
Device Status Data Type ID: 06
No. Name Type Number Example
1 4G signal U8 1 1F
2 Battery U8 1 1E
Status( bit 1: motion status (1 motion 0 stationary) , bit 7 :
3 charging status (1 charging 0 not charging ), bit 0 and bit 2-6 : U8 1 03
reserve)
Positioning sequence number (valid when positioning is
4 U8 1 09
triggered)
5 Fuel level (only for car GPS ) U8 1 63
Example: 06051F1E030963

Fingerprint punch-in data type ID: 07


No. Name Type Number Example
1 Punch time U32 4 6675360C
2 Fingerprint ID U32 4 56823466
Example: 07086675360C56823466

Other data type ID: 08


No. Name Type Number Example
The timestamp of the
1 U32 4 6675360C
collected data
2 Step count U16 2 0093
Temperature value
3 ( only valid for new pet FLOAT 4 00340021
GPS )
03040102051403040102051415030401020514
Average movement 03040102051415030401020514030401020514
4 U8[60] 60
value per minute 15030401020514030401020514150304010205
140307
Example:
08446675360C0093003400210304010205140304010205141503040102051403040102051415030401020
514030401020514150304010205140304010 20514150304010205140307
Note: Upload once per hour.

Version Data Type ID: 20


No. Name Type Number Example
1 Status(bit0: automatic
restart; bit1: manual
U8 1 01
restart; bit3: request server
synchronization

4
parameters, the others are
reserved)
Upper version | Lower 58313432343039313930317C3234303930
2 U8[32] 32
version 373031000000000000000000000000
3 ICCID BCD 10 89860848102490501758
Product model, 4G version ,
4 GPS version character U8 1 41
length
4430342C4137363730452D4C4153435F41
Product model, 4G version , STRIN 31313042303141373637304D365F435553
5 *
GPS version G 5F55435653494D2C4154363535385F5552
414E5553352056352E332E302E30
Example:
206F0158313432343039313930317C323430393037303100000000000000000000000008986084810249
05017584 1 4430342 C 4137363730452 D 4 C 4153435 F 4131313042303141373637304 D 365 F
4355535 F 55435653494 D 2 C 4154363535385 F 5552414 E 5553352056352 E 332 E 302 E 30

The server needs to reply after receiving the data from the terminal
After receiving the data uploaded by the terminal, the server replies 02:
Example: "FAAF0020000486392103347538800001FFFD02FAAF".

Server sends data


Functions Instruction Describe
Shutdown of=1 The device will shut down after receive.
Restart rt=1 The device will restart after receive.
Parameter 1: 1 GPS tracking priority, 2 GPS tracking only, 3 WIFI
tracking priority, 4 WIFI tracking only
Parameter 2: Positioning interval during exercise, value range
60-300 (seconds)
Parameter 3: Interval for reporting data after positioning, value
Track tk=1,60,1,180,1
range 0-3600 (seconds)
Time interval for uploading data when not exercising , the value
range is 60-86400 (seconds)
Connected to the platform when not in motion : 1 connected, 0
not connected
Message mg= text msg Devices with screens can display incoming messages
The East Zone is +, the West Zone is -, and the value range is -12
Time Zone tz=8
to +12

IP ip=p.xexun.com:8899 The domain name is p.xexun.com and the port is 8899

"ssid": "xexun": indicates the SSID (network name) of the Wi-Fi.


wificfg={ "ssid":"xexun",
"bssid": "a0:c5:f2:b0:78:e0": indicates the BSSID of the Wi-Fi.
WiFi Data "bssid":
"password": "12345678": indicates the password of the Wi-Fi.
Transfer "a0:c5:f2:b0:78:e0",
"lng": "11402.423828": The longitude of WIFI.
"password":"12345678
"lat": "2234.444092": The latitude of WIFI.
",

5
"lng":"11402.423828","
lat":"2234.444092"}
wifivlcfg={"bssid_list":[" "bssid_list": ["0c:4b:54:3f:29:01","7c:1e:06:82:d5:71"]: List of
0c:4b:54:3f:29:01","7c: nearby Wi-Fi BSSIDs. Can be used to match specific Wi-Fi
WiFi
1e:06:82:d5:71"] , hotspots.
Positioning
"lng":"11402.423828"," "lng": "11402.423828": The longitude of WIFI.
lat":"2234.444092"} "lat": "2234.444092": The latitude of WIFI.
Parameter 1: Alarm ID,
1 "Enter the fence"
The 2 "Exit the fence"
platform alarmid=1,timestamp 3 " Overstaffing alarm "
sends alarm 4 "Gathering alarm"
5 "Speeding alarm"
Parameter 2: The timestamp when the alarm is triggered.
Example:
If you need to send "tk=1,60,1,180,1" to 863921033475388:
FAAF00210001 8639210334753880 00 20 FE47 746b3d312c36302c312c3138302c3100 FAAF
Note: The text “tk=1,60,1,180,1” is converted to string 746b3d312c36302c312c3138302c3100.

The device reply after receiving the server setting command


Example: After receiving "tk=1,60,1,180,1" from the server, terminal 863921033475388 replies :
FAAF0021000186392103347538800006FE476f6bFAAF (OK converted to string is 6f6b) .
Or:FAAF0021000186392103347538800006FE474661696cFAAF ( Fail converted to string is 4661696c) .

6
Example
Positioning and alarm data:
FAAF0020000286392103347538800029FE4700276675360C40C64589CE4217D240A17404D3BF2F550000
8B1D1A2700560064010300782526272301FAAF
Note: FAAF at the beginning and end are flags. 0020 is the uploaded message ID . 0002 is the sequence
number. 8639210334753880 is the IMEI. 0029 is the message body length. FE47 is the checksum of the
entire message .
00276675360C40C64589CE4217D240A17404D3BF2F5500008B1D1A2700560064010300782526272301 is
the body , 00 is the positioning data type, which means the data type is GPS. 27 is the data length.

Remote control message:


FAAF0021000186392103347538800006FE476770733D3100FAAF
Note: FAAF at the beginning and end are flags. 0021 is the message ID sent . 0001 is the sequence number.
8639210334753880 is the IMEI . 0006 is the message body length. FE47 is the checksum of the entire
message . 6770733D3100 is the body, hexadecimal conversion string : GPS=1.

String conversion tool: https://www.bejson.com/convert/ox2str/#google_vignette

7
ECC Check Algorithm
java Code:
public static int checksum ( byte [] data , int len ) {
int sum = 0;
for ( intj =0; len > 1; len --)
{ sum +=
data [j++]&0 xff ;
if (( sum & 0x80000000)>0) {
sum = ( sum & 0xffff ) + ( sum >> 16); }
}
if (len == 1) {
sum += data [ data . length -1]&0
xff ; }
while (( sum >> 16)>0) {
sum = ( sum & 0xffff )​ + sum >> 16; }
sum =( sum == 0xffff ) ? sum & 0xffff​ : (~ sum )&0
xffff ; return sum;
}
C Code :
unsigned short sw_tcp_checksum(unsigned char *data,int len) {
unsigned long sum =0; for (;
len >1; len -= 1)
{
sum += * data ++;
if ( sum &0x80000000)
sum =( sum &0 xffff )+( sum >>16); }
if(len=1)
{
unsigned short i = 0;
*( unsigned char *)(&i)=*( unsigned char *) data ;
sum +=i;
}
while ( sum >> 16)
sum=(sum&0xffff)+sum>>16;
return ( sum ==0 xffff )? sum :~ sum ;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy