aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/TranSyncProtocol.java3
-rw-r--r--src/main/java/org/traccar/protocol/TranSyncProtocolDecoder.java29
2 files changed, 26 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/protocol/TranSyncProtocol.java b/src/main/java/org/traccar/protocol/TranSyncProtocol.java
index 39db67585..3abe05de8 100644
--- a/src/main/java/org/traccar/protocol/TranSyncProtocol.java
+++ b/src/main/java/org/traccar/protocol/TranSyncProtocol.java
@@ -16,7 +16,6 @@
package org.traccar.protocol;
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
-import io.netty.handler.codec.LineBasedFrameDecoder;
import org.traccar.BaseProtocol;
import org.traccar.PipelineBuilder;
import org.traccar.TrackerServer;
@@ -36,4 +35,4 @@ public class TranSyncProtocol extends BaseProtocol {
}
});
}
-}
+} \ No newline at end of file
diff --git a/src/main/java/org/traccar/protocol/TranSyncProtocolDecoder.java b/src/main/java/org/traccar/protocol/TranSyncProtocolDecoder.java
index e9247ddf8..759c012b8 100644
--- a/src/main/java/org/traccar/protocol/TranSyncProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TranSyncProtocolDecoder.java
@@ -17,10 +17,8 @@ package org.traccar.protocol;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
-import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.NetworkMessage;
import org.traccar.Protocol;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
@@ -37,6 +35,28 @@ public class TranSyncProtocolDecoder extends BaseProtocolDecoder {
private static final byte[] STX = new byte[]{0x3a, 0x3a};
+ private String getHardwareType(int type){
+
+ switch (type) {
+ case 1:
+ return "basic";
+ case 2:
+ return "asset";
+ case 3:
+ return "bike";
+ case 4:
+ return "serial";
+ case 5:
+ return "obd";
+ case 6:
+ return "l1";
+ case 7:
+ return "ais-140";
+ default:
+ return "unknown";
+ }
+ }
+
public TranSyncProtocolDecoder(Protocol protocol) {
super(protocol);
}
@@ -102,10 +122,11 @@ public class TranSyncProtocolDecoder extends BaseProtocolDecoder {
}
private void decodeTrackerStatusParameters(Position position, int value){
- if (BitUtil.check(value, 7)) position.set("restored", true);
+ if (BitUtil.check(value, 7)) position.set(Position.KEY_ARCHIVE, true);
if (BitUtil.check(value, 5)) {
position.set(Position.KEY_ALARM, Position.ALARM_GPS_ANTENNA_CUT);
}
+ position.set(Position.KEY_VERSION_HW, getHardwareType(BitUtil.between(value, 0, 3)));
}
@Override
@@ -143,7 +164,7 @@ public class TranSyncProtocolDecoder extends BaseProtocolDecoder {
decodePowerEngineParameters(position, buf.readUnsignedByte());
- buf.readUnsignedByte(); // not in use
+ buf.readUnsignedByte(); // reserved
decodeAlarm(position, buf.readUnsignedByte());