From 3e402ffca4649a390d237c6aba8678022b23370a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 7 Dec 2019 12:53:30 -0800 Subject: Fix IMEI and year decoding --- src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java index 199348c54..5959a1de7 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(2000 + BitUtil.from(date, 4), BitUtil.to(date, 4), buf.readUnsignedByte()) + .setDate(2010 + 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); @@ -84,7 +84,7 @@ public class PacificTrackProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_INDEX, buf.readUnsignedShort()); break; case 0x100: - String imei = ByteBufUtil.hexDump(buf.readSlice(8)).substring(1); + String imei = ByteBufUtil.hexDump(buf.readSlice(8)).substring(0, 15); deviceSession = getDeviceSession(channel, remoteAddress, imei); break; default: -- cgit v1.2.3