Add support for JT808 SMS response message (0x1300) (#5888)

* Update Jt808ProtocolDecoder.java

Added handling for 0x1300 message ID, which is a response form the device to a text message command.

* Update Jt808ProtocolDecoderTest.java

Added test for 0x1300 message ID frame.
This commit is contained in:
nilei
2026-05-29 18:27:12 +02:00
committed by GitHub
parent fb1ef0cfbf
commit 9811eadba3
2 changed files with 21 additions and 0 deletions

View File

@@ -83,6 +83,7 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_REPORT_TEXT_MESSAGE = 0x6006;
public static final int MSG_CONFIGURATION_PARAMETERS = 0x8103;
public static final int MSG_COMMAND_RESPONSE = 0x0701;
public static final int MSG_TEXT_MESSAGE_RESPONSE = 0x1300;
public static final int MSG_DRIVER_IDENTITY = 0x0702;
public static final int MSG_VIDEO_REQUEST = 0x9101;
public static final int MSG_VIDEO_CONTROL = 0x9102;
@@ -364,6 +365,22 @@ public class Jt808ProtocolDecoder extends BaseProtocolDecoder {
return position;
} else if (type == MSG_TEXT_MESSAGE_RESPONSE) {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
getLastLocation(position, null);
int bodyLength = BitUtil.to(attribute, 10);
buf.readUnsignedShort(); // response serial number
String result = buf.readCharSequence(bodyLength - 2, StandardCharsets.UTF_16BE).toString().trim();
position.set(Position.KEY_RESULT, result);
return position;
} else if (type == MSG_HEARTBEAT) {
sendGeneralResponse(channel, remoteAddress, id, type, index);

View File

@@ -252,6 +252,10 @@ public class Jt808ProtocolDecoderTest extends ProtocolTest {
"283734303139303331313138352c312c3030312c454c4f434b2c332c35323934333929"),
Position.KEY_RESULT, "(740190311185,1,001,ELOCK,3,529439)");
verifyAttribute(decoder, binary(
"7e13000012045450091546010900000053006500740020004f004b0021000d197e"),
Position.KEY_RESULT, "Set OK!");
verifyPosition(decoder, binary(
"7e55028436740190311185091607200239270613212607536108630000170a000000014600005ded05e203000000000b010d0c06005b003e00ab0a0302dc65100100a37e"));