diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-07-14 06:59:47 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-07-14 06:59:47 +1200 |
commit | a2e1f56adf50746425565557dd38f0e2c81a0222 (patch) | |
tree | 5bad431840bb13025e5dd64e69c046a9a34e714b /src/org/traccar/protocol | |
parent | 9962c5ee58f4f5be82e9d2aae434aa2e619d4c85 (diff) | |
download | traccar-server-a2e1f56adf50746425565557dd38f0e2c81a0222.tar.gz traccar-server-a2e1f56adf50746425565557dd38f0e2c81a0222.tar.bz2 traccar-server-a2e1f56adf50746425565557dd38f0e2c81a0222.zip |
Implement extended Teltonika protocol
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 8c4d6f72e..c8c2e4002 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -19,6 +19,7 @@ import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; +import org.traccar.Context; import org.traccar.DeviceSession; import org.traccar.helper.BitUtil; import org.traccar.helper.UnitsConverter; @@ -35,10 +36,16 @@ import java.util.List; public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { private boolean connectionless; + private boolean extended; + + public void setExtended(boolean extended) { + this.extended = extended; + } public TeltonikaProtocolDecoder(TeltonikaProtocol protocol, boolean connectionless) { super(protocol); this.connectionless = connectionless; + this.extended = Context.getConfig().getBoolean(getProtocolName() + ".extended"); } private DeviceSession parseIdentification(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) { @@ -245,6 +252,14 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { } } + // Read 16 byte data + if (extended) { + int cnt = buf.readUnsignedByte(); + for (int j = 0; j < cnt; j++) { + position.set(Position.PREFIX_IO + buf.readUnsignedByte(), ChannelBuffers.hexDump(buf.readBytes(16))); + } + } + } private List<Position> parseData( |