Eview Protocol V20200229
Eview Protocol V20200229
OVERVIEW
This document is to explain how the device communicates with the server. And in which
format they communicate. The Command List shows which messages (commands) sent from
the server to the device to request data/information from the device.
Note:
The device uses Epoch & Unix Timestamp. The Unix epoch (or Unix time or POSIX time or
Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight
UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z).
The Byte order is related to little-endian in this document. Such as one Uint32_t a =
0x12345678, then the transmission time in accordance with the byte from low to high order
0x78, 0x56, 0x34, 0x12.
All characters should be recognized as 16-bit HEX as default in this document. The special
cases will be stated if other formats used in this document.
In some Bytes Table there are values in the specific byte which contains a Value Table with
Bit format. They should be converted to Decimal system to give the value. We will point out
all of these in the next version of instruction.
For example: Flag Table for Call Records 3.1.12 Call Records (0x25) – Bit 4-7
All the Bit should be converted from HEX to BIN and compare with its own Bit Table.
The digits (phone number digits) should be converted from HEX to Decimal system one by
one. Then checked by the ASCII char table.
In order to ensure the liability of data transmission, the Server must give response if the ACK
Flag bit marked as “1” after receiving the data. Please check the <The ACK Instruction V1> to
have the detailed information related to ACK.
Both device and server will communicate by raw String. This means a readable text code
should be converted from raw String to HEX or in other formats.
2. STRUCTURE OF MESSAGE
Each message include header, properties length, sequence id, check sum and
Message body, as shown below:
Header (0xAB) 1 Byte
Properties 1 Byte
Length 2 Bytes
Checksum 2 Bytes
Sequence ID 2 Bytes
Message Body N Bytes
2.4 CHECKSUM
Message checksum CRC16 for all bytes of the message body. It takes 2 bytes.
2.5 SEQUENCE ID
Message sequence ID takes 2 bytes. Starting from 0x0100 after device restarted.
Command 1 Byte
Key Length 1 Byte
Key 1 Byte
Key Value N Byte(s)
Key Length 1 Byte
Key 1 Byte
Key Value N Byte(s)
…… ……
Note:
Message Body consists of at least and only one Command and one or more Key
Body. Each Key Body consists of Key Length、 Key and Key Value.
Key Value should be NULL if Key Length is 1.
An example:
“AB 10 0F 00 EB 7E 01 01 02 0D 30 E0 31 37 35 31 32 30 39 31 32 38 39”
AB -->Header
10 -->Properties
0F 00 -->Length
EB 7E -->Checksum
01 01 -->Sequence ID
Message Body
02 -->Command
0D -->Key Length
30 -->Key
E0 -->Function Flag (Set up Authorized Number)
Convert 37 from HEX to Decimal System and we will have 55. Then check the 55th in the ASCII
Char list which is ‘7’.
ASC II Table:
http://www.asciitable.com/
AB -->Header
10 -->Properties
0F 00 -->Length
EB 7E -->Checksum
01 01 -->Sequence ID
Message Body
02 -->Command
0D -->Key Length
30 -->Key
E0 -->Function Flag (Set up Authorized Number)
31 37 35 31 32 30 39 31 32 38 39 --> Authorized number: 17512091289
To reply the ACK from the server
AB 00 03 00 08 C7 01 01 7F 01 00
Head: AB
properties: 00
Encryption: 00
ERR: N/A
ACK: 00
Version: 00
Length: 00 03
CRC: C7 08
Sequence ID: 01 01 (Corresponding Sequence ID)
Command: 7F (Corresponding command)
Key Length: 01
Key: 00 (Refer to Negative Response List)
7F Negative Response
20 GPS location
21 Cell Towers
22 WI-FI towers
23 BLE
30 G-sensor data
31 Activity degree
Remarks:
1. Multiple data with one Command to be sent at once to the server is allowed. Maximum size
of one message is 1KB.
2. The ACK requested data which has returned ACK will be deleted from the device storage.
The ACK requested data which has NO returned ACK will be stored to the device storage. And
will be proceeded together with new updated data in the next time.
1 Length 0xD
2 Key 0x27
2 Key 0x31
3.2.21 Set BLE Location(0x15) for dock. (This is not for the device to store)
Byte No. Parameter Description
1 Length 1 or 8+N
2 Key 0x15
3-6 Latitude
7-10 Longitude
11-N string Describe in English. Maximum 32Bytes
3.3.1 Heartbeat
Byte No. Parameter Description
1 Length 0x02
2 Key 0x10
3 0x5A Fixed data
It can only be sent from the device to the server and sent at the set time interval to
maintain the connection.
Heartbeat with status format: Device ID(0x01) + Heartbeat(0x10) + General
data(0x24). For example:
AB 18 1F 00 AC 33 0B 01 ->Head
03 10 01 38 36 38 38 33 32 30 34 37 30 30 30 31 30 31 ->Device ID
02 10 5A ->Heartbeat
09 24 E4 51 E3 5C 10 00 A9 2C ->General data
The 07B serial devices won’t sent General Data. We will update this part in the
future. Please contact us to confirm if it’s included.
2 Key 0x21
3-4 MCC
5 MNC
6 RXL
7-8 LAC
9-10 CELLID
Byte 6 to Byte 10 will be repeatedly displaying the Cell Tower information if more
Cell Towers detected.
This is scanned Cell Tower information sent from the device
4. ENCRYPTION OPTIONAL
1B 1B 2B 2B 2B 4B 2B 2B NB
4.2 KEY ID
Bit31-24 23~0
Type Key id in keyring
Type Description
0 No use encryption, Key id in keyring invalid.
1 AES Dynamic key(保留)
2 AES static key
3 RSA public key(保留)
4 RSA private key(保留)
4.3 SEQUENCE ID
与 body sequence id 一致
1. Shifted Algorithm
uint16_t crc16_compute(uint8_t const * p_data, uint32_t size, uint16_t const * p_crc)
{
uint16_t crc = (p_crc == NULL) ? 0x0000 : *p_crc;
2. Look-up table
static const uint16_t CRC_Table[ ] = {
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
};
return crc16;
}