0% found this document useful (0 votes)
52 views21 pages

Driver Aid Serial Protocol

The document describes a communication protocol for a Driveraid device. It connects to terminals and GPS devices via RS232 serial communication. The protocol uses a unified message frame format with start/end flags, verification code, sequence number, and function codes to control the Driveraid and exchange data and events. It allows settings parameters, retrieving real-time data, updating firmware, and transmitting multimedia content between the Driveraid and connected devices.

Uploaded by

Behnam Ganji
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)
52 views21 pages

Driver Aid Serial Protocol

The document describes a communication protocol for a Driveraid device. It connects to terminals and GPS devices via RS232 serial communication. The protocol uses a unified message frame format with start/end flags, verification code, sequence number, and function codes to control the Driveraid and exchange data and events. It allows settings parameters, retrieving real-time data, updating firmware, and transmitting multimedia content between the Driveraid and connected devices.

Uploaded by

Behnam Ganji
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/ 21

Driveraid RS232

Communication Protocol Document

version 1.0

Tensortec
May 14th 2018
1 / 21

Document Update Record

Date Update content Upate person

2018/05/14 Establishment Galen Wang 汪国樑

Tensortec(Shenzhen China)
2 / 21

Catalog
1. Product Introduction ................................................................................................................. 3
1.1 Software Connection ..................................................................................................... 3

1.2 Hardware Connection.................................................................................................... 4


2. Protocol Introduction ................................................................................................................ 5
2.1 RS232 Communication Parameters .............................................................................. 5

2.2 Command Communicate Protocol ................................................................................ 5

2.2.1 Message Frame Unified Format ........................................................................ 5

2.2.2 Function Code List ............................................................................................ 6

2.2.3 Setting System Parameter Command ................................................................ 7

2.2.4 Real Time Data Command .............................................................................. 10

2.2.5 Event (Warning) Report .................................................................................. 11

2.2.6 Require for multimedia data command ........................................................... 13

2.2.7 Transfer multimedia data command ................................................................ 14

2.3 GPS communicate protocol......................................................................................... 15

2.3.1 Protocol Overview ........................................................................................ 16

2.3.2 VTG ................................................................................................................ 16

2.3.3 GPS receive interactive ............................................................................... 17


3. Apply Filed ............................................................................................................................. 18
3.1 Low Speed No Warning .............................................................................................. 18

3.2 Snapshot Once Warning .............................................................................................. 20

Tensortec(Shenzhen China)
3 / 21

1. Product Introduction

1.1 Software Connection

Figure 1, Driveraid Product Logic Connection


Remark:
1. The connection between Driveraid and terminal as well as GPS is based on RS232 serial
protocol
2. GPS Tracker complies with NMEA Protocal-0183 Standard;
3. Interaction between Driveraid and GPS is one-way communication;
4. Intraction protocol between Driveraid and terminal is dual-way communication;
5. Driveraid can only keep communicate with one terminal or GPS at a time

Tensortec(Shenzhen China)
4 / 21

1.2 Hardware Connection

Figure 1 UART RS232 Hardware Connection

Electrical Characteristics

Ma
Parameter/Condition Min Typical x Unit
Supply voltage 9 12 28 V
Operating current/ VDDIN=12V 300.0 380.0 450.0 mA
Receiver inputs/232_RXD
Input Voltage Range -25 +25 V
Input Threshold Low 0.6 1.1 V
Input Threshold High 2.0 2.4 V
Transmitter Outputs/232_TXD

Tensortec(Shenzhen China)
5 / 21

Output Voltage Swing ±5 ±5.4 V


Output Short-Circuit Current ±60 mA
Figure 2 Electrical Characteristics

2. Protocol Introduction

2.1 RS232 Communication Parameters

 Baud rate:115200
 Data bit:8
 Verify bit: none
 Stop bit:1

2.2 Command Communicate Protocol

2.2.1 Message Frame Unified Format

