aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java10
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);