JT/T808 Protocol Gateway
- Terminal side: exchange data through the JT/T 808 protocol to report different types of data, or send downlink messages to the terminal.
- Platform side: emqx-jt808 decodes the message and performs registration/authentication, or PUBLISH the data message to a specific topic; the agent subscribes to the downstream topic, and converts the downstream PUBLISH message into a JT/T 808 protocol message The text structure is delivered to the terminal.
Create module
Open EMQX Dashboard (opens new window), click the “Modules” tab on the left, and choose to add:
Select JT/T808 protocol to access the gateway:
Configure related basic parameters:
Add listening port:
Configure monitoring parameters:
After clicking Add, the module is added:
emqx-jt808 implementation regulations:
-In the system, the mobile phone number is used as the unique identification of a connection, namely ClientId
The implementation of emqx-jt808 supports anonymous access authentication:
The detailed format of the registration request is as follows:
Registration request:
Method: POST
Body:
{"province": 58,
"city": 59,
"manufacturer": "Infinity",
"model": "Q2",
"dev_id": "xx11344",
"phone", "00123456789"
}
Registration Response:
Authentication request:
URL: http://127.0.0.1:8991/jt808/auth
Method: POST
{"code": "authcode",
"phone", "00123456789"
}
Authentication response:
The authentication request is only called when the system does not save the authentication code (that is, the terminal directly sends an authentication message to log in to the system)
In emqx-jt808, you can send and receive terminal messages by configuring uplink and downlink topics:
Upward
For example: Manufacturer Id is ʻabcdeand **Terminal Id** is
1234567`.
First use the MQTT client to subscribe to the topic jt808/abcde1234567/up
:
$ mosquitto_sub -t jt808/abcde1234567/up
For example, after the terminal reports a message of type , the subscriber will receive:
Tip
For transparent transmission, the content of the data field will be base64 encoded and reported once
Data Downlink
Similarly, take the ID in the above row as an example; after the terminal is successfully authenticated, use the MQTT client to send a message of the type’data downlink transparent transmission (0x8900)’ to the terminal:
Tip
In the downstream JSON, the content in the header only needs to have msg_id; the content in the body has different structures according to different msg_id