diff options
author | Abyss777 <abyss@fox5.ru> | 2017-09-04 18:01:43 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-09-04 18:01:43 +0500 |
commit | 87392d9fbb0289b5486496b6e6b97db1ea84e2b7 (patch) | |
tree | 6d8413ad76307ee7bc52b5788dc202bb55762958 /src/org/traccar/protocol/CityeasyProtocolEncoder.java | |
parent | 99fd421c76c8e7491095a91630516f6d2db27034 (diff) | |
download | trackermap-server-87392d9fbb0289b5486496b6e6b97db1ea84e2b7.tar.gz trackermap-server-87392d9fbb0289b5486496b6e6b97db1ea84e2b7.tar.bz2 trackermap-server-87392d9fbb0289b5486496b6e6b97db1ea84e2b7.zip |
Accept timezone id instead of offset in commands
Diffstat (limited to 'src/org/traccar/protocol/CityeasyProtocolEncoder.java')
-rw-r--r-- | src/org/traccar/protocol/CityeasyProtocolEncoder.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/CityeasyProtocolEncoder.java b/src/org/traccar/protocol/CityeasyProtocolEncoder.java index c800131d6..387926e03 100644 --- a/src/org/traccar/protocol/CityeasyProtocolEncoder.java +++ b/src/org/traccar/protocol/CityeasyProtocolEncoder.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. @@ -15,6 +15,8 @@ */ package org.traccar.protocol; +import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.traccar.BaseProtocolEncoder; @@ -56,13 +58,13 @@ public class CityeasyProtocolEncoder extends BaseProtocolEncoder { content.writeShort(0); return encodeContent(CityeasyProtocolDecoder.MSG_LOCATION_INTERVAL, content); case Command.TYPE_SET_TIMEZONE: - int timezone = command.getInteger(Command.KEY_TIMEZONE); + int timezone = TimeZone.getTimeZone(command.getString(Command.KEY_TIMEZONE)).getRawOffset() / 60000; if (timezone < 0) { content.writeByte(1); } else { content.writeByte(0); } - content.writeShort(Math.abs(timezone) / 60); + content.writeShort(Math.abs(timezone)); return encodeContent(CityeasyProtocolDecoder.MSG_TIMEZONE, content); default: Log.warning(new UnsupportedOperationException(command.getType())); |