The command communication message format that Driveraid supports is designed as follows:

Start Verify Sequence Manufacturer Driveraid Function Data Content End

Flag Code Number Code ID code Flag

8 bits 8 bits 16 bits 16 bits 8 bits 8 bits 8 * n bits 8 bits

0x7E See See See remark 0x65 See See remark 0x7E

remark remark remark

Remarks:

Tensortec(Shenzhen China)
6 / 21

(1) Flag: represented by bit 0x7E. If there is 0x7E in verify code, message head or

body, escaping is required. Escaping rules are as following:

0x7E ——> 0x7D followed by 0x02

0x7D ——> 0x7D followed by 0x01

Escaping process:

Message Sending: Packaging ——> Calculating and filling verify code——>

Escaping.

Message Receiving: Escaping restore ——> Check if verify code is right ——>

Parsing.

Example: Sending 0x30 0x7E 0x08 0x7D 0x55

After processing 0x7E 0x30 0x7D 0x02 0x08 0x7D 0x01 0x55 0x7E

(2) Verify code: accumulate the bytes from “Manufacturer ID” to “Data”, and the

verify code = sum & 0x000000FF (get the low 8 bits of sum as verify code).

(3) Sequence number: Message sending sequence (Incrementing step is 1).

(4) Manufacturer ID: Terminal code.

(5) Deriveraid ID:Driveraid 0x65.

(6) Data content: refer to communicate definition.

2.2.2 Function Code List

Function Definition Description and requirement


code
0x2F Query command For terminal to check if there is Driveraid
0x30 Restore default For terminal to restore factory setting of Driveraid
parameter command
0x31 Real time data For terminal to send data like speed, time, location and
command vehicle state.
0x32 Query Driveraid basic For terminal to check Driveraid info like manufacturer,
information product code, version, product ID and so on.
0x33 Update Driveraid For update data interaction
Program
0x34 Query parameter For terminal to check Driveraid parameter

Tensortec(Shenzhen China)
7 / 21

0x35 Setting parameter For terminal to set Driveraid parameter


0x36 Event/warning report For Driveraid to report event/warning data to terminal
0x37 Driveraid state query For terminal to check Driveraid working state
0x38 Driveraid state report For Driveraid to report working state
0x50 Require multimedia For terminal to require multimedia data from Driveraid
data
0x51 Upload multimedia For Driveraid to upload multimedia data to terminal
data
0x52 Snapshot commend For terminal to command Driveraid to take photo
immediately

2.2.3 Setting System Parameter Command

Function code:0x35
Function: the code is for terminal to require Driveraid to set system parameter, as well as for
Driveraid to send back reaction.
Command: Format definite as following:

Driveraid ID Function code Data area


0x65 0x35 See system parameter format
Figure 3 Setting System Parameter Command Format
Start byte Field Data type Description and instruction
0 Enable warning BYTE km/h, value scope:0~60 , default 30.
speed threshold Means it won’t be warning when vehicle
speed lower than the choosing threshold.
0xFF means do not change this parameter
1 Warning sound BYTE 0~8, Max. 8; silence 0; default 6
volume 0xFF means do not change this parameter
2 Initiative snapshot BYTE 0x00:no photo
strategy 0x01: fix time snapshot
0x02: fix distance snapshot
0x03: trigger snapshot by insert SD card
0x04: reserved
Default value is 0x00
0xFF means do not change this parameter
3 initiative fix time WORD unit: second, value scope:0~60000,
snapshot time default 36000 means do not snapshot.
interval 0xFF means do not change this parameter.
Valid when initiative snapshot strategy is
01.
5 initiative fix distance WORD Unit: meter, value scope 0~60000, default
snapshot distance 2000 means do not snapshot.

Tensortec(Shenzhen China)
8 / 21

interval 0xFF means do not change this parameter.


