aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-12-14 06:59:53 -0800
committerAnton Tananaev <anton@traccar.org>2022-12-14 06:59:53 -0800
commit64391161c1fb03bd9ff5ea30749b4e00230fa8aa (patch)
tree44ba93ae9f1f2e0058360460fca289189c5116a0 /src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
parenta87c77da9e8d39856e2a16ae3d3aa385e068a1e8 (diff)
downloadtrackermap-server-64391161c1fb03bd9ff5ea30749b4e00230fa8aa.tar.gz
trackermap-server-64391161c1fb03bd9ff5ea30749b4e00230fa8aa.tar.bz2
trackermap-server-64391161c1fb03bd9ff5ea30749b4e00230fa8aa.zip
Handle Teltonika heartbeat
Diffstat (limited to 'src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
index c63d74c9c..929eca8aa 100644
--- a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -647,9 +647,11 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
}
}
- private Object decodeTcp(Channel channel, SocketAddress remoteAddress, ByteBuf buf) throws Exception {
+ private Object decodeTcp(Channel channel, SocketAddress remoteAddress, ByteBuf buf) {
- if (buf.getUnsignedShort(0) > 0) {
+ if (buf.readableBytes() == 1 && buf.readUnsignedByte() == 0xff) {
+ return null;
+ } else if (buf.getUnsignedShort(0) > 0) {
parseIdentification(channel, remoteAddress, buf);
} else {
buf.skipBytes(4);
@@ -659,7 +661,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- private Object decodeUdp(Channel channel, SocketAddress remoteAddress, ByteBuf buf) throws Exception {
+ private Object decodeUdp(Channel channel, SocketAddress remoteAddress, ByteBuf buf) {
buf.readUnsignedShort(); // length
buf.readUnsignedShort(); // packet id