aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-04-14 19:15:59 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-04-14 19:15:59 -0700
commite2531fc5c0d1d28c190ceeba6a0e8627b26d6c60 (patch)
treee3e4cd21c5b037fc13a2462326607c67bf65b225 /src/main
parent90c2f67629064126834450aafcaffdc4187fe55a (diff)
downloadtrackermap-server-e2531fc5c0d1d28c190ceeba6a0e8627b26d6c60.tar.gz
trackermap-server-e2531fc5c0d1d28c190ceeba6a0e8627b26d6c60.tar.bz2
trackermap-server-e2531fc5c0d1d28c190ceeba6a0e8627b26d6c60.zip
Decode fault codes
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
index 716589e00..74b4be8d5 100644
--- a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2021 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.
@@ -537,7 +537,11 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
int id = buf.readUnsignedShort();
int length = buf.readUnsignedShort();
if (id == 256) {
- position.set(Position.KEY_VIN, buf.readSlice(length).toString(StandardCharsets.US_ASCII));
+ position.set(Position.KEY_VIN,
+ buf.readSlice(length).toString(StandardCharsets.US_ASCII));
+ } else if (id == 281) {
+ position.set(Position.KEY_DTCS,
+ buf.readSlice(length).toString(StandardCharsets.US_ASCII).replace(',', ' '));
} else if (id == 385) {
ByteBuf data = buf.readSlice(length);
data.readUnsignedByte(); // data part
@@ -617,19 +621,17 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
}
if (channel != null && codec != CODEC_12 && codec != CODEC_13) {
+ ByteBuf response = Unpooled.buffer();
if (connectionless) {
- ByteBuf response = Unpooled.buffer();
response.writeShort(5);
response.writeShort(0);
response.writeByte(0x01);
response.writeByte(locationPacketId);
response.writeByte(count);
- channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
} else {
- ByteBuf response = Unpooled.buffer();
response.writeInt(count);
- channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
return positions.isEmpty() ? null : positions;