From 1af92658dc079970ae4505c0503ba96723e65344 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 1 Jun 2021 20:19:09 -0700 Subject: Implement custom command support --- src/main/java/org/traccar/protocol/StartekProtocol.java | 1 + src/main/java/org/traccar/protocol/StartekProtocolEncoder.java | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/main/java/org/traccar/protocol/StartekProtocol.java b/src/main/java/org/traccar/protocol/StartekProtocol.java index 230dc3118..32f1c5a29 100644 --- a/src/main/java/org/traccar/protocol/StartekProtocol.java +++ b/src/main/java/org/traccar/protocol/StartekProtocol.java @@ -27,6 +27,7 @@ public class StartekProtocol extends BaseProtocol { public StartekProtocol() { setSupportedDataCommands( + Command.TYPE_CUSTOM, Command.TYPE_OUTPUT_CONTROL, Command.TYPE_ENGINE_STOP, Command.TYPE_ENGINE_RESUME); diff --git a/src/main/java/org/traccar/protocol/StartekProtocolEncoder.java b/src/main/java/org/traccar/protocol/StartekProtocolEncoder.java index 300004c5e..011a8dfae 100644 --- a/src/main/java/org/traccar/protocol/StartekProtocolEncoder.java +++ b/src/main/java/org/traccar/protocol/StartekProtocolEncoder.java @@ -40,6 +40,8 @@ public class StartekProtocolEncoder extends StringProtocolEncoder { protected Object encodeCommand(Channel channel, Command command) { switch (command.getType()) { + case Command.TYPE_CUSTOM: + return formatCommand(command, "%s", Command.KEY_DATA); case Command.TYPE_OUTPUT_CONTROL: return formatCommand(command, "900,%s,%s", Command.KEY_INDEX, Command.KEY_DATA); case Command.TYPE_ENGINE_STOP: -- cgit v1.2.3