diff options
author | Anton Tananaev <anton@traccar.org> | 2022-11-02 17:57:22 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-11-02 17:57:22 -0700 |
commit | 9280355123ee13f7f7d8bf7076a39dcab57ab1cd (patch) | |
tree | e2cd820dc11d75048dd89c2b4ad54c8e5188da74 /src/main/java/org/traccar/protocol/SuntechProtocolEncoder.java | |
parent | 49646eccd5ec57013c78ea0a0776c206f812cb0b (diff) | |
download | trackermap-server-9280355123ee13f7f7d8bf7076a39dcab57ab1cd.tar.gz trackermap-server-9280355123ee13f7f7d8bf7076a39dcab57ab1cd.tar.bz2 trackermap-server-9280355123ee13f7f7d8bf7076a39dcab57ab1cd.zip |
Improve attribute type handling
Diffstat (limited to 'src/main/java/org/traccar/protocol/SuntechProtocolEncoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/SuntechProtocolEncoder.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolEncoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolEncoder.java index 53308f968..b298adc5a 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolEncoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolEncoder.java @@ -59,23 +59,23 @@ public class SuntechProtocolEncoder extends StringProtocolEncoder { return formatCommand(command, "CMD;%s;03;01\r", Command.KEY_UNIQUE_ID); case Command.TYPE_OUTPUT_CONTROL: if (command.getAttributes().get(Command.KEY_DATA).equals("1")) { - switch (command.getString(Command.KEY_INDEX)) { - case "1": + switch (command.getInteger(Command.KEY_INDEX)) { + case 1: return formatCommand(command, "CMD;%s;04;01\r", Command.KEY_UNIQUE_ID); - case "2": + case 2: return formatCommand(command, "CMD;%s;04;03\r", Command.KEY_UNIQUE_ID); - case "3": + case 3: return formatCommand(command, "CMD;%s;04;09\r", Command.KEY_UNIQUE_ID); default: return null; } } else { - switch (command.getString(Command.KEY_INDEX)) { - case "1": + switch (command.getInteger(Command.KEY_INDEX)) { + case 1: return formatCommand(command, "CMD;%s;04;02\r", Command.KEY_UNIQUE_ID); - case "2": + case 2: return formatCommand(command, "CMD;%s;04;04\r", Command.KEY_UNIQUE_ID); - case "3": + case 3: return formatCommand(command, "CMD;%s;04;10\r", Command.KEY_UNIQUE_ID); default: return null; |