Eelink Protocol V2.1
Eelink Protocol V2.1
V2.1
DEVICE PROTOCOL 2.1
REVISION HISTORY
2020/
V2.1.2 Fix the unmatch Param-Set structure
04/13
2019/
V2.0.2 Change datum type of temperature
02/12
2018/
V2.0.0 Initial Release
02/08
TABLE OF CONTENTS
• REVISION HISTORY.
• TABLE OF CONTENTS.
• 1 SUMMARY.
• 1.1 SCOPE.
• 1.2 TERMS.
• 1.3 DESCRIPTION.
• 2 PRINCIPLE.
• 2.1 INTERFACE.
• 2.2 SMS.
• 2.3 IP.
• 2.4 UART.
• 2.5 USER QUERY.
• 3 DATA TYPES.
• 3.1 INTEGER.
• 3.2 STRING.
• 3.3 RAW DATA.
• 3.4 TIME.
• 3.5 STATUS.
• 3.6 POSITION.
• 3.7 BEACON.
• 4 TCP/IP.
• 4.1 USING TCP.
• 4.2 USING UDP.
• 5 PACKAGES.
• 5.1 GENERAL.
• 5.2 LOGIN PACKAGE — 0x01.
• 5.3 HEARTBEAT PACKAGE — 0x03.
• 5.4 LOCATION PACKAGE — 0x12.
• 5.5 WARNING PACKAGE — 0x14.
• 5.6 REPORT PACKAGE — 0x15.
• 5.7 MESSAGE PACKAGE — 0x16.
• 5.8 OBD DATA PACKAGE — 0x17.
• 6.3.16 SPEED.
• 6.3.17 FENCE.
• 6.3.18 SHIFT.
• 6.3.19 SENSOR.
• 6.3.20 SHOCK.
• 6.4 QUERY COMMANDS.
• 6.4.1 VERSION.
• 6.4.2 PARAM.
• 6.4.3 STATUS.
• 6.4.4 STAT.
• 6.4.5 POSITION / 123.
• 6.4.6 WHERE.
• 6.4.7 URL.
• 6.5 PORT COMMANDS.
• 6.5.1 GPIO.
• 6.5.2 PORT.
• 6.6 PEDOMETER COMMANDS.
• 6.6.1 BODY.
• 6.6.2 PDM.
• 6.7 OBD COMMANDS.
• 6.7.1 MONITOR.
• 6.7.2 OBD.
• 6.7.3 OBD,01.
• 6.7.4 OBD,02.
• 6.7.5 OBD,03.
• 6.7.6 OBD,08.
• 6.7.7 OBD,10.
• 6.7.8 OBD,11.
• 6.7.9 OBD,12.
• 6.7.10 OBD,13.
• 6.7.11 OBD,14.
• 6.7.12 OBD,15.
• 6.7.13 OBD,18.
• 6.7.14 OBD,19.
• 6.8 BLE COMMANDS.
• 6.8.1 BLE.
• APPENDIX.
1 SUMMARY
1.1 SCOPE
This document describes the communication protocol between
server and device, and the commands supported in device.
1.2 TERMS
Terms Explanation
Terms Explanation
Terms Explanation
1.3 DESCRIPTION
This document is a full rewritten version on the last version (V1.9)
which is described in Chinese language.
2 PRINCIPLE
2.1 INTERFACE
The device has three external interfaces:
2.2 SMS
The commands, described in this document, are available in text
format. They can be sent in their raw format from user to the
device. After that, the results will be returned to user also in their
raw format.
User Device
<COMMAND>
Processing
<RESULT>
User Device
2.3 IP
The protocol, described in this document, defines the data
packages between server and device. It is based on IP connection
over the cellular. After a IP connection is established between server
and device, the data packages are allowed to be exchanged
between them.
Device Server
Power up or
Disconnected
<LOGIN>
<ACKNOWLEDGE>
loop [ Heartbeat ]
<HEARTBEAT>
<ACKNOWLEDGE>
opt [ Event ]
<REPORT>
Processing
<ACKNOWLEDGE>
Processing
<RESPONSE>
Device Server
2.4 UART
Normally, AT Command Set is running on the serial port. It is a
wired connection. Its workflow is as follows:
Computer Device
Processing
Response (<RESULT>)
OK
Computer Device
AT^MCMD=<COMMAND>
<RESULT>
OK
Processing
3 DATA TYPES
We will see a lot of data later in the following chapters. All of them
belong to a few types. In this chapter, we discuss common data
types used in protocol.
3.1 INTEGER
Integer is the most important data type in protocol. Most data are
represented in an integer, e.g. the data length, the package type,
the satellites number, etc.
3.2 STRING
All strings are coded in UTF-8.
The byte order of a string is always from the first byte to the last
byte.
3.4 TIME
All time are coded as one unsigned 32 bits integer. All of them are
represented in UTC (GMT) time. In another word, they are the time
in time zone 0.
3.5 STATUS
A unsigned 16 bits integer is used to represent the status of device.
The definition of each bits are described as listed below:
Bit Description
1: GPS is fixed
0
0: GPS is not fixed
1: Accelerometer is supported
3
0: No accelerometer
Bit Description
Note:
3.6 POSITION
Position is a compound data type. It contains all data related to
location, e.g. latitude, longitude, altitude, GSM BSID, WLAN BSSID,
etc. In order to get minimum length, it is defined in variable size. It
contains only valid data and eliminates invalid one. A mask is used
to indicate which data are valid.
3.7 BEACON
Beacon is a compound data type. It contains all data related to BLE/
Beacon, e.g. address, signal level, temperature, etc.
Reserved 1 0x00
4 TCP/IP
The protocol between device and server is based on IP network. It
can be based on either TCP or UDP. This chapter describes the
difference between using TCP and using UDP.
Mark 2 ‘EL’
Note:
5 PACKAGES
5.1 GENERAL
In general, the structure of a package is described as below:
Note:
Note:
Note:
Note:
U: 67670100180005035254407167747100200205020500010432000088BD
D: 67670100090005590BD477000103
If device has sent some heartbeat packages and not received any
response, it will cut the corrupt connection and attempt to establish
a new one.
U: 676703000400070188
D: 67670300020007
Note:
U:
67671200410022590BD94203026B940D0C3952AD0021000000000001CC0001A
53F0170F0AB1301890F08000000000000C2D0001C0016000000000000000000
00000000000000
D: 67671200020022
Value Description
0x02 SOS
Value Description
accelerometer)
Note:
U:
6767140024000A590BD54903026B940D0C3952AD0021000400000501CC0001A
53F0170F0AB19020789
D:
676714004A000A534F53E68AA5E8ADA621E5B9BFE4B89CE79C81E6B7B1E59CB
3E5B882E58D97E5B1B1E58CBAE9BD90E6B091E9819333EFBC88E8B79DE5AE87
E998B3E5A4A7E58EA630E7B1B3EFBC89
16 bits integer
Value Description
0x01 ACC on
U:
6767150024000B590BD57103026B940D0C3952AD0021000000000501CC0001A
53F0170F0AB18020789
D: 6767150002000B
Note:
Note:
U:
6767160039000D590BD5AF03026B940D0C3952AD0021000000000501CC0001A
53F0170F0AB17323031383536363232313235300000000000000000313233
D:
6767160056000D323031383536363232313235300000000000000000E5B9BFE
4B89CE79C81E6B7B1E59CB3E5B882E58D97E5B1B1E58CBAE9BD90E6B091E981
9333EFBC88E8B79DE5AE87E998B3E5A4A7E58EA63139E7B1B3EFBC89
The PID data contains many groups. Each group has 5 bytes. The
first byte in a group is the PID code, and following 4 bytes are its
value. For example, 00FFFFFFFF represents that the value of PID00 is
0xFFFFFFFF, 0233445566 represents the value of PID02 if
0x33445566, etc. All standard PIDs are described in Wikipedia OBD-
II PIDs, and all extended PIDs are described in Appendix A.4
Extended OBD-II PIDs.
Note:
For example: 1F001000. The first byte 0x1F represents that all doors
are open. The second byte 0x00 represents that reading gear status
is not supported. The third byte 0x10 represents that car has been
locked. The forth byte 0x00 represents that ACC is off, tire pressure
is normal and no remote key is pressed.
The first byte of fault code is the data type which is always 0x00 by
now. The following bytes have many group. Each group has 3 bytes
which represents a fault. The first 2 bytes in a group are the fault
code which is described by car manufacturer. The third byte in a
group is the fault status (0x01: Determined 0x02: Pending).
For example: 00020502009302. The first byte 0x00 is the data type.
0x020502 and 0x009302 represent there has been 2 faults which are
P0205 and P0093. Both faults have a pending status.
Note:
integer
Note:
U:
67671B009E000500010432009266DF000008053FC0A20341303EFE8110D4144
04C0680185610CEF3A23C8C18154005AB64300BD0AAA845755C0CE331CF0C1B
036478B843D0EA288988320B42D068956405053C11A4588FA38803FD599EC6E
F4B7383D0FC3FB7333919EA637F3D8EFB1D79F9D27B8D7782191146AE344DC0
766F01599EE898BBE5ED3217444DBECA0AB4BADA4B08224A48F235D59759EDE
B2A24EE9C20
D: 67671B0003000500
D: 676780000F5788014C754C7576657273696F6E23
U:
67678000905788014C754C75494D45493A33353235343430373136373734373
10A494D53493A393436303031373331393831373638340A49434349443A3839
3836303131343834313230323133303338320A53595354454D3A4D373630315
F56322E302E350A56455253494F4E3A4D584150505F56322E302E350A425549
4C443A4D617920203520323031372030393A32313A3038
specific recipient
• Other: Reserved
6 COMMANDS
All command keywords are case insensitive, but their parameters
should be case sensitive. For example, “STATUS#” is the same as
“status#”, but “APN,CMNET#” is different from
“APN,cmnet#”.
6.1.1 LOGIN
If a password has been set in device, device is protected. If user
wishes to send a command to a protected device via short
message, it is necessary for him to log in device. After he logs in, he
acquires the privilege to execute a command on device. At last, user
can log out from device by specific command, or will log out
automatically if idle more than 15 minutes.
LOGIN,[PASSWORD]#
> Login OK
> Login Error
6.1.2 LOGOUT
This command requests to log out from device immediately.
LOGOUT#
> Logout OK
> Logout Error
6.1.3 PASSWORD
This command requests to change the password in device.
6.2.1 UPGRADE
This command requests to upgrade the firmware in device.
UPGRADE,[REMOTE],[DOMAIN],[PORT]#
> Upgrade OK
> Upgrade Error
> Upgrade Error: Device busy
> Upgrade Error: Transfer fail
> Upgrade Error: Disk full
> Upgrade Error: File wrong
UPGRADE?
> TRANSFER:[STATE],[BLOCKS]
Name Description
6.2.2 RESET
This command requests to reboot device.
RESET#
> Reset OK
> Reset Error
6.2.3 SHUTDOWN
This command requests to shutdown device. It is valid only if device
does not have an automatic power control system.
SHUTDOWN#
> Shutdown OK
> Shutdown Error
6.2.4 FACTORY
This command requests to restore all settings to default in factory.
FACTORY#
> Factory OK
> Factory Error
6.2.5 PAGING
This command requests to upload a location package (0x12) now.
PAGING#
> Paging OK
> Paging Error
6.2.6 CLEAR
This command requests to clear all pending packages.
CLEAR#
> Clear OK
> Clear Error
6.2.7 LISTEN
This command requests to originate an outgoing call to specific
phone number. The recipient may answer it in order to listen what
is happening.
LISTEN,[NUMBER]#
> Listen OK
> Listen Error
Name Description
6.2.8 RELAY
This command requests to set/unset relay. It is valid only if device
supports a relay.
RELAY,[PATTERN]#
> Relay OK
> Relay Error
RELAY?
> RELAY:[STATE]
Name Description
0: Disable relay
[PATTERN] 1: Enable relay immediately
2: Enable relay safely
[STATE] ON/OFF
Note:
6.2.9 FWD
This command requests to forward a message to specific phone
number. After message is forwarded, all responses from the
recipient in 5 minutes will be sent back to original owner. It can be
used to query some information from service provider, e.g.
remaining fee or network traffic.
FWD,[NUMBER],[CONTENT]#
> Forward OK
> Forward Error
Name Description
6.3.1 IMEI
This command requests to change the IMEI of device.
IMEI,[IMEI]#
> SET IMEI OK
IMEI?
> IMEI:[IMEI]
Name Description
6.3.2 LANG
This command requests to change the language of device.
LANG,[LID]#
> SET LANG OK
> SET LANG Error
LANG?
> LANG:[LNAME]
Name Description
6.3.3 GMT
This command requests to change the time zone of device.
GMT,[E/W],[HOUR],[MINUTE],[DST],[LOCK]#
GMT?
> GMT:[E/W][TZ],[DST]
Name Description
Note:
6.3.4 HBT
This command requests to change the heartbeat timer. This
parameter defines the idle time before device originates a
heartbeat package in TCP session.
HBT,[HBT]#
HBT?
> HBT:[HBT]
Name Description
6.3.5 DELAY
This command requests to change the answer timer. This parameter
defines the delay time before device answers an incoming call.
DELAY,[DELAY]#
> SET DELAY OK
> SET DELAY Error
DELAY?
> DELAY:[DELAY]
Name Description
6.3.6 APN
This command requests to change the APN of GPRS/3G/4G.
APN,[APN],[USERNAME],[PASSWORD]#
> SET APN OK
> SET APN Error
APN?
> APN:[APN],[USERNAME],[PASSWORD]
Name Description
6.3.7 SERVER
This command requests to change the address of location server.
SERVER,[SERVER]#
> SET SERVER OK
> SET SERVER Error
SERVER?
> SERVER:[SERVER]([IP])
Name Description
Note:
6.3.8 COLLECT
This command requests to change the parameters of location
collection. All parameters define how to collect location package
and how many location packages to be cached before they are sent
to server. We have 3 strategies to collect location package.
The third strategy is based on course. When device turns more than
a specific angle, a location package will be generated. [TURN]
defines the angle.
COLLECT,[INTERVAL],[DISTANCE],[TURN],[ACTIVE],[QUANTITY]#
> SET COLLECT OK
COLLECT?
> COLLECT:[INTERVAL],[DISTANCE],[TURN],[ACTIVE],[QUANTITY]
Name Description
6.3.9 MANAGER
This command requests to add/remove/modify one or more
managers in device. Up to 4 managers can be added into device.
MANAGER,[INDEX],[NUMBER],[ALIAS]#
> SET MANAGER OK
> SET MANAGER Error
MANAGER,[INDEX]?
> MANAGER[INDEX]:[NUMBER],[ALIAS]
> GET MANAGER Error
Name Description
Note:
Example Description
6.3.10 AGPS
This command requests to change the address of AGPS server in
device. Now, three AGPS schemes are supported: SUPL, MediaTek
AGPS,[SERVER]#
> SET AGPS OK
> SET AGPS Error
AGPS?
> AGPS:[AGPS]([IP])
Name Description
Note:
6.3.11 GSM
GSM module has 2 states: ON and OFF. OFF is also called flight
mode. When GSM module is OFF, GSM and GPRS will be
disconnected. Normally, we can use this command to save a lot of
power consumption.
GSM,[MODE],[T0],[T1_TOTAL],[T1_WAKING],[T2_PERIODIC],[T2_WAKING
]#
> SET GSM OK
> SET GSM Error
GSM?
>
GSM:[MODE],[T0],[T1_TOTAL],[T1_WAKING],[T2_PERIODIC],[T2_WAKING
],[GSM_RUN]
Name Description
Example Description
Note:
6.3.12 GPS
GPS module has 2 states: ON and OFF. When GPS module is OFF,
GPS chip is closed. Normally, we can use this command to save a
lot of power consumption.
GPS,[MODE],[T0],[T1_TOTAL],[T1_WAKING],[T2_PERIODIC],[T2_WAKING
]#
> SET GPS OK
> SET GPS Error
GPS?
>
GPS:[MODE],[T0],[T1_TOTAL],[T1_WAKING],[T2_PERIODIC],[T2_WAKING
],[GPS_RUN]
Name Description
Example Description
Note:
corresponding description.
6.3.13 ALARM
This command requests to add/remove/modify one or more alarm
clocks in device. Up to 8 alarm clocks can be added into device.
They can be used to do something in specific time.
ALARM,[INDEX],[ACTION],[TIME],[WEEK],[NOTE]#
> SET ALARM OK
> SET ALARM Error
ALARM,[INDEX]?
> ALARM[INDEX]:[ACTION],[TIME],[WEEK],[NOTE]
> GET ALARM Error
Name Description
Name Description
Note:
[ACTION]:
[WEEK]:
• BIT0: Sunday
• BIT1: Monday
• BIT2: Tuesday
• BIT3: Wednesday
• BIT4: Thursday
• BIT5: Friday
• BIT6: Saturday
Example Description
6.3.14 MILEAGE
This command requests to initialize the mileage in device. After the
mileage is initialized, it will be increased automatically when GPS is
fixed.
MILEAGE,[MILEAGE]#
> SET MILEAGE OK
> SET MILEAGE Error
MILEAGE?
> MILEAGE:[MILEAGE](km)
Name Description
6.3.15 MOTION
This command requests to enable/disable motion warning and set
its parameter. After motion warning is enabled, any vibration will
trigger a warning.
MOTION,[SENSE],[DELAY]#
> SET MOTION OK
> SET MOTION Error
MOTION?
> MOTION:[SENSE],[DELAY]
Name Description
[SENSE]:
• 0: Disable warning.
• 1 ~ 9: Enable warning. 1 is the most sensitive, and 9 is the
least sensitive.
Example Description
6.3.16 SPEED
This command requests to enable/disable speed warning and set its
parameter. After speed warning is enabled, any speed not in range
will trigger a warning.
SPEED,[LOW],[HIGH],[OVER]#
> SET SPEED OK
> SET SPEED Error
SPEED?
> SPEED:[LOW],[HIGH],[OVER]
Name Description
Note:
Example Description
Example Description
6.3.17 FENCE
This command requests to add/remove/modify one or more fences
in device. Up to 8 fences can be added into device. Each fence can
be round or rectangle. And it can also be out-type, in-type or
bidirectional. If it is a out-type, the outside of fence is banned. If
device leaves it, an out-of-fence warning will be triggered. If it is a
in-type, the inside of fence is banned. If device enters it, an in-to-
fence warning will be triggered. If it is bidirectional, any action to
cross the border will trigger a warning.
FENCE,[INDEX],[FLAG],[LNG0],[LAT0],[RADIUS]#
FENCE,[INDEX],[FLAG],[LNG1],[LAT1],[LNG2],[LAT2]#
> SET FENCE OK
> SET FENCE Error
FENCE,[INDEX]?
> FENCE[INDEX]:[FLAG],[LNG0],[LAT0],[RADIUS]
> FENCE[INDEX]:[FLAG],[LNG1],[LAT1],[LNG2],[LAT2]
Name Description
Note:
[FLAG]:
Example Description
Setup fence 1
FENCE,1,CR,,,500# (bidirectional, round)
round last fixed position
Setup fence 1
FENCE,1,CR,113.5,22.5,500# (bidirectional, round)
round specific position
Setup fence 1
FENCE,1,CS,113.2,22.2,113.8,22.8#
(bidirectional, rectangle)
Example Description
6.3.18 SHIFT
This command requests to enable/disable a shift fence in device.
Shift fence is an automatic fence. It becomes valid whenever ACC is
OFF, and returns invalid when ACC is ON. When ACC is OFF and car
moves out of it, a shift warning will be triggered.
SHIFT,[RADIUS]#
> SET SHIFT OK
> SET SHIFT Error
SHIFT?
> SHIFT:[RADIUS]
Name Description
[RADIUS]:
Note:
6.3.19 SENSOR
This command requests to enable/disable sensor warnings and set
their parameter. If a sensor warning is enabled and the actual value
of the sensor is beyond the limits, a relevant warning will be
triggered.
SENSOR,[NAME],[LOW],[HIGH],[DELAY]
> SET SENSOR OK
> SET SENSOR ERROR
SENSOR?
Temperature:[LOW],[HIGH],[DELAY],[VALUE]
Light:[LOW],[HIGH],[DELAY],[VALUE]
TS:[CHIP]
LS:[CHIP]
Name Description
Name Description
[NAME]:
• T: Internal Temperature
• H: Humidity
• L: Light
• C: CO2
• P: Probe Temperature
Note:
6.3.20 SHOCK
This command requests to enable/disable shock warning and set its
parameter. After shock warning is enabled, any vibration beyond its
threshold will trigger a warning.
SHOCK,[SENSE]#
> SET SHOCK OK
> SET SHOCK Error
SHOCK?
> SHOCK:[SENSE]
Name Description
[SENSE]:
• 0: Disable warning.
• non-zero: Enable warning. e.g. 1.7 means that the shock
warning will be triggered after the vibration is beyond 1.7g.
Example Description
6.4.1 VERSION
This command requests to return the firmware version in device.
VERSION#
VERSION?
> IMEI:[IMEI]
IMSI:[IMSI]
ICCID:[ICCID]
SYSTEM:[SYS VERSION]
VERSION:[APP VERSION]
BUILD:[BUILT TIME]
Name Description
Name Description
Note:
Example Result
IMEI:354188046036385
IMSI:9460016668297433
ICCID:89860116851009444751
VERSION#
SYSTEM:M6130_V2.0.5
VERSION:MXAPP_V2.0.5
BUILD:Apr 26 2017 17:35:13
6.4.2 PARAM
This command requests to return major parameters in device.
PARAM#
PARAM?
> IMEI:[IMEI]
APN:[APN]
SERVER:[SERVER]
COLLECT:[TIMERS]
LANG:[LNAME]
GMT:[GMT]
SAVING:[SAVING]
Name Description
Example Result
IMEI:354188046036385
APN:cmnet
SERVER:”tcp://hzgps.sky200.com:32001”
PARAM# COLLECT:60,0,0,0,1
LANG:CN
GMT:E12.00
SAVING:0
6.4.3 STATUS
This command requests to return current status in device.
STATUS#
STATUS?
> BATTERY:[BATTERY]
GPRS:[GPRS]
GSM:[GSM],[SIGNAL]
GPS:[GPS],[SATELLITE]
ACC:[ACC]
RELAY:[RELAY]
POWER:[POWER]
MS:[MS]
Name Description
Name Description
Note:
Example Result
BATTERY:100%
GPRS:CLOSED
GSM:MED,22
STATUS# GPS:FIXED,6
ACC:ON
RELAY:OFF
MS:LIS3DH
6.4.4 STAT
This command requests to return current statistics in device.
STAT#
STAT?
> MILEAGE:[MILEAGE]
BOOTUP:[BOOTUP COUNT]
UPLOAD:[UPLOAD AMOUNT]
DOWNLOAD:[DOWNLOAD AMOUNT]
POWER:[POWER TIME]
ACC:[ACC TIME]
GPS:[GPS TIME]
Name Description
[DOWNLOAD
The total amount of download data
AMOUNT]
Note:
Example Result
STAT# MILEAGE:0.36(km)
Example Result
BOOTUP:13
UPLOAD:0KB
DOWNLOAD:0KB
POWER:0D01:25
ACC:0D02:28
GPS:0D01:25
POSITION#
POSITION?
123
> [ADDRESS]
> [URL]
Name Description
Note:
Example Result
http://maps.google.com/?q=22.555525,113.940147
<0.9km/h 0.0>
POSITION#
<2017-05-02 22:13:03>
IMEI:354188046036385
http://maps.google.com/?q=22.555525,113.940147
<0.5km/h 0.0>
123
<2017-05-02 22:13:10>
IMEI:354188046036385
6.4.6 WHERE
This command requests to return the recent coordinate of device.
WHERE#
WHERE?
> Lat:[LATITUDE]
Lon:[LONGITUDE]
Course:[COURSE]
Speed:[SPEED]
DateTime:[DATETIME]
Name Description
Name Description
Example Result
Lat:N22.55552
Lon:E113.94014
WHERE# Course:0.0
Speed:0.2km/h
DateTime:2017-05-02 22:19:14
6.4.7 URL
This command requests to return the google URL of device.
URL#
URL?
> [URL]
Name Description
Example Result
http://maps.google.com/?q=22.555525,113.940147
URL# <0.0km/h 0.0>
<2017-05-02 22:20:34>
Example Result
IMEI:354188046036385
6.5.1 GPIO
This command requests to setup external GPIOs.
GPIO,[TIN],[TOUT],[PULL]#
> SET GPIO OK
> SET GPIO Error
GPIO?
> GPIO:[TIN],[TOUT],[PULL]
Name Description
Note:
Example Description
6.5.2 PORT
This command requests to write external output GPIOs or read
external input GPIOs and ADCs.
PORT,[DOUT],[MASK]#
> Port OK
PORT?
> DIN:[DIN]
DOUT:[DOUT]
AIN1:[AIN1]
AIN2:[AIN2]
Name Description
Note:
Example Description
DIN:0100
DOUT:1000
PORT?
AIN1:1200
AIN2:0
6.6.1 BODY
This command requests to set the height and weight of user, which
will be used in the calculation of pedometer.
BODY,[HEIGHT],[WEIGHT]#
> SET BODY OK
> SET BODY Error
BODY?
> HEIGHT:[HEIGHT](cm)
> WEIGHT:[WEIGHT](kg)
Name Description
Name Description
Example Description
HEIGHT:160(cm)
BODY?
WEIGHT:70(kg)
6.6.2 PDM
This command requests to clear or return all statistics in pedometer.
PDM#
> PDM OK
> PDM Error
PDM?
> TOTAL:
STEPS:[A_STEPS]
TIME:[A_TIME]
DISTANCE:[A_DISTANCE](km)
ENERGY:[A_ENERGY](kCal)
TODAY:
STEPS:[T_STEPS]
TIME:[T_TIME]
DISTANCE:[T_DISTANCE](km)
ENERGY:[T_ENERGY](kCal)
Note:
Name Description
Example Description
TOTAL:
STEPS:126580
TIME:25:20
DISTANCE:34.73(km)
PDM? ENERGY:2387.17(kCal)
TODAY:
STEPS:3618
TIME:0:49
DISTANCE:3.28(km)
Example Description
ENERGY:261.50(kCal)
6.7.1 MONITOR
This command requests to setup which PIDs should be monitored
by OBD module.
MONITOR,[PIDS]#
> SET MONITOR OK
> SET MONITOR Error
MONITOR?
> MONITOR:[PIDS]
Name Description
Note:
Example Description
6.7.2 OBD
This command requests to communicate with OBD module. It
contains a group of secondary commands. We will discuss general
information in this section, and enumerate all secondary commands
in following sections.
OBD,[CODE],[ARG]#
> OBD,[CODE],[RST],[DATA]
Name Description
[CODE]:
[ARG]:
[RST]:
• 00 — Success
• 01 — Timeout
• 02 — Invalid command code
• 03 — Invalid command arguments
• 04 — Communication error with vehicle
[DATA]:
6.7.3 OBD,01
This command requests to get the firmware version of OBD
module.
OBD,01#
> OBD,01,00,5100003C0000
[ARG]: None
[DATA]: The firmware version — 0x5100003C0000.
6.7.4 OBD,02
This command requests to get the serial number of OBD module.
OBD,02#
> OBD,02,00,066CFF575454834987114547
[ARG]: None
[DATA]: The serial number — 0x066CFF575454834987114547.
6.7.5 OBD,03
This command requests to get the VIN.
OBD,03#
> OBD,03,00,3132333435363738394142434445464748
[ARG]: None
[DATA]: The VIN — 123456789ABCDEFGH.
6.7.6 OBD,08
This command requests to set the model of vehicle. It is necessary
to enable nonstandard OBD features, e.g. body status, fual
consumption, etc.
OBD,08,0000#
> OBD,08,00,0000
0100 Volkswagen
0200 GM
0300 Ford
0400 Toyota
0500 Honda
0600 Nissan
0700 Kia
0800 Hyundai
0900 BMW
0A00 Mercedes-Benz
0B00 Subaru
0C00 Mitsubishi
0D00 Renault
0E00 Peugeot
1000 Volvo
1100 Ssangyong
Note:
6.7.7 OBD,10
This command requests to get the PIDs supported in vehicle.
OBD,10#
> OBD,10,00,00FFFFFFFF20FFFFE000
[ARG]: None
[DATA]: The standard data that describes which PIDs are supported.
The standard data contains many groups. Each group has 5 bytes.
The first byte in a group is the PID code, and following 4 bytes are
its value. For example, 00FFFFFFFF represents that the value of
PID00 is 0xFFFFFFFF, 0233445566 represents the value of PID02 is
0x33445566, etc. All standard PIDs are described in Wikipedia OBD-
II PIDs, and all extended PIDs are described in Appendix A.4
Extended OBD-II PIDs.
More detail about the data format can be also found in Wikipedia
OBD-II PIDs.
In above example:
PID00: FFFFFFFF
PID20: FFFFE000
6.7.8 OBD,11
This command requests to read the value of specific PIDs from
vehicle.
OBD,11,0020408A8B0C0D0E#
>
OBD,11,00,00FFFFFFFF20FFFFFFFF40FFFFFFFF8A000000008B000000000C4
E2000000D660000000E33445566
The standard data contains many groups. Each group has 5 bytes.
The first byte in a group is the PID code, and following 4 bytes are
its value. For example, 00FFFFFFFF represents that the value of
PID00 is 0xFFFFFFFF, 0233445566 represents the value of PID02 is
0x33445566, etc. All standard PIDs are described in Wikipedia OBD-
II PIDs, and all extended PIDs are described in Appendix A.4
Extended OBD-II PIDs.
More detail about the data format can be also found in Wikipedia
OBD-II PIDs.
In above example:
PID00: FFFFFFFF
PID20: FFFFFFFF
PID40: FFFFFFFF
PID8A: 00000000
PID8B: 00000000
PID0C: 4E200000 — Engine RPM = (A * 256 + B) / 4 = ((0x4E * 256)
+ 0x20) / 4 = 5000rpm
PID0D: 66000000 — Vehicle speed = A = 0x66 = 102km/h
PID0E: 33445566
6.7.9 OBD,12
This command requests to get the PIDs supported in the freeze
frame of vehicle.
OBD,12#
> OBD,12,00,004455667720445566774044556676
[ARG]: None
[DATA]: The standard data that describes which PIDs are supported.
The standard data contains many groups. Each group has 5 bytes.
The first byte in a group is the PID code, and following 4 bytes are
its value. For example, 00FFFFFFFF represents that the value of
PID00 is 0xFFFFFFFF, 0233445566 represents the value of PID02 is
0x33445566, etc. All standard PIDs are described in Wikipedia OBD-
II PIDs, and all extended PIDs are described in Appendix A.4
Extended OBD-II PIDs.
More detail about the data format can be also found in Wikipedia
OBD-II PIDs.
In above example:
PID00: 44556677
PID20: 44556677
PID40: 44556676
6.7.10 OBD,13
This command requests to read the value of specific PIDs from the
freeze frame of vehicle.
OBD,13,0C0E1C1E#
> OBD,13,00,0C445566770E445566771C445566771E44556677
The standard data contains many groups. Each group has 5 bytes.
The first byte in a group is the PID code, and following 4 bytes are
its value. For example, 00FFFFFFFF represents that the value of
PID00 is 0xFFFFFFFF, 0233445566 represents the value of PID02 is
0x33445566, etc. All standard PIDs are described in Wikipedia OBD-
II PIDs, and all extended PIDs are described in Appendix A.4
Extended OBD-II PIDs.
More detail about the data format can be also found in Wikipedia
OBD-II PIDs.
In above example:
PID0C: 44556677
PID0E: 44556677
PID1C: 44556677
PID1E: 44556677
6.7.11 OBD,14
This command requests to get the fault code.
OBD,14#
> OBD,14,00,00
> OBD,14,00,00020502009302
[ARG]: None
[DATA]: The fault code (see Section 5.10 OBD FAULT PACKAGE —
0x19)
6.7.12 OBD,15
This command requests to clear the fault code.
OBD,15#
> OBD,15,00,01
> OBD,15,00,00
[ARG]: None
[DATA]: The result of action — 01: Success 00: Failed
6.7.13 OBD,18
This command requests to get the vehicle body status.
OBD,18#
> OBD,18,00,1F001000
[ARG]: None
[DATA]: The vehicle body status (see Section 5.9 OBD BODY
PACKAGE — 0x18)
6.7.14 OBD,19
This command requests to control some vehicle body status.
OBD,19,0100#
> OBD,19,00,01
> OBD,19,00,00
• BYTE1:
◦ 0x01: Central locking
◦ 0x02: Horn
◦ 0x03: Emergency light
◦ 0x04: Windows
• BYTE2:
◦ 0x00: Turn off
◦ 0x01: Turn on
6.8.1 BLE
This command requests to setup BLE working parameters.
BLE,[MODE],[SCAN_INTERVAL],[ADV_INTERVAL],[UPD_PERIOD]#
BLE?
>
BLE:[MODE],[SCAN_INTERVAL],[ADV_INTERVAL],[UPD_PERIOD],[BLE_ADD
R]
Name Description
Note:
Example Description
Example Description
APPENDIX
sum16.h:
#ifndef __SUM16_H__
#define __SUM16_H__
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(__cplusplus)
}
#endif
#endif // __SUM16_H__
sum16.c:
#include "sum16.h"
return(sum16);
}
deflate.h:
#ifndef __DEFLATE_H__
#define __DEFLATE_H__
#if defined(__cplusplus)
extern "C" {
#endif
typedef struct
{
/// Default is 130 (from 4 to 258). The larger
value, the more memory used in compression.
unsigned short maxLength;
/// Default is 65535 (from 4 to 65535). The larger
value, the slower speed in compression.
unsigned short maxOffset;
/// Memory alloc function
void * (*malloc)(unsigned int);
/// Memory free function
void (*free)(void *);
} mx_ezconfig;
#if defined(__cplusplus)
}
#endif
#endif // __DEFLATE_H__
deflate.c:
#include <mem.h>
#include <stdlib.h>
#include "deflate.h"
typedef struct
{
int symbol;
unsigned int count;
unsigned short child0;
unsigned short child1;
} ez_node;
typedef struct
{
// I/O stream
unsigned char *ioPtr;
unsigned int ioPos;
// Work buffer
ez_node *pNodes;
unsigned int nNodes;
} ez_context;
ptr = ctx->ioPtr;
left = ctx->ioPos + 1;
result = 0;
while (bits >= left)
{
result = (result << left) | (*ptr &
ez_mask[left]);
bits -= left;
left = 8;
ptr++;
}
if (bits > 0)
{
result = (result << bits) | ((*ptr >> (left -
bits)) & ez_mask[bits]);
left -= bits;
}
ctx->ioPtr = ptr;
ctx->ioPos = left - 1;
return(result);
}
ptr = ctx->ioPtr;
pos = ctx->ioPos;
ctx->ioPtr = ptr;
ctx->ioPos = pos;
return(result);
}
node = &ctx->pNodes[ctx->nNodes++];
if (ez_readBit(ctx))
{
// Read symbol for leaf node
node->symbol = ez_readBits(ctx, 9);
node->child0 = 0;
node->child1 = 0;
}
else
{
// Read branch
node->symbol = -1;
node->child0 = ez_readTree(ctx) - ctx->pNodes;
node->child1 = ez_readTree(ctx) - ctx->pNodes;
}
return(node);
}
node = ctx->pNodes;
while (node->symbol < 0)
{
if (ez_readBit(ctx))
node = ctx->pNodes + node->child1;
else
node = ctx->pNodes + node->child0;
}
return(node->symbol);
}
char *dst)
{
int symbol;
unsigned int length, offsetH, offsetL;
unsigned char *ptr1, *ptr2;
ptr1 = dst;
while (1)
{
symbol = ez_readSymbol(ctx);
if (symbol == EZ_END_SYMBOL)
break;
return(ptr1 - dst);
}
if (cfg == NULL)
cfg = &ez_cfg;
memset(&ctx, 0, sizeof(ctx));
memset(ctx.pNodes, 0, (2 * 512 - 1) *
sizeof(ez_node));
ez_readTree(&ctx);
result = ez_decode(&ctx, dst);
END:
if (ctx.pNodes != NULL)
(*cfg->free)(ctx.pNodes);
return(result);
}
A.3 PARAM-SET
There are many parameters in device and all of them are stored in
non-volatile memory. Server can read them by the above
commands. However, the reading is slow because of the poor
performance of IP connection over the cellular. Moreover,
sometimes, there is no response because device is offline due to
weak signal. As a result, user often has a bad experience to access
the parameters he wishes to know.
(see note 4)
T_INITIAL 2 1 Reserved
T_PERIODIC 2 1 Reserved
T_WAKING 2 1 Reserved
W_MASK 4 1 Reserved
W_MESSAGE 4 1 Reserved
W_SOCKET 4 1 Reserved
related to command
“MOTION?”
DOWN 2 1 Reserved
LACK 2 1 Reserved
ACC 2 1 Reserved
“MONITOR?”
LOW 4 1 Reserved
HIGH 4 1 Reserved
DELAY 2 1 Reserved
Note:
1. Flag of device:
BIT12: Fuel is cut (relay is triggered)
Other: Reserved
2. Style of device:
BIT00: LED always works (never sleep)
Other: Reserved
3. Flag of GSM module:
BIT00, BIT01: Work mode (see Section 6.3.11
GSM)
Other: Reserved
5km/h)
8A Odometer km X
(X - 0x8000) / 10
Remaining fuel (see
8B % Valid only if (X ≥
note 1)
0x8000)
X / 10
Remaining fuel (see
8B l Valid only if (X <
note 2)
0x8000)
Note: