diff options
-rw-r--r-- | src/org/traccar/protocol/OigoProtocolDecoder.java | 4 | ||||
-rw-r--r-- | test/org/traccar/protocol/OigoProtocolDecoderTest.java | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/OigoProtocolDecoder.java b/src/org/traccar/protocol/OigoProtocolDecoder.java index 799f47ea3..bbea38183 100644 --- a/src/org/traccar/protocol/OigoProtocolDecoder.java +++ b/src/org/traccar/protocol/OigoProtocolDecoder.java @@ -54,7 +54,7 @@ public class OigoProtocolDecoder extends BaseProtocolDecoder { DeviceSession deviceSession; switch (BitUtil.to(tag, 3)) { case 0: - String imei = ChannelBuffers.hexDump(buf.readBytes(9)).substring(1, 1 + 15); + String imei = ChannelBuffers.hexDump(buf.readBytes(8)).substring(1); deviceSession = getDeviceSession(channel, remoteAddress, imei); break; case 1: @@ -75,6 +75,8 @@ public class OigoProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); + position.set(Position.KEY_EVENT, buf.readUnsignedByte()); + int mask = buf.readInt(); if (BitUtil.check(mask, 0)) { diff --git a/test/org/traccar/protocol/OigoProtocolDecoderTest.java b/test/org/traccar/protocol/OigoProtocolDecoderTest.java index b75f3162b..14c34ae7c 100644 --- a/test/org/traccar/protocol/OigoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/OigoProtocolDecoderTest.java @@ -16,6 +16,9 @@ public class OigoProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, binary( "7e004200000014631000258257000000ffff02d1690e00051f690e00051f0696dbd204bdfde31a070000b307100f35c0106305f500000000010908010402200104ffff8001")); + verifyPosition(decoder, binary( + "7e004200000014631000258257000000ffff0d82691300001669130000160696dbd804bdfdbb1a0800000007101035a2106905f500000000010908010402200104ffff8001")); + } } |