aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-09-21 05:11:01 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-09-21 05:11:01 +1200
commit277a28cd11a60246de96bcfb7be75e177f483809 (patch)
treed6115c1af0c675f4c6fc17f6891ec1554c198c79
parent411edf2fecc6f5d2cceba20f06958f729ebcca54 (diff)
downloadtraccar-server-277a28cd11a60246de96bcfb7be75e177f483809.tar.gz
traccar-server-277a28cd11a60246de96bcfb7be75e177f483809.tar.bz2
traccar-server-277a28cd11a60246de96bcfb7be75e177f483809.zip
Read event from OIGO messages
-rw-r--r--src/org/traccar/protocol/OigoProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/OigoProtocolDecoderTest.java3
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"));
+
}
}