From 67e287767cf7935f640085314e8fa7569dc0b2ae Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 4 Nov 2020 21:59:47 -0800 Subject: Update year decoding --- src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java | 2 +- .../java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java index 846b33396..ea0966a5d 100644 --- a/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java @@ -73,7 +73,7 @@ public class PacificTrackProtocolDecoder extends BaseProtocolDecoder { position.setValid(BitUtil.check(buf.readUnsignedByte(), 4)); int date = buf.readUnsignedByte(); DateBuilder dateBuilder = new DateBuilder() - .setDate(2010 + BitUtil.from(date, 4), BitUtil.to(date, 4), buf.readUnsignedByte()) + .setDate(2020 + BitUtil.from(date, 4), BitUtil.to(date, 4), buf.readUnsignedByte()) .setTime(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()); position.setTime(dateBuilder.getDate()); position.setLatitude(buf.readUnsignedInt() / 1000000.0 - 90.0); diff --git a/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java index 994407d25..b3293dacf 100644 --- a/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java @@ -24,7 +24,10 @@ public class PacificTrackProtocolDecoderTest extends ProtocolTest { PacificTrackProtocolDecoder decoder = new PacificTrackProtocolDecoder(null); - verifyPosition(decoder, binary( + verifyAttributes(decoder, binary( + "fb80c88181b00280883592151012618820b18b1f123340f004c90001300301928a0080008100c00000000091971c0b0417020d074df0ec03c242550b20081d0c009a0601a1855571a30000")); + + verifyAttributes(decoder, binary( "fb82e80280883527530900009110818202c0909308990b122519076138fc03b3480205a3e80003a0834dd19fb08112c08f0143000e020000000100000014000101929f806328c0000f4240810a858ce011314334424a57464758444c3533313737330190868102100828cf")); verifyAttributes(decoder, binary( -- cgit v1.2.3