Valid when initiative snapshot strategy is
02.
7 photo amount each BYTE Value scope 1~10, default 3. 0xFF means
initiative snapshot do not change this parameter
8 Time interval of BYTE Unit 100ms, value scope 1~5, default 2.
each initiative 0xFF means do not change this parameter
snapshot
9 photo definition BYTE 0x01:352×288
0x02:704×288
0x03:704×576
0x04:640×480
0x05:1280×720
0x06:1920×1080
Default 0x01,
0xFF means do not change this parameter.
The definition parameter is also suite for
warning trigger snapshot.
10 video definition BYTE 0x01: CIF
0x02: HD1
0x03: D1
0x04: WD1
0x05:720P
0x06:1080P
Default, 0x01
0xFF means do not change this parameter
The definition parameter is also suite for
warning trigger video shot.
11 Reserved byte BYTE[10] Reserved as spare parameter, in case there
will be extent to locate un-solo warning
type.
21 Smoking warning WORD Unit second, value scope 0~3600, default
judgement time 180. Means during this time it will only
interval trigger smoking warning one time.
0xFF means do not change this parameter
23 Calling warning WORD Unit second, value scope 0~3600, default
judgment time 120. Means during this time it will only
interval trigger calling warning one time.
0xFF means do not change this parameter
25 (Before&after) BYTE Unit second, scope 0~60, default 50.
fatigue driving video 0xFF means do not change this parameter
shoot time
26 Fatigue driving BYTE Value scope 0~10, default 30 means no
photo shoot amount snapshot.

Tensortec(Shenzhen China)
9 / 21

0xFF means do not change this parameter


27 Fatigue driving BYTE Unit 100ms, value scope 1~5, default 2
warning snapshot 0xFF means do not change this parameter
interval time
28 Reserved BYTE Reserved byte
29 (Before&after) BYTE Unit second, value scope 0-60, default 50,
calling waring video 0xFF means do not change this parameter
shoot time
30 Calling waring BYTE Value scope,1-10. Default 30 means no
snapshot (for driver snapshot.
expression features) 0xFF means do not change this parameter
photo amount
31 Calling waring BYTE Unit 100ms, value scope 1~5, default 2.
snapshot (for driver 0xFF means do not change this parameter
expression features)
time interval
32 (Before&after) BYTE Unit second, value scope 0-60, default 50.
smoking waring 0xFF means do not change this parameter
video shoot time
33 Smoking waring BYTE Value scope 1-10, default 30 means no
snapshot (for driver snapshot.
expression features) 0xFF means do not change this parameter
photo amount
34 Smoking waring BYTE Unit 100ms,value scope 1~5, default 2.
snapshot (for driver 0xFF means do not change this parameter
expression features)
time interval
35 (Before&after) BYTE Unit second, value scope 0-60, default 50.
warning video shoot 0xFF means do not change this parameter
time
36 Distraction warning BYTE Value scope 1-10,default 30 means no
snapshot photo snapshot.
amount 0xFF means do not change this parameter
37 distraction warning BYTE Unit 100ms, value scope 1~5, default 2.
snapshot time 0xFF means do not change this parameter
interval
38 abnormal driving BYTE Unit second, value scope 0-60, default 50.
video shoot time 0xFF means do not change this parameter
39 abnormal driving BYTE Value scope 1-10, default 30 means no
snapshot photo snapshot, 0xFF means do not change this
amount parameter
40 abnormal driving BYTE Unit 100ms, value scope 1~5, default 2.
snapshot time default 2.
interval 0xFF means do not change this parameter

Tensortec(Shenzhen China)
10 / 21

41 Reserved byte BYTE[2]


Figure 4 System Parameter Format

React:(format definition as following)

Driveraid ID Function code Data area


0x65 0x35 1 byte:0--successful,1--failed
Figure 5 React setting system parameter command format
Time sequence (interactive process)

Figure 5 Seting system parameter interactive

2.2.4 Real Time Data Command

