From fe771851995da97ffa2fb50e21bd437bca208eac Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 8 Feb 2024 07:26:52 -0800 Subject: Support RST command responses --- src/main/java/org/traccar/protocol/RstProtocolDecoder.java | 13 ++++++++++++- .../java/org/traccar/protocol/RstProtocolDecoderTest.java | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/traccar/protocol/RstProtocolDecoder.java b/src/main/java/org/traccar/protocol/RstProtocolDecoder.java index 2493f0d9f..eafa4d3d7 100644 --- a/src/main/java/org/traccar/protocol/RstProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/RstProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 - 2023 Anton Tananaev (anton@traccar.org) + * Copyright 2019 - 2024 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -143,6 +143,17 @@ public class RstProtocolDecoder extends BaseProtocolDecoder { return position; + } else if (type == 134) { + + Position position = new Position(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + + getLastLocation(position, null); + + position.set(Position.KEY_RESULT, String.valueOf(type)); + + return position; + } else { return null; diff --git a/src/test/java/org/traccar/protocol/RstProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/RstProtocolDecoderTest.java index fc932fe9e..a750d0311 100644 --- a/src/test/java/org/traccar/protocol/RstProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/RstProtocolDecoderTest.java @@ -11,6 +11,10 @@ public class RstProtocolDecoderTest extends ProtocolTest { var decoder = inject(new RstProtocolDecoder(null)); + verifyAttribute(decoder, text( + "RST;A;RST-MINI-4Gv3;V9.10;009521405;1;134;FIM;"), + Position.KEY_RESULT, "134"); + verifyAttribute(decoder, text( "RST;A;RST-MINIv5;V9.08;009767055;248;55;14-12-2023 19:34:20;14-12-2023 19:34:21;-12.923640;-38.388313;0;14;17;1;4;15;00;B0;00;1A;02;12.18;4.02;65;21;FE;0000;01;C0;001606017031;0002;FIM;"), Position.KEY_DRIVER_UNIQUE_ID, "001606017031"); -- cgit v1.2.3