From fceb580895aebfbf6c9f506dcfa56c21e4222e54 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 28 Dec 2018 15:07:49 -0800 Subject: Fix Wristband response --- src/org/traccar/protocol/WristbandProtocolDecoder.java | 2 +- test/org/traccar/protocol/WristbandProtocolDecoderTest.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/org/traccar/protocol/WristbandProtocolDecoder.java b/src/org/traccar/protocol/WristbandProtocolDecoder.java index 3b1c6c2d4..b14e1b355 100644 --- a/src/org/traccar/protocol/WristbandProtocolDecoder.java +++ b/src/org/traccar/protocol/WristbandProtocolDecoder.java @@ -46,7 +46,7 @@ public class WristbandProtocolDecoder extends BaseProtocolDecoder { Channel channel, String imei, String version, int type, String data) { if (channel != null) { - String sentence = String.format("YX%s|%s|0|{F%d#%s}\r\n", imei, version, type, data); + String sentence = String.format("YX%s|%s|0|{F%02d#%s}\r\n", imei, version, type, data); ByteBuf response = Unpooled.buffer(); if (type != 91) { response.writeBytes(new byte[]{0x00, 0x01, 0x02}); diff --git a/test/org/traccar/protocol/WristbandProtocolDecoderTest.java b/test/org/traccar/protocol/WristbandProtocolDecoderTest.java index a0db93749..3f6c48d52 100644 --- a/test/org/traccar/protocol/WristbandProtocolDecoderTest.java +++ b/test/org/traccar/protocol/WristbandProtocolDecoderTest.java @@ -16,6 +16,9 @@ public class WristbandProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "000102004159583336373535313631303030303934347c56312e307c317c7b4639312330317c30307c30307c33475f7065745f323031382f30352f31362031313a30307d0d0afffefc")); + verifyNull(decoder, binary( + "000102003559583836383730343034343735303035357c56312e307c317c7b4630312339342c312c3130302c302c33313030302c3930307d0d0afffefc")); + } } -- cgit v1.2.3