aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-29 11:18:47 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-29 11:19:54 +1300
commit58fe1d2bb7055a953277666a2c5e6101cdcf64d7 (patch)
tree2ceca2047b395a933e855f48fde766b6e5ab00e3 /src/org/traccar/protocol
parente4cca2ad0dfbf3ecd60785b6974f5f16ac2f66ea (diff)
downloadtrackermap-server-58fe1d2bb7055a953277666a2c5e6101cdcf64d7.tar.gz
trackermap-server-58fe1d2bb7055a953277666a2c5e6101cdcf64d7.tar.bz2
trackermap-server-58fe1d2bb7055a953277666a2c5e6101cdcf64d7.zip
Apply Tytan changes for 2.0 protocol
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/TytanProtocolDecoder.java16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java
index d9ffc98b0..e8549d913 100644
--- a/src/org/traccar/protocol/TytanProtocolDecoder.java
+++ b/src/org/traccar/protocol/TytanProtocolDecoder.java
@@ -39,12 +39,6 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static float readSwappedFloat(ChannelBuffer buf) {
- byte[] bytes = new byte[4];
- buf.readBytes(bytes);
- return ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, bytes).readFloat();
- }
-
private void decodeExtraData(Position position, ChannelBuffer buf, int end) {
while (buf.readerIndex() < end) {
@@ -66,9 +60,9 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
case 6:
n = buf.readUnsignedByte() >> 4;
if (n < 2) {
- position.set(Event.PREFIX_ADC + n, readSwappedFloat(buf));
+ position.set(Event.PREFIX_ADC + n, buf.readFloat());
} else {
- position.set("di" + (n - 2), readSwappedFloat(buf));
+ position.set("di" + (n - 2), buf.readFloat());
}
break;
case 7:
@@ -82,10 +76,10 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
position.set("antihijack", buf.readUnsignedByte());
break;
case 9:
- position.set("authorized", ChannelBuffers.hexDump(buf.readBytes(8)));
+ position.set("unauthorized", ChannelBuffers.hexDump(buf.readBytes(8)));
break;
case 10:
- position.set("unauthorized", ChannelBuffers.hexDump(buf.readBytes(8)));
+ position.set("authorized", ChannelBuffers.hexDump(buf.readBytes(8)));
break;
case 24:
Set<Integer> temps = new LinkedHashSet<>();
@@ -105,7 +99,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte();
break;
case 90:
- position.set(Event.KEY_POWER, readSwappedFloat(buf));
+ position.set(Event.KEY_POWER, buf.readFloat());
break;
case 101:
position.set(Event.KEY_OBD_SPEED, buf.readUnsignedByte());