Function Code:0x31
Function: Terminal send real time data to Driveraid, while Driveraid no need sends back
reaction.
Command: (format definition as following)
1. Real time data command format
Driveraid ID Function code Data area
0x64 0x31 See real time data content
format
Figue 2. Real time data content format
Start byte field Data type Description and introduction
0 Vehicle speed BYTE Unit km/h
1 Reserved BYTE
2 Mileage DWORD Unit 0.1km, Scope 0~99999999
6 reserved BYTE[2]
8 Elevation WORD Altitude, unit in meter
10 Latitude DWORD Multiply the latitude value in degrees by
10 to the power of 6 to the nearest

Tensortec(Shenzhen China)
11 / 21

millionth of a degree
14 Longitude DWORD Multiply the longitude value in degrees by
10 to the power of 6 to the nearest
millionth of a degree
18 Date and time BCD[6] YY-MM-DD-hh-mm-ss (FGMT+8 time)
24 Vehicle state WORD Indicates other vehicles state by bit.
Bit0 ACC state, 0:off,1:on
Bit1 turn left,0:off,1:on
Bit2 turn right, 0:of,1:on
Bit3 Wiper state, 0:off,1:on
Bit4 Brake State,0:Unbraked,1:Braked
Bit5 SD Card State , 0:not insert ,
1:inserted
Bit6~Bit9 Customize
Bit10 Location state,0: not locate, 1:
located
Bit11~bit15 Customize

Time sequence (interactive process)

Figure 2 Real time data interactive

2.2.5 Event (Warning) Report

Function code: 0x36


Function: the code is for Driveraid upload event&warning to terminal, as well as for terminal to
send back reaction.
Command: format definite as following:
Figure 3. Event and warning command format
Driveraid ID Function code Data area
0x65 0x36 See Event and warning content
format

Tensortec(Shenzhen China)
12 / 21

Figure 4. Event and warning content format


Start byte Field Data type Description and introduction
0 Warning ID DWORD In accordance with the warning sequence,
the cycle starts from 0.
4 Flag state BYTE 0x00: not available
0x01: start flag
0x02: end flag
The byte is only for warning or event type
that have both start and end flag; if no
start or end flag, the byte is not available,
input 0x00.
5 Warning/event BYTE 0x01: Fatigue driving warning
type 0x02: Calling warning
0x03: Smoking warning
0x04: Distraction warning
0x05: Deriver abnormal warning (not
support yet)
0x06~0x0F: customize warning (not
support yet)
0x10: initiative event snapshot (not
support yet)
0x11: Change driver (not support yet)
0x12~0x1F: customize (not support yet)

6 Fatigue degree BYTE Indicates the degree of fatigue, ranging


from 1 to 10, the greater the value, the
more severe the fatigue.
Only valid when the alarm type is 0x01.
7 Reserved BYTE[4]
11 Vehicle speed BYTE Unit Km/h,scope 0~250
12 Elevation WORD Altitude, unit in meter
14 Latitude DWORD Multiply the latitude value in degrees by
10 to the power of 6 to the nearest
millionth of a degree
18 longitude DWORD Multiply the longitude value in degrees by
10 to the power of 6 to the nearest
millionth of a degree
22 Date and time BCD[6] YY-MM-DD-hh-mm-ss (GMT+8 time)
28 Vehicle state WORD
30 warning attached BYTE >= 0
multimedia
information list
total amount
31 multimedia Refer to media information list format

Tensortec(Shenzhen China)
13 / 21

information list
Figure 5. Media information list format
Start byte Field Data type Description and introduction
0 Multimedia type BYTE 0x00: picture
0x01: audio
0x02:video
1 Multimedia ID DWORD >0

React: (Format definition as following)


Event 3. Event and warning react format
Driveraid ID Function code Data area
0x65 0x36 null

Time sequence (interactive process)

Figure 3. Eevent and warning interactive

2.2.6 Require for multimedia data command

