diff options
author | Anton Tananaev <anton@traccar.org> | 2023-10-20 07:44:06 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-10-20 07:44:06 -0700 |
commit | a08bc10a8fd15a6b0fa4c04607eeae325e0c5407 (patch) | |
tree | d85cc01c27ee52fbbc0fcc071fc2bbcc38669c77 /src | |
parent | 37ed394724c0bdcc6f98f421e71d76916206ed30 (diff) | |
download | trackermap-server-a08bc10a8fd15a6b0fa4c04607eeae325e0c5407.tar.gz trackermap-server-a08bc10a8fd15a6b0fa4c04607eeae325e0c5407.tar.bz2 trackermap-server-a08bc10a8fd15a6b0fa4c04607eeae325e0c5407.zip |
Support Teltonika DSM protocol
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java b/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java index d03f7648d..5a6425e7e 100644 --- a/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 - 2022 Anton Tananaev (anton@traccar.org) + * Copyright 2021 - 2023 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. @@ -42,6 +42,8 @@ public class DualcamProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_COMPLETE = 5; public static final int MSG_FILE_REQUEST = 8; public static final int MSG_INIT_REQUEST = 9; + public static final int MSG_PATH_REQUEST = 0x000C; + public static final int MSG_PATH_RESPONSE = 0x000D; private String uniqueId; private int packetCount; @@ -65,7 +67,11 @@ public class DualcamProtocolDecoder extends BaseProtocolDecoder { long settings = buf.readUnsignedInt(); if (channel != null && deviceSession != null) { ByteBuf response = Unpooled.buffer(); - if (BitUtil.between(settings, 26, 30) > 0) { + if (BitUtil.check(settings, 25)) { + response.writeShort(MSG_PATH_REQUEST); + response.writeShort(2); + response.writeShort(0); + } else if (BitUtil.between(settings, 26, 30) > 0) { response.writeShort(MSG_FILE_REQUEST); String file; if (BitUtil.check(settings, 26)) { @@ -130,6 +136,13 @@ public class DualcamProtocolDecoder extends BaseProtocolDecoder { currentPacket += 1; } break; + case MSG_PATH_RESPONSE: + String file = buf.readCharSequence(buf.readUnsignedShort(), StandardCharsets.US_ASCII).toString(); + ByteBuf response = Unpooled.buffer(); + response.writeShort(MSG_FILE_REQUEST); + response.writeShort(file.length()); + response.writeCharSequence(file, StandardCharsets.US_ASCII); + break; default: break; } |