aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/TotemProtocolSmsEncoder.java
diff options
context:
space:
mode:
authorMatjaž Črnko <m.crnko@txt.si>2022-01-04 21:38:01 +0100
committerMatjaž Črnko <m.crnko@txt.si>2022-01-04 21:38:01 +0100
commit1a32d6b9b7253716d5927200db12d287b134ee26 (patch)
treeb0c8c03466b03610b93373bd0acf5a3d077e593f /src/main/java/org/traccar/protocol/TotemProtocolSmsEncoder.java
parent0ca865602a9d14004a2385e37af31a8d2976a5d7 (diff)
downloadtrackermap-server-1a32d6b9b7253716d5927200db12d287b134ee26.tar.gz
trackermap-server-1a32d6b9b7253716d5927200db12d287b134ee26.tar.bz2
trackermap-server-1a32d6b9b7253716d5927200db12d287b134ee26.zip
fix: PR Feedback - Work In Progress
Diffstat (limited to 'src/main/java/org/traccar/protocol/TotemProtocolSmsEncoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/TotemProtocolSmsEncoder.java29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/main/java/org/traccar/protocol/TotemProtocolSmsEncoder.java b/src/main/java/org/traccar/protocol/TotemProtocolSmsEncoder.java
index 2384b9730..28180b33b 100644
--- a/src/main/java/org/traccar/protocol/TotemProtocolSmsEncoder.java
+++ b/src/main/java/org/traccar/protocol/TotemProtocolSmsEncoder.java
@@ -16,44 +16,21 @@
*/
package org.traccar.protocol;
-import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
import org.traccar.Protocol;
-public class TotemProtocolSmsEncoder extends StringProtocolEncoder {
+public class TotemProtocolSmsEncoder extends TotemProtocolEncoder {
public TotemProtocolSmsEncoder(Protocol protocol) {
super(protocol);
}
- protected String getCommandString(Command command) {
- switch (command.getType()) {
- case Command.TYPE_CUSTOM:
- return formatCommand(command, "%s,%s", Command.KEY_DEVICE_PASSWORD, Command.KEY_DATA);
- case Command.TYPE_REBOOT_DEVICE:
- return formatCommand(command, "%s,006", Command.KEY_DEVICE_PASSWORD);
- case Command.TYPE_FACTORY_RESET:
- return formatCommand(command, "%s,007", Command.KEY_DEVICE_PASSWORD);
- case Command.TYPE_GET_VERSION:
- return formatCommand(command, "%s,056", Command.KEY_DEVICE_PASSWORD);
- case Command.TYPE_POSITION_SINGLE:
- return formatCommand(command, "%s,012", Command.KEY_DEVICE_PASSWORD);
- // Assuming PIN 8 (Output C) is the power wire, like manual says but it can be PIN 5,7,8
- case Command.TYPE_ENGINE_STOP:
- return formatCommand(command, "%s,025,C,1", Command.KEY_DEVICE_PASSWORD);
- case Command.TYPE_ENGINE_RESUME:
- return formatCommand(command, "%s,025,C,0", Command.KEY_DEVICE_PASSWORD);
- default:
- return null;
- }
- }
-
@Override
- protected String encodeCommand(Command command) {
+ protected Object encodeCommand(Command command) {
initDevicePassword(command, "000000");
- return String.format("*%s#", getCommandString(command));
+ return String.format("*%s#", super.getCommandString(command));
}
}