Function code:0x50
Function: the code is for terminal require multimedia data from Driveraid, as well as for
Driveraid send back the command react to terminal.
Command: format definite as following

Driveraid ID Function code Data area


0x65 0x50 See multimedia require format
Figure 6 require multimedia data command format
Start byte Field Data type Description and introduction
0 Message ID BYTE 0x00 require for picture
0x01 require for audio
0x02 require for video
1 Multimedia ID DWORD The event (warning) is reported specified
in the multimedia information list
Figure 7 Multimedia requirement format

Tensortec(Shenzhen China)
14 / 21

React: (format see following)

Driveraid ID Function code Data area


0x65 0x50 null
Figure 5 Multimedia data command react format
Time sequence: (interactive process)

Figure 8 Require for multimedia data interactive

2.2.7 Transfer multimedia data command

Function code: 0x51


Function: the code is for Driveraid transfer multimedia data to terminal, as well as for terminal
send back reaction to Deriveraid.
Command: format definite as following

Driveraid ID Function code Data area


0x65 0x51 See multimedia data format
Figure 9 Multimedia data transfer command format
Start byte Field Data type Description and introduction
0 Message ID BYTE 0x00 Inquire for picture
0x01 Inquire for audio
0x02 Inquire for video
1 Multimedia ID DWORD The event (warning) is reported specified
in the multimedia information list
5 Package amount WORD Total amount of multimedia package. 0
package means no data
7 Package NO. WORD Current multimedia data package number,
package starts from 0.
9 Multimedia data BYTE[n] it is suggested actual data less than 1024
byte (no limited when it is network
commination)

Tensortec(Shenzhen China)
15 / 21

Figure 10 Multimedia data format

React: format definite as following:

Drvieraid ID Function code Data area


0x65 0x51 See multimedia data react
format
Figure 11. Multimedia data react command format
Start byte Field Data type Description and introduction
0 Message ID BYTE 0x00 inquire for picture
0x01 inquire for audio
0x02 inquire for video
1 Multimedia ID DWORD The event (warning) is reported specified
in the multimedia information list
5 Package amount WORD Total amount of multimedia package. 0
package means no data
7 Package No. WORD Current multimedia data package number,
package starts from 0.
9 React result BYTE 0: successful
1:failed
Figure 12. Multimedia data react format
Time sequence (interactive process)

Figure 13. Transfor multimedia data interactive

2.3 GPS communicate protocol

For Driveraid to receive GPS protocol, please refer to GPS standard file: NMEA Protocol 0183.

Tensortec(Shenzhen China)
16 / 21

2.3.1 Protocol Overview

NMEA messages sent by the GNSS receiver are based on NMEA 0183 Version 4.0. The
following picture shows the structure of a NMEA protocol message.

2.3.2 VTG

Course over ground and Ground speed


Message VTG
Description Course over ground and Ground speed
Firmware Supported on: u-blox 8 firmware version 2.00
Type Output Message
Comment Velocity is given as Course over Ground (COG) and Speed over Ground (SOG).
ID for CFG-MSG Number of fields

Message Info 0xF0 0x05 12


Message Structure:
$xxVTG,cogt,T,cogm,M,knots,N,kph,K,posMode*cs<CR><LF>

Example:
$GPVTG,77.52, T, M,0.004, N,0.008, K, A*06

Field
No.
Name Unit Format Example Description
0 xxVTG - string $GPVTG VTG Message ID (xx = current Talker ID)
1 cogt degr
ees
numeric 77.52 Course over ground (true)
2 T - character T Fixed field: true

Tensortec(Shenzhen China)
17 / 21
3 cogm degr
ees
numeric - Course over ground (magnetic), not output
4 M - character M Fixed field: magnetic
5 knots knot
s
numeric 0.004 Speed over ground
6 N - character N Fixed field: knots
7 kph km/
h
numeric 0.008 Speed over ground
8 K - character K Fixed field: kilometers per hour
9 posMode - character A Mode Indicator
10 cs - hexadecimal *06 Checksum
11 <CR><LF> - character - Carriage return and line feed

