From 146de22b51139edcc3132f403e86006ac1fc3419 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 27 Nov 2022 10:31:12 -0800 Subject: Support GL600 GPS lock --- src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java | 4 ++-- src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java index 9fa550ded..9ed44f565 100644 --- a/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2021 Anton Tananaev (anton@traccar.org) + * Copyright 2012 - 2022 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,7 +143,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { boolean responseRequired = false; - while (buf.readableBytes() > 1) { + while (buf.readableBytes() >= 17) { Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); diff --git a/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java index 98c587a81..fc52e32e3 100644 --- a/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class Jt600ProtocolDecoderTest extends ProtocolTest { var decoder = inject(new Jt600ProtocolDecoder(null)); + verifyPositions(decoder, binary( + "2480433966040111002718031919195822424550114158888E15A40000F124080000000000F00F110A24991900000DF0C7")); + verifyPosition(decoder, buffer( "(8000632862,P45,290322,132412,25.28217,S,57.54683,W,A,0,0,5,0,0000000000,0,0,9,0)")); -- cgit v1.2.3