aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/WatchProtocolEncoder.java
diff options
context:
space:
mode:
authorAlexander Menk <menk@mestrona.net>2016-12-19 21:27:16 +0100
committerAlexander Menk <menk@mestrona.net>2016-12-19 21:27:16 +0100
commit2c8187fbef2838d90dd39e7636a7f30a6ac3e343 (patch)
tree689cea35405d751b3e895dae94b1fd152dafde56 /src/org/traccar/protocol/WatchProtocolEncoder.java
parent539c07c3fa942445adfbbdf7091cd46094ec1224 (diff)
downloadtrackermap-server-2c8187fbef2838d90dd39e7636a7f30a6ac3e343.tar.gz
trackermap-server-2c8187fbef2838d90dd39e7636a7f30a6ac3e343.tar.bz2
trackermap-server-2c8187fbef2838d90dd39e7636a7f30a6ac3e343.zip
#2702 [WIP] Implement SET_TIMEZONE for watch Protocol - Remove value formatter
+ not needed anyways, I was experiencing some bug in the watch
Diffstat (limited to 'src/org/traccar/protocol/WatchProtocolEncoder.java')
-rw-r--r--src/org/traccar/protocol/WatchProtocolEncoder.java16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/org/traccar/protocol/WatchProtocolEncoder.java b/src/org/traccar/protocol/WatchProtocolEncoder.java
index 3c71d7cac..a84cf9ef0 100644
--- a/src/org/traccar/protocol/WatchProtocolEncoder.java
+++ b/src/org/traccar/protocol/WatchProtocolEncoder.java
@@ -24,19 +24,7 @@ import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
-public class WatchProtocolEncoder extends StringProtocolEncoder implements StringProtocolEncoder.ValueFormatter {
-
- @Override
- public String formatValue(String key, Object value) {
- if (key.equals(Command.KEY_TIMEZONE)) {
- float offset = ((Number) value).longValue();
- if (offset > 0) {
- return "+" + String.format("%f", offset);
- }
- }
-
- return null;
- }
+public class WatchProtocolEncoder extends StringProtocolEncoder {
protected String formatCommand(Command command, String format, String... keys) {
String content = super.formatCommand(command, format, keys);
@@ -117,7 +105,7 @@ public class WatchProtocolEncoder extends StringProtocolEncoder implements Strin
case Command.TYPE_POSITION_PERIODIC:
return formatCommand(command, "UPLOAD,{%s}", Command.KEY_FREQUENCY);
case Command.TYPE_SET_TIMEZONE:
- return formatCommand(command, "LZ,0,{%s}", Command.KEY_TIMEZONE);
+ return formatCommand(command, "LZ,,{%s}", Command.KEY_TIMEZONE);
default:
Log.warning(new UnsupportedOperationException(command.getType()));
break;