diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/PstProtocolDecoder.java | 10 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/PstProtocolDecoderTest.java | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/PstProtocolDecoder.java b/src/main/java/org/traccar/protocol/PstProtocolDecoder.java index 68d32636c..0c7826e42 100644 --- a/src/main/java/org/traccar/protocol/PstProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/PstProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 Anton Tananaev (anton@traccar.org) + * Copyright 2019 - 2020 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. @@ -86,10 +86,16 @@ public class PstProtocolDecoder extends BaseProtocolDecoder { int length = buf.readUnsignedByte(); switch (tag) { + case 0x09: + buf.readUnsignedByte(); // sensor count + buf.readUnsignedByte(); // sensor logic + int status = buf.readUnsignedByte(); + position.set(Position.KEY_IGNITION, BitUtil.check(status, 7)); + break; case 0x0D: int battery = buf.readUnsignedByte(); if (battery <= 20) { - position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte() * 5); + position.set(Position.KEY_BATTERY_LEVEL, battery * 5); } break; case 0x10: diff --git a/src/test/java/org/traccar/protocol/PstProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PstProtocolDecoderTest.java index a5db8872d..dd2564982 100644 --- a/src/test/java/org/traccar/protocol/PstProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/PstProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class PstProtocolDecoderTest extends ProtocolTest { PstProtocolDecoder decoder = new PstProtocolDecoder(null); verifyPosition(decoder, binary( + "2fafb18306000005ab055166ee8f08080b0400008ec00c09b50022aef924d320f30d01130f045166ee8f10145166ee92805118978b59109900b3000b0000010c110300a7011404b58000001502039ff6e4")); + + verifyPosition(decoder, binary( "2faf9ab606000004c7055052ec88c0070b04000015050c09b500a25271c733e0720d01fe0f045052ec8410145052ba07858413918af325e7020802fe010001051103ffff0015023bbdc87d")); verifyPosition(decoder, binary( |