diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-10-15 11:15:55 +0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-10-15 11:15:55 +0800 |
commit | 3f5a5e81fe08c7ae0b136d52b4840d5085e12f23 (patch) | |
tree | e0604f1471140ca10ff9ae4725521914d7429373 | |
parent | e876250991faccdca04a1f36ddaf847c9f392275 (diff) | |
download | trackermap-server-3f5a5e81fe08c7ae0b136d52b4840d5085e12f23.tar.gz trackermap-server-3f5a5e81fe08c7ae0b136d52b4840d5085e12f23.tar.bz2 trackermap-server-3f5a5e81fe08c7ae0b136d52b4840d5085e12f23.zip |
Update tzone protocol
-rw-r--r-- | src/org/traccar/protocol/TzoneProtocolDecoder.java | 11 | ||||
-rw-r--r-- | test/org/traccar/protocol/TzoneProtocolDecoderTest.java | 3 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/TzoneProtocolDecoder.java b/src/org/traccar/protocol/TzoneProtocolDecoder.java index 76903c90c..079ad3126 100644 --- a/src/org/traccar/protocol/TzoneProtocolDecoder.java +++ b/src/org/traccar/protocol/TzoneProtocolDecoder.java @@ -203,7 +203,16 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder { if (blockLength >= 13) { position.set(Position.KEY_ALARM, decodeAlarm(buf.readUnsignedByte())); position.set("terminalInfo", buf.readUnsignedByte()); - position.set(Position.PREFIX_IO + 1, buf.readUnsignedShort()); + + int status = buf.readUnsignedByte(); + position.set(Position.PREFIX_OUT + 1, BitUtil.check(status, 0)); + position.set(Position.PREFIX_OUT + 2, BitUtil.check(status, 1)); + status = buf.readUnsignedByte(); + position.set(Position.PREFIX_IN + 1, BitUtil.check(status, 4)); + if (BitUtil.check(status, 0)) { + position.set(Position.KEY_ALARM, Position.ALARM_SOS); + } + position.set(Position.KEY_RSSI, buf.readUnsignedByte()); position.set("gsmStatus", buf.readUnsignedByte()); position.set(Position.KEY_BATTERY, buf.readUnsignedShort()); diff --git a/test/org/traccar/protocol/TzoneProtocolDecoderTest.java b/test/org/traccar/protocol/TzoneProtocolDecoderTest.java index aa8f61772..68c8bbdbc 100644 --- a/test/org/traccar/protocol/TzoneProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TzoneProtocolDecoderTest.java @@ -12,6 +12,9 @@ public class TzoneProtocolDecoderTest extends ProtocolTest { TzoneProtocolDecoder decoder = new TzoneProtocolDecoder(new TzoneProtocol()); verifyPosition(decoder, binary( + "545a005624240111010e0000086169303626931411091b151d2600160801de26ec002f633411091b151d2500000000160c0000040d2a34df000eaa4000001b37016000000000319c0000000000000000000000000000003a84240d0a")); + + verifyPosition(decoder, binary( "545a005024240153011000000863835025559464110103080a22001609011bed79245964a9110103080a22000a0000550c00000604396f04222c000daac000151701a204870000000000000003000959000546190d0a")); verifyPosition(decoder, binary( |