2.3.3 GPS receive interactive

1. GPS Tracker will send message without stopping to Driveraid once it connects to the

Drivreaid.

2. The Driveriad will accept all messages and filter them, pay attention to useful messages.

Presently it pays attention to real time speed data.


Figure 1. GPS Tracker interactive

Tensortec(Shenzhen China)
18 / 21

3. Apply Filed

3.1 Low Speed No Warning

 Step 1
Through command, Terminal connected to Driveraid, then it sends allocate
warning enable speed threshold command 0x35 to Driveraid. Presume we
need set no warning when speed lower than 20km/s.

i. Command sending as following:

Driveraid ID Function code Data area


0x65 0x35 See following

Start byte Field Data type Description and


introduction
0 Enable warning speed threshold BYTE 0x14
1 Warning sound volume BYTE 0xFF
2 Initiative snapshot strategy BYTE 0xFF
3 initiative fix time snapshot time WORD 0xFFFF
interval
5 initiative fix distance snapshot WORD 0xFFFF
distance interval
7 photo amount each initiative BYTE 0xFF
snapshot
8 Time interval of each initiative BYTE 0xFF
snapshot
9 photo definition BYTE 0xFF
10 video definition BYTE 0xFF
11 Reserved byte BYTE[10] 0xFF 0xFF 0xFF 0xFF
0xFF 0xFF 0xFF 0xFF
0xFF 0xFF
21 Smoking warning judgement time WORD 0xFFFF
interval

23 Calling warning judgment time WORD 0xFFFF


interval
25 (Before&after) fatigue driving BYTE 0xFF
video shoot time
26 Fatigue driving photo shoot BYTE 0xFF

Tensortec(Shenzhen China)
19 / 21

amount
27 Fatigue driving warning snapshot BYTE 0xFF
interval time
28 Reserved BYTE 0xFF
29 (Before&after) calling waring BYTE 0xFF
video shoot time
30 Calling waring snapshot (for BYTE 0xFF
driver expression features) photo
amount
31 Calling waring snapshot (for BYTE 0xFF
driver expression features) time
interval
32 (Before&after) smoking waring BYTE 0xFF
video shoot time
33 Smoking waring snapshot (for BYTE 0xFF
driver expression features) photo
amount
34 Smoking waring snapshot (for BYTE 0xFF
driver expression features) time
interval
35 (Before&after) warning video BYTE 0xFF
shoot time
36 Distraction warning snapshot BYTE 0xFF
photo amount
37 distraction warning snapshot time BYTE 0xFF
interval
38 abnormal driving video shoot BYTE 0xFF
time
39 abnormal driving snapshot photo BYTE 0xFF
amount
40 abnormal driving snapshot time BYTE 0xFF
interval

41 Reserved byte BYTE[2] 0xFF 0xFF

 Step 2
Cut down command connection of terminal with Driveraid, and connect
GPS tracker with Driveraid. When GPS is in working condition, means
Driveraid is in no warning state lower than 20km/s.

 Step 3
When the terminal connecting with Driveraid, it can also achieve no
warning lower than 20km/s, by sending real time speed data based on
command communicate protocol.

Tensortec(Shenzhen China)
20 / 21

3.2 Snapshot Once Warning

 Step 1
Keep connection between snapshot terminaland Drvieraid
 Step 2
When Driveraid is warning, snapshot terminal will receive and read
event(warning) report 0x36, then gain the multimedia ID (picture ID).

 Step 3
According to the gained multimedia ID (picture ID), the snapshot terminal
will step forward to require Driveraid for multimedia command 0x50;

 Step 4
Driveraid will upload multimedia data command 0x51 to snapshot terminal,
then the terminal will read the data and save it.

Tensortec(Shenzhen China)

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