diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-01-20 22:29:15 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-01-20 22:29:15 +1300 |
commit | 3dc2ecf209013f26996d307be2cbeb666476a7df (patch) | |
tree | ea91971a09b2276573270e2ed3b86dd510f46fa0 /src/org/traccar/protocol | |
parent | 14a4dc2ac141ebcc99697736102c9571dc5034aa (diff) | |
download | trackermap-server-3dc2ecf209013f26996d307be2cbeb666476a7df.tar.gz trackermap-server-3dc2ecf209013f26996d307be2cbeb666476a7df.tar.bz2 trackermap-server-3dc2ecf209013f26996d307be2cbeb666476a7df.zip |
Minor Teltonika decoder improvements
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index bc1a4704e..6f3af0bb2 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 - 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2013 - 2017 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -274,7 +274,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { } } - protected Object decodeTcp(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) throws Exception { + private Object decodeTcp(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) throws Exception { if (buf.getUnsignedShort(0) > 0) { parseIdentification(channel, remoteAddress, buf); @@ -286,14 +286,12 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { return null; } - protected Object decodeUdp(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) throws Exception { + private Object decodeUdp(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) throws Exception { buf.skipBytes(2); int packetId = buf.readUnsignedShort(); buf.skipBytes(2); - int imeiLength = buf.readUnsignedShort(); - String imei = buf.toString(8, imeiLength, StandardCharsets.US_ASCII); - buf.skipBytes(imeiLength); + String imei = buf.readBytes(buf.readUnsignedShort()).toString(StandardCharsets.US_ASCII); return parseData(channel, remoteAddress, buf, packetId, imei); |