aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MeiligaoProtocolEncoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-09-05 16:04:53 +1200
committerGitHub <noreply@github.com>2017-09-05 16:04:53 +1200
commit2a49efdd97bb44c78afb27b00b57d14ed0f403ae (patch)
tree7f954059b508b4fd96d6976d3cd81ed2728a73f6 /src/org/traccar/protocol/MeiligaoProtocolEncoder.java
parent99fd421c76c8e7491095a91630516f6d2db27034 (diff)
parent158071c9ff74c5435b8f51ea82215240acb69551 (diff)
downloadtrackermap-server-2a49efdd97bb44c78afb27b00b57d14ed0f403ae.tar.gz
trackermap-server-2a49efdd97bb44c78afb27b00b57d14ed0f403ae.tar.bz2
trackermap-server-2a49efdd97bb44c78afb27b00b57d14ed0f403ae.zip
Merge pull request #3502 from Abyss777/command_timezone
Accept timezone id instead of offset in commands
Diffstat (limited to 'src/org/traccar/protocol/MeiligaoProtocolEncoder.java')
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolEncoder.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolEncoder.java b/src/org/traccar/protocol/MeiligaoProtocolEncoder.java
index 268bae392..2e0a1e84c 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolEncoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import org.traccar.model.Command;
import javax.xml.bind.DatatypeConverter;
import java.nio.charset.StandardCharsets;
+import java.util.TimeZone;
public class MeiligaoProtocolEncoder extends BaseProtocolEncoder {
@@ -78,7 +79,7 @@ public class MeiligaoProtocolEncoder extends BaseProtocolEncoder {
content.writeShort(command.getInteger(Command.KEY_RADIUS));
return encodeContent(command.getDeviceId(), MSG_MOVEMENT_ALARM, content);
case Command.TYPE_SET_TIMEZONE:
- int offset = command.getInteger(Command.KEY_TIMEZONE) / 60;
+ int offset = TimeZone.getTimeZone(command.getString(Command.KEY_TIMEZONE)).getRawOffset() / 60000;
content.writeBytes(String.valueOf(offset).getBytes(StandardCharsets.US_ASCII));
return encodeContent(command.getDeviceId(), MSG_TIME_ZONE, content);
case Command.TYPE_REBOOT_DEVICE: