From ecbb40a86bb32005a734fd2da33890f4fd076901 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 8 May 2018 15:23:21 -0700 Subject: Support custom commands for TK103 (fix #3869) --- src/org/traccar/protocol/Tk103ProtocolEncoder.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/Tk103ProtocolEncoder.java b/src/org/traccar/protocol/Tk103ProtocolEncoder.java index 3ec562cc3..d64c85c2c 100644 --- a/src/org/traccar/protocol/Tk103ProtocolEncoder.java +++ b/src/org/traccar/protocol/Tk103ProtocolEncoder.java @@ -47,6 +47,8 @@ public class Tk103ProtocolEncoder extends StringProtocolEncoder { if (alternative) { switch (command.getType()) { + case Command.TYPE_CUSTOM: + return formatAlt(command, "{%s}", Command.KEY_DATA); case Command.TYPE_GET_VERSION: return formatAlt(command, "*about*"); case Command.TYPE_REBOOT_DEVICE: @@ -57,8 +59,6 @@ public class Tk103ProtocolEncoder extends StringProtocolEncoder { return formatAlt(command, "*routetrack*99*"); case Command.TYPE_POSITION_STOP: return formatAlt(command, "*routetrackoff*"); - case Command.TYPE_CUSTOM: - return formatAlt(command, "{%s}", Command.KEY_DATA); case Command.TYPE_GET_DEVICE_STATUS: return formatAlt(command, "*status*"); case Command.TYPE_IDENTIFICATION: @@ -80,6 +80,8 @@ public class Tk103ProtocolEncoder extends StringProtocolEncoder { } } else { switch (command.getType()) { + case Command.TYPE_CUSTOM: + return formatCommand(command, "({%s}{%s})", Command.KEY_UNIQUE_ID, Command.KEY_DATA); case Command.TYPE_GET_VERSION: return formatCommand(command, "({%s}AP07)", Command.KEY_UNIQUE_ID); case Command.TYPE_REBOOT_DEVICE: -- cgit v1.2.3