diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-25 19:09:42 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-25 19:09:42 +1200 |
commit | 3a24bd121c34d4046a765cd2a55e4847df423c89 (patch) | |
tree | 0dec76e30ddff5ac42eb1a6c7e97378537da1b8d /src/org/traccar/protocol/Tk103ProtocolEncoder.java | |
parent | c771f3b021780b5a48ebd5998b27803456794c9e (diff) | |
parent | e450c36389fed6e32a6b7e9fb47c739a425e4df2 (diff) | |
download | trackermap-server-3a24bd121c34d4046a765cd2a55e4847df423c89.tar.gz trackermap-server-3a24bd121c34d4046a765cd2a55e4847df423c89.tar.bz2 trackermap-server-3a24bd121c34d4046a765cd2a55e4847df423c89.zip |
Merge pull request #3286 from ckrey/tk013-commands
Tk103 commands
Diffstat (limited to 'src/org/traccar/protocol/Tk103ProtocolEncoder.java')
-rw-r--r-- | src/org/traccar/protocol/Tk103ProtocolEncoder.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/Tk103ProtocolEncoder.java b/src/org/traccar/protocol/Tk103ProtocolEncoder.java index ce995a65f..9e49b6ff1 100644 --- a/src/org/traccar/protocol/Tk103ProtocolEncoder.java +++ b/src/org/traccar/protocol/Tk103ProtocolEncoder.java @@ -1,4 +1,5 @@ /* + * Copyright 2017 Christoph Krey (c@ckrey.de) * Copyright 2017 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,6 +26,19 @@ public class Tk103ProtocolEncoder extends StringProtocolEncoder { protected Object encodeCommand(Command command) { switch (command.getType()) { + case Command.TYPE_GET_VERSION: + return formatCommand(command, "({%s}AP07)", Command.KEY_UNIQUE_ID); + case Command.TYPE_REBOOT_DEVICE: + return formatCommand(command, "({%s}AT00)", Command.KEY_UNIQUE_ID); + case Command.TYPE_SET_ODOMETER: + return formatCommand(command, "({%s}AX01)", Command.KEY_UNIQUE_ID); + case Command.TYPE_POSITION_SINGLE: + return formatCommand(command, "({%s}AP00)", Command.KEY_UNIQUE_ID); + case Command.TYPE_POSITION_PERIODIC: + return formatCommand(command, "({%s}AR00%s0000)", Command.KEY_UNIQUE_ID, + String.format("%04X", command.getInteger(Command.KEY_FREQUENCY))); + case Command.TYPE_POSITION_STOP: + return formatCommand(command, "({%s}AR0000000000)", Command.KEY_UNIQUE_ID); case Command.TYPE_ENGINE_STOP: return formatCommand(command, "({%s}AV011)", Command.KEY_UNIQUE_ID); case Command.TYPE_ENGINE_RESUME: |