aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSrgian Danity <srgian.danity@smartdiesel.ro>2017-01-19 13:06:47 +0200
committerSrgian Danity <srgian.danity@smartdiesel.ro>2017-01-19 13:06:47 +0200
commitd8e06f0f17f3c82c4410b7dc9e540e8c75e4faa7 (patch)
tree6aaf794e7dede18edeeddf26466b7ff4c209fca9 /src
parent49c50ef9b823a5e3c726739f801bf7b406c43bb0 (diff)
downloadtraccar-server-d8e06f0f17f3c82c4410b7dc9e540e8c75e4faa7.tar.gz
traccar-server-d8e06f0f17f3c82c4410b7dc9e540e8c75e4faa7.tar.bz2
traccar-server-d8e06f0f17f3c82c4410b7dc9e540e8c75e4faa7.zip
Switched from getXxx to readXxx on buffer
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index 2c5e31afb..bc1a4704e 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -214,11 +214,9 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
}
private List<Position> parseData(
- Channel channel, SocketAddress remoteAddress, ChannelBuffer buf, int offset, int packetId, String... imei) {
+ Channel channel, SocketAddress remoteAddress, ChannelBuffer buf, int packetId, String... imei) {
List<Position> positions = new LinkedList<>();
- buf.skipBytes(offset); // marker
-
if (!(channel instanceof DatagramChannel)) {
buf.readUnsignedInt(); // data length
}
@@ -281,7 +279,8 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
if (buf.getUnsignedShort(0) > 0) {
parseIdentification(channel, remoteAddress, buf);
} else {
- return parseData(channel, remoteAddress, buf, 4, 0);
+ buf.skipBytes(4);
+ return parseData(channel, remoteAddress, buf, 0);
}
return null;
@@ -289,12 +288,14 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
protected Object decodeUdp(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) throws Exception {
- int packetId = buf.getShort(2);
- int imeiLength = buf.getUnsignedShort(6);
+ buf.skipBytes(2);
+ int packetId = buf.readUnsignedShort();
+ buf.skipBytes(2);
+ int imeiLength = buf.readUnsignedShort();
String imei = buf.toString(8, imeiLength, StandardCharsets.US_ASCII);
- int offset = 8 + imeiLength;
+ buf.skipBytes(imeiLength);
- return parseData(channel, remoteAddress, buf, offset, packetId, imei);
+ return parseData(channel, remoteAddress, buf, packetId, imei);
}