diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-01 20:19:09 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-01 20:19:09 -0700 |
commit | 1af92658dc079970ae4505c0503ba96723e65344 (patch) | |
tree | 01acf15fff20f118625efd31fcae8a410f032735 /src | |
parent | 4c9399991e2cd2e67580c2bba8825b5133e4fe05 (diff) | |
download | traccar-server-1af92658dc079970ae4505c0503ba96723e65344.tar.gz traccar-server-1af92658dc079970ae4505c0503ba96723e65344.tar.bz2 traccar-server-1af92658dc079970ae4505c0503ba96723e65344.zip |
Implement custom command support
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/StartekProtocol.java | 1 | ||||
-rw-r--r-- | src/main/java/org/traccar/protocol/StartekProtocolEncoder.java | 2 |
2 files changed, 3 insertions, 0 deletions
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: |