aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/AdmProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/ApelProtocolDecoder.java15
-rw-r--r--src/org/traccar/protocol/AplicomProtocolDecoder.java7
-rwxr-xr-xsrc/org/traccar/protocol/AppelloProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/AquilaProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Ardi01ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/AstraProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/AtrackProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/AutoFonProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/Avl301ProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/BceProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/BlackKiteProtocolDecoder.java19
-rw-r--r--src/org/traccar/protocol/BoxProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/CalAmpProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/CarTrackProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/CarscopProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/CastelProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/CellocatorProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/CityeasyProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/EasyTrackProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/EnforaProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/FlextrackProtocol.java3
-rw-r--r--src/org/traccar/protocol/FlextrackProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/FreedomProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/GalileoProtocolDecoder.java19
-rw-r--r--src/org/traccar/protocol/GatorProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/Gl100ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java10
-rw-r--r--src/org/traccar/protocol/GlobalSatProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/GoSafeProtocol.java3
-rw-r--r--src/org/traccar/protocol/GoSafeProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/GotopProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Gps103Protocol.java3
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/GpsGateProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/GpsMarkerProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/GpsmtaProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/Gt02ProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/Gt06Protocol.java3
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java29
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolEncoder.java4
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/H02ProtocolEncoder.java11
-rw-r--r--src/org/traccar/protocol/HaicomProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/HuabaoProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/IntellitracProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Jt600FrameDecoder.java3
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java9
-rwxr-xr-xsrc/org/traccar/protocol/KenjiProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/KhdProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/LaipacProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/M2mProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/ManPowerProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/MegastekFrameDecoder.java4
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocol.java3
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolEncoder.java4
-rw-r--r--src/org/traccar/protocol/MeitrackFrameDecoder.java5
-rw-r--r--src/org/traccar/protocol/MeitrackProtocol.java6
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java21
-rw-r--r--src/org/traccar/protocol/MiniFinderProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Mta6Protocol.java3
-rw-r--r--src/org/traccar/protocol/Mta6ProtocolDecoder.java15
-rw-r--r--src/org/traccar/protocol/MtxProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/MxtFrameDecoder.java3
-rw-r--r--src/org/traccar/protocol/MxtProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/NavigilProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/NavisProtocolDecoder.java27
-rw-r--r--src/org/traccar/protocol/NoranProtocolDecoder.java19
-rw-r--r--src/org/traccar/protocol/NoranProtocolEncoder.java8
-rw-r--r--src/org/traccar/protocol/NvsProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/OrionProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/OsmAndProtocolDecoder.java17
-rw-r--r--src/org/traccar/protocol/PiligrimProtocolDecoder.java15
-rw-r--r--src/org/traccar/protocol/ProgressProtocolDecoder.java17
-rw-r--r--src/org/traccar/protocol/Pt3000ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Pt502ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/RitiProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/RuptelaProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/SanavProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/SkypatrolProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/Stl060ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/SuntechProtocolDecoder.java5
-rwxr-xr-xsrc/org/traccar/protocol/SupermateProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/T55ProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/TaipProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/TelicProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/ThinkRaceProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Tk102ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Tlt2hProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/TopflytechProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/TotemFrameDecoder.java7
-rw-r--r--src/org/traccar/protocol/TotemProtocol.java4
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Tr20ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Tr900ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/TrackboxProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/TramigoFrameDecoder.java3
-rw-r--r--src/org/traccar/protocol/TramigoProtocolDecoder.java23
-rw-r--r--src/org/traccar/protocol/TytanProtocolDecoder.java14
-rw-r--r--src/org/traccar/protocol/TzoneProtocol.java3
-rw-r--r--src/org/traccar/protocol/TzoneProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/UlbotechProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/V680ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/VisiontekProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/WatchProtocol.java10
-rw-r--r--src/org/traccar/protocol/WatchProtocolEncoder.java2
-rw-r--r--src/org/traccar/protocol/WialonProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/WondexProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/XexunProtocol.java3
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/XirgoProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Xt013ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/YwtProtocolDecoder.java5
118 files changed, 494 insertions, 375 deletions
diff --git a/src/org/traccar/protocol/AdmProtocolDecoder.java b/src/org/traccar/protocol/AdmProtocolDecoder.java
index 374dd8995..28d0b5105 100644
--- a/src/org/traccar/protocol/AdmProtocolDecoder.java
+++ b/src/org/traccar/protocol/AdmProtocolDecoder.java
@@ -24,7 +24,7 @@ import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.Date;
public class AdmProtocolDecoder extends BaseProtocolDecoder {
@@ -49,7 +49,7 @@ public class AdmProtocolDecoder extends BaseProtocolDecoder {
int type = buf.readUnsignedByte();
if (type == MSG_IMEI) {
- identify(buf.toString(buf.readerIndex(), 15, Charset.defaultCharset()), channel, remoteAddress);
+ identify(buf.toString(buf.readerIndex(), 15, StandardCharsets.US_ASCII), channel, remoteAddress);
}
if (hasDeviceId() && BitUtil.to(type, 2) == 0) {
diff --git a/src/org/traccar/protocol/ApelProtocolDecoder.java b/src/org/traccar/protocol/ApelProtocolDecoder.java
index a72447883..b75bcbda3 100644
--- a/src/org/traccar/protocol/ApelProtocolDecoder.java
+++ b/src/org/traccar/protocol/ApelProtocolDecoder.java
@@ -15,12 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.ByteOrder;
-import java.nio.charset.Charset;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -30,6 +24,13 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.ByteOrder;
+import java.nio.charset.StandardCharsets;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
public class ApelProtocolDecoder extends BaseProtocolDecoder {
private long lastIndex;
@@ -110,7 +111,7 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder {
int length = buf.readUnsignedShort();
buf.skipBytes(length);
length = buf.readUnsignedShort();
- identify(buf.readBytes(length).toString(Charset.defaultCharset()), channel, remoteAddress);
+ identify(buf.readBytes(length).toString(StandardCharsets.US_ASCII), channel, remoteAddress);
} else if (type == MSG_LAST_LOG_INDEX) {
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java
index c2eb8a1f5..e8e070d67 100644
--- a/src/org/traccar/protocol/AplicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.ArrayList;
-import java.util.Date;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -29,6 +26,10 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.ArrayList;
+import java.util.Date;
+
public class AplicomProtocolDecoder extends BaseProtocolDecoder {
public AplicomProtocolDecoder(AplicomProtocol protocol) {
diff --git a/src/org/traccar/protocol/AppelloProtocolDecoder.java b/src/org/traccar/protocol/AppelloProtocolDecoder.java
index d422a5aa1..48e624f40 100755
--- a/src/org/traccar/protocol/AppelloProtocolDecoder.java
+++ b/src/org/traccar/protocol/AppelloProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -26,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class AppelloProtocolDecoder extends BaseProtocolDecoder {
public AppelloProtocolDecoder(AppelloProtocol protocol) {
diff --git a/src/org/traccar/protocol/AquilaProtocolDecoder.java b/src/org/traccar/protocol/AquilaProtocolDecoder.java
index 74b127bfe..0431e0a26 100644
--- a/src/org/traccar/protocol/AquilaProtocolDecoder.java
+++ b/src/org/traccar/protocol/AquilaProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -26,6 +24,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class AquilaProtocolDecoder extends BaseProtocolDecoder {
public AquilaProtocolDecoder(AquilaProtocol protocol) {
diff --git a/src/org/traccar/protocol/Ardi01ProtocolDecoder.java b/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
index 8f449222b..2a7324127 100644
--- a/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -26,6 +24,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class Ardi01ProtocolDecoder extends BaseProtocolDecoder {
public Ardi01ProtocolDecoder(Ardi01Protocol protocol) {
diff --git a/src/org/traccar/protocol/AstraProtocolDecoder.java b/src/org/traccar/protocol/AstraProtocolDecoder.java
index 8cfec95fe..8f40abedf 100644
--- a/src/org/traccar/protocol/AstraProtocolDecoder.java
+++ b/src/org/traccar/protocol/AstraProtocolDecoder.java
@@ -26,7 +26,7 @@ import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.LinkedList;
import java.util.List;
@@ -78,8 +78,9 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(buf.readUnsignedByte() * 2);
int reason = buf.readUnsignedMedium();
- buf.readUnsignedShort(); // status
+ position.set(Event.KEY_EVENT, reason);
+ position.set(Event.KEY_STATUS, buf.readUnsignedShort());
position.set(Event.PREFIX_IO + 1, buf.readUnsignedByte());
position.set(Event.PREFIX_ADC + 1, buf.readUnsignedByte());
position.set(Event.KEY_BATTERY, buf.readUnsignedByte());
@@ -100,7 +101,7 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(reason, 6) || BitUtil.check(reason, 7)) {
- position.set(Event.KEY_RFID, buf.readBytes(7).toString(Charset.defaultCharset()));
+ position.set(Event.KEY_RFID, buf.readBytes(7).toString(StandardCharsets.US_ASCII));
position.set(Event.KEY_ODOMETER, buf.readUnsignedMedium());
buf.readUnsignedShort(); // engine time
diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java
index 72a17eed2..27c5b8902 100644
--- a/src/org/traccar/protocol/AtrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java
@@ -15,11 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -30,6 +25,12 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
public class AtrackProtocolDecoder extends BaseProtocolDecoder {
private static final int MIN_DATA_LENGTH = 40;
@@ -72,7 +73,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
String result = null;
int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) 0);
if (index > buf.readerIndex()) {
- result = buf.readBytes(index - buf.readerIndex()).toString(Charset.defaultCharset());
+ result = buf.readBytes(index - buf.readerIndex()).toString(StandardCharsets.US_ASCII);
}
buf.readByte();
return result;
diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
index c0c1f9616..a633005b4 100644
--- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
@@ -16,10 +16,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.util.LinkedList;
-import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -29,6 +25,11 @@ import org.traccar.helper.DateBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.LinkedList;
+import java.util.List;
+
public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
public AutoFonProtocolDecoder(AutoFonProtocol protocol) {
@@ -158,7 +159,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
if (channel != null) {
ChannelBuffer response = ChannelBuffers.dynamicBuffer();
- response.writeBytes("resp_crc=".getBytes(Charset.defaultCharset()));
+ response.writeBytes("resp_crc=".getBytes(StandardCharsets.US_ASCII));
response.writeByte(buf.getByte(buf.writerIndex() - 1));
channel.write(response);
}
diff --git a/src/org/traccar/protocol/Avl301ProtocolDecoder.java b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
index c0aefbeae..7f2e3ece7 100644
--- a/src/org/traccar/protocol/Avl301ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
@@ -15,7 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -24,6 +23,8 @@ import org.traccar.helper.DateBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+
public class Avl301ProtocolDecoder extends BaseProtocolDecoder {
public Avl301ProtocolDecoder(Avl301Protocol protocol) {
diff --git a/src/org/traccar/protocol/BceProtocolDecoder.java b/src/org/traccar/protocol/BceProtocolDecoder.java
index 5a5092ae0..fc0a9a3f4 100644
--- a/src/org/traccar/protocol/BceProtocolDecoder.java
+++ b/src/org/traccar/protocol/BceProtocolDecoder.java
@@ -15,11 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.ByteOrder;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -28,6 +23,12 @@ import org.traccar.helper.BitUtil;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.ByteOrder;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
public class BceProtocolDecoder extends BaseProtocolDecoder {
public BceProtocolDecoder(BceProtocol protocol) {
diff --git a/src/org/traccar/protocol/BlackKiteProtocolDecoder.java b/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
index 9f4724351..c4f2eaff9 100644
--- a/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
+++ b/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
@@ -16,14 +16,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.ByteOrder;
-import java.nio.charset.Charset;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -33,6 +25,15 @@ import org.traccar.helper.Log;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.ByteOrder;
+import java.nio.charset.StandardCharsets;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
public class BlackKiteProtocolDecoder extends BaseProtocolDecoder {
public BlackKiteProtocolDecoder(BlackKiteProtocol protocol) {
@@ -96,7 +97,7 @@ public class BlackKiteProtocolDecoder extends BaseProtocolDecoder {
switch (tag) {
case TAG_IMEI:
- String imei = buf.toString(buf.readerIndex(), 15, Charset.defaultCharset());
+ String imei = buf.toString(buf.readerIndex(), 15, StandardCharsets.US_ASCII);
buf.skipBytes(imei.length());
identify(imei, channel, remoteAddress);
break;
diff --git a/src/org/traccar/protocol/BoxProtocolDecoder.java b/src/org/traccar/protocol/BoxProtocolDecoder.java
index 7cd9ad0f9..5edc23a80 100644
--- a/src/org/traccar/protocol/BoxProtocolDecoder.java
+++ b/src/org/traccar/protocol/BoxProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -26,6 +24,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class BoxProtocolDecoder extends BaseProtocolDecoder {
public BoxProtocolDecoder(BoxProtocol protocol) {
diff --git a/src/org/traccar/protocol/CalAmpProtocolDecoder.java b/src/org/traccar/protocol/CalAmpProtocolDecoder.java
index bd648b0f9..292666c31 100644
--- a/src/org/traccar/protocol/CalAmpProtocolDecoder.java
+++ b/src/org/traccar/protocol/CalAmpProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.Date;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -26,6 +24,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.Date;
+
public class CalAmpProtocolDecoder extends BaseProtocolDecoder {
public CalAmpProtocolDecoder(CalAmpProtocol protocol) {
diff --git a/src/org/traccar/protocol/CarTrackProtocolDecoder.java b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
index 9a0a98992..cd5269221 100644
--- a/src/org/traccar/protocol/CarTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
@@ -16,8 +16,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -26,6 +24,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class CarTrackProtocolDecoder extends BaseProtocolDecoder {
public CarTrackProtocolDecoder(CarTrackProtocol protocol) {
diff --git a/src/org/traccar/protocol/CarscopProtocolDecoder.java b/src/org/traccar/protocol/CarscopProtocolDecoder.java
index 9dce57b4e..250a4c564 100644
--- a/src/org/traccar/protocol/CarscopProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarscopProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class CarscopProtocolDecoder extends BaseProtocolDecoder {
public CarscopProtocolDecoder(CarscopProtocol protocol) {
diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java
index 9f332dd04..d3d505c86 100644
--- a/src/org/traccar/protocol/CastelProtocolDecoder.java
+++ b/src/org/traccar/protocol/CastelProtocolDecoder.java
@@ -15,11 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.ByteOrder;
-import java.nio.charset.Charset;
-import java.util.LinkedList;
-import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -30,6 +25,12 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.ByteOrder;
+import java.nio.charset.StandardCharsets;
+import java.util.LinkedList;
+import java.util.List;
+
public class CastelProtocolDecoder extends BaseProtocolDecoder {
public CastelProtocolDecoder(CastelProtocol protocol) {
@@ -148,7 +149,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
ChannelBuffer id = buf.readBytes(20);
int type = ChannelBuffers.swapShort(buf.readShort());
- if (!identify(id.toString(Charset.defaultCharset()).trim(), channel, remoteAddress)) {
+ if (!identify(id.toString(StandardCharsets.US_ASCII).trim(), channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/CellocatorProtocolDecoder.java b/src/org/traccar/protocol/CellocatorProtocolDecoder.java
index 79db82bd1..0a3e4599f 100644
--- a/src/org/traccar/protocol/CellocatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/CellocatorProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -26,6 +24,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.ByteOrder;
+
public class CellocatorProtocolDecoder extends BaseProtocolDecoder {
public CellocatorProtocolDecoder(CellocatorProtocol protocol) {
diff --git a/src/org/traccar/protocol/CityeasyProtocolDecoder.java b/src/org/traccar/protocol/CityeasyProtocolDecoder.java
index 4ccd96a17..9aae900d9 100644
--- a/src/org/traccar/protocol/CityeasyProtocolDecoder.java
+++ b/src/org/traccar/protocol/CityeasyProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.util.regex.Pattern;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -29,6 +26,10 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.regex.Pattern;
+
public class CityeasyProtocolDecoder extends BaseProtocolDecoder {
public CityeasyProtocolDecoder(CityeasyProtocol protocol) {
@@ -82,7 +83,7 @@ public class CityeasyProtocolDecoder extends BaseProtocolDecoder {
if (type == MSG_LOCATION_REPORT || type == MSG_LOCATION_REQUEST) {
- String sentence = buf.toString(buf.readerIndex(), buf.readableBytes() - 8, Charset.defaultCharset());
+ String sentence = buf.toString(buf.readerIndex(), buf.readableBytes() - 8, StandardCharsets.US_ASCII);
Parser parser = new Parser(PATTERN, sentence);
if (!parser.matches()) {
return null;
diff --git a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
index cff90c7f1..320cb3a4f 100644
--- a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
@@ -26,6 +24,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
public EasyTrackProtocolDecoder(EasyTrackProtocol protocol) {
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index 2aa18c20c..07dde53d7 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.Date;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -25,6 +23,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.Date;
+
public class EelinkProtocolDecoder extends BaseProtocolDecoder {
public EelinkProtocolDecoder(EelinkProtocol protocol) {
diff --git a/src/org/traccar/protocol/EnforaProtocolDecoder.java b/src/org/traccar/protocol/EnforaProtocolDecoder.java
index 0153d254c..23cfb0093 100644
--- a/src/org/traccar/protocol/EnforaProtocolDecoder.java
+++ b/src/org/traccar/protocol/EnforaProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.util.regex.Pattern;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBufferIndexFinder;
import org.jboss.netty.channel.Channel;
@@ -28,6 +25,10 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.helper.StringFinder;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.regex.Pattern;
+
public class EnforaProtocolDecoder extends BaseProtocolDecoder {
public EnforaProtocolDecoder(EnforaProtocol protocol) {
@@ -75,7 +76,7 @@ public class EnforaProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- String imei = buf.toString(index, IMEI_LENGTH, Charset.defaultCharset());
+ String imei = buf.toString(index, IMEI_LENGTH, StandardCharsets.US_ASCII);
if (!identify(imei, channel, remoteAddress)) {
return null;
}
@@ -86,7 +87,7 @@ public class EnforaProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- String sentence = buf.toString(start, buf.readableBytes() - start, Charset.defaultCharset());
+ String sentence = buf.toString(start, buf.readableBytes() - start, StandardCharsets.US_ASCII);
Parser parser = new Parser(PATTERN, sentence);
if (!parser.matches()) {
return null;
diff --git a/src/org/traccar/protocol/FlextrackProtocol.java b/src/org/traccar/protocol/FlextrackProtocol.java
index 3b1aaa3d8..c17099fc7 100644
--- a/src/org/traccar/protocol/FlextrackProtocol.java
+++ b/src/org/traccar/protocol/FlextrackProtocol.java
@@ -15,7 +15,6 @@
*/
package org.traccar.protocol;
-import java.util.List;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.handler.codec.string.StringDecoder;
@@ -24,6 +23,8 @@ import org.traccar.BaseProtocol;
import org.traccar.CharacterDelimiterFrameDecoder;
import org.traccar.TrackerServer;
+import java.util.List;
+
public class FlextrackProtocol extends BaseProtocol {
public FlextrackProtocol() {
diff --git a/src/org/traccar/protocol/FlextrackProtocolDecoder.java b/src/org/traccar/protocol/FlextrackProtocolDecoder.java
index 0f82e7c59..9bfac2537 100644
--- a/src/org/traccar/protocol/FlextrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/FlextrackProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -26,6 +24,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class FlextrackProtocolDecoder extends BaseProtocolDecoder {
public FlextrackProtocolDecoder(FlextrackProtocol protocol) {
diff --git a/src/org/traccar/protocol/FreedomProtocolDecoder.java b/src/org/traccar/protocol/FreedomProtocolDecoder.java
index d7d704869..03ab894c5 100644
--- a/src/org/traccar/protocol/FreedomProtocolDecoder.java
+++ b/src/org/traccar/protocol/FreedomProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -24,6 +22,9 @@ import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class FreedomProtocolDecoder extends BaseProtocolDecoder {
public FreedomProtocolDecoder(FreedomProtocol protocol) {
diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java
index ef7cd2ab1..f9c7fb935 100644
--- a/src/org/traccar/protocol/GalileoProtocolDecoder.java
+++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java
@@ -15,9 +15,17 @@
*/
package org.traccar.protocol;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.jboss.netty.channel.Channel;
+import org.traccar.BaseProtocolDecoder;
+import org.traccar.helper.Log;
+import org.traccar.model.Event;
+import org.traccar.model.Position;
+
import java.net.SocketAddress;
import java.nio.ByteOrder;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -25,13 +33,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.jboss.netty.channel.Channel;
-import org.traccar.BaseProtocolDecoder;
-import org.traccar.helper.Log;
-import org.traccar.model.Event;
-import org.traccar.model.Position;
public class GalileoProtocolDecoder extends BaseProtocolDecoder {
@@ -142,7 +143,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
switch (tag) {
case TAG_IMEI:
- String imei = buf.toString(buf.readerIndex(), 15, Charset.defaultCharset());
+ String imei = buf.toString(buf.readerIndex(), 15, StandardCharsets.US_ASCII);
buf.skipBytes(imei.length());
identify(imei, channel, remoteAddress);
break;
diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java
index e28da82ba..1c8e1f4e4 100644
--- a/src/org/traccar/protocol/GatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/GatorProtocolDecoder.java
@@ -15,7 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
@@ -25,6 +24,8 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+
public class GatorProtocolDecoder extends BaseProtocolDecoder {
public GatorProtocolDecoder(GatorProtocol protocol) {
diff --git a/src/org/traccar/protocol/Gl100ProtocolDecoder.java b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
index db5e60838..31102a676 100644
--- a/src/org/traccar/protocol/Gl100ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -24,6 +22,9 @@ import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class Gl100ProtocolDecoder extends BaseProtocolDecoder {
public Gl100ProtocolDecoder(Gl100Protocol protocol) {
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 4592ccdab..617f0f541 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -15,11 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
@@ -31,6 +26,11 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Pattern;
+
public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
public Gl200ProtocolDecoder(Gl200Protocol protocol) {
diff --git a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
index 589bb991a..8c378af90 100644
--- a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
+++ b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
@@ -27,6 +25,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
private String format0;
diff --git a/src/org/traccar/protocol/GoSafeProtocol.java b/src/org/traccar/protocol/GoSafeProtocol.java
index bc1ed14de..b45755fc3 100644
--- a/src/org/traccar/protocol/GoSafeProtocol.java
+++ b/src/org/traccar/protocol/GoSafeProtocol.java
@@ -15,7 +15,6 @@
*/
package org.traccar.protocol;
-import java.util.List;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.handler.codec.string.StringDecoder;
@@ -24,6 +23,8 @@ import org.traccar.BaseProtocol;
import org.traccar.CharacterDelimiterFrameDecoder;
import org.traccar.TrackerServer;
+import java.util.List;
+
public class GoSafeProtocol extends BaseProtocol {
public GoSafeProtocol() {
diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
index 21441479b..e3ab37fbd 100644
--- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java
+++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
@@ -15,11 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
@@ -30,6 +25,12 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Pattern;
+
public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
public GoSafeProtocolDecoder(GoSafeProtocol protocol) {
diff --git a/src/org/traccar/protocol/GotopProtocolDecoder.java b/src/org/traccar/protocol/GotopProtocolDecoder.java
index 594b4c958..65b694aaf 100644
--- a/src/org/traccar/protocol/GotopProtocolDecoder.java
+++ b/src/org/traccar/protocol/GotopProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -26,6 +24,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class GotopProtocolDecoder extends BaseProtocolDecoder {
public GotopProtocolDecoder(GotopProtocol protocol) {
diff --git a/src/org/traccar/protocol/Gps103Protocol.java b/src/org/traccar/protocol/Gps103Protocol.java
index d8ad0a8b7..6a2f8a7f9 100644
--- a/src/org/traccar/protocol/Gps103Protocol.java
+++ b/src/org/traccar/protocol/Gps103Protocol.java
@@ -15,7 +15,6 @@
*/
package org.traccar.protocol;
-import java.util.List;
import org.jboss.netty.bootstrap.ConnectionlessBootstrap;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
@@ -26,6 +25,8 @@ import org.traccar.CharacterDelimiterFrameDecoder;
import org.traccar.TrackerServer;
import org.traccar.model.Command;
+import java.util.List;
+
public class Gps103Protocol extends BaseProtocol {
public Gps103Protocol() {
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index ce5a54141..f2d2ba5ba 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
public Gps103ProtocolDecoder(Gps103Protocol protocol) {
diff --git a/src/org/traccar/protocol/GpsGateProtocolDecoder.java b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
index b48fa6266..127c986a3 100644
--- a/src/org/traccar/protocol/GpsGateProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Checksum;
@@ -26,6 +23,9 @@ import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class GpsGateProtocolDecoder extends BaseProtocolDecoder {
public GpsGateProtocolDecoder(GpsGateProtocol protocol) {
diff --git a/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java b/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
index 9313ad099..e08886938 100644
--- a/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class GpsMarkerProtocolDecoder extends BaseProtocolDecoder {
public GpsMarkerProtocolDecoder(GpsMarkerProtocol protocol) {
diff --git a/src/org/traccar/protocol/GpsmtaProtocolDecoder.java b/src/org/traccar/protocol/GpsmtaProtocolDecoder.java
index 0ee207219..eee4afd36 100644
--- a/src/org/traccar/protocol/GpsmtaProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsmtaProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.Date;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Parser;
@@ -25,6 +22,10 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.Date;
+import java.util.regex.Pattern;
+
public class GpsmtaProtocolDecoder extends BaseProtocolDecoder {
public GpsmtaProtocolDecoder(GpsmtaProtocol protocol) {
diff --git a/src/org/traccar/protocol/Gt02ProtocolDecoder.java b/src/org/traccar/protocol/Gt02ProtocolDecoder.java
index 0b015366e..05655d87f 100644
--- a/src/org/traccar/protocol/Gt02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt02ProtocolDecoder.java
@@ -15,7 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -26,6 +25,8 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+
public class Gt02ProtocolDecoder extends BaseProtocolDecoder {
public Gt02ProtocolDecoder(Gt02Protocol protocol) {
diff --git a/src/org/traccar/protocol/Gt06Protocol.java b/src/org/traccar/protocol/Gt06Protocol.java
index 4630342a5..7f6d5d914 100644
--- a/src/org/traccar/protocol/Gt06Protocol.java
+++ b/src/org/traccar/protocol/Gt06Protocol.java
@@ -15,13 +15,14 @@
*/
package org.traccar.protocol;
-import java.util.List;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
import org.traccar.BaseProtocol;
import org.traccar.TrackerServer;
import org.traccar.model.Command;
+import java.util.List;
+
public class Gt06Protocol extends BaseProtocol {
public Gt06Protocol() {
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index e83ced668..18524fcfa 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.TimeZone;
-
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -30,6 +27,10 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.TimeZone;
+
public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
private boolean forceTimeZone = false;
@@ -203,7 +204,27 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
} else if (hasDeviceId()) {
- if (isSupported(type)) {
+ if (type == MSG_STRING) {
+
+ Position position = new Position();
+ position.setDeviceId(getDeviceId());
+ position.setProtocol(getProtocolName());
+
+ getLastLocation(position, null);
+
+ int commandLength = buf.readUnsignedByte();
+
+ buf.readUnsignedByte(); // server flag (reserved)
+
+ position.set("command", buf.readBytes(commandLength - 1).toString(StandardCharsets.US_ASCII));
+
+ buf.readUnsignedShort(); // language
+
+ sendResponse(channel, type, buf.readUnsignedShort());
+
+ return position;
+
+ } else if (isSupported(type)) {
Position position = new Position();
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/Gt06ProtocolEncoder.java b/src/org/traccar/protocol/Gt06ProtocolEncoder.java
index 6b5f0fc6c..3ef9b1313 100644
--- a/src/org/traccar/protocol/Gt06ProtocolEncoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolEncoder.java
@@ -22,7 +22,7 @@ import org.traccar.helper.Checksum;
import org.traccar.helper.Log;
import org.traccar.model.Command;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
public class Gt06ProtocolEncoder extends BaseProtocolEncoder {
@@ -39,7 +39,7 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder {
buf.writeByte(4 + content.length()); // command length
buf.writeInt(0);
- buf.writeBytes(content.getBytes(Charset.defaultCharset())); // command
+ buf.writeBytes(content.getBytes(StandardCharsets.US_ASCII)); // command
buf.writeShort(0); // message index
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java
index b316d8016..8230639e6 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.util.regex.Pattern;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -30,6 +27,10 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.regex.Pattern;
+
public class H02ProtocolDecoder extends BaseProtocolDecoder {
public H02ProtocolDecoder(H02Protocol protocol) {
@@ -193,12 +194,12 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
ChannelBuffer buf = (ChannelBuffer) msg;
- String marker = buf.toString(0, 1, Charset.defaultCharset());
+ String marker = buf.toString(0, 1, StandardCharsets.US_ASCII);
// handle X mode?
if (marker.equals("*")) {
- return decodeText(buf.toString(Charset.defaultCharset()), channel, remoteAddress);
+ return decodeText(buf.toString(StandardCharsets.US_ASCII), channel, remoteAddress);
} else if (marker.equals("$")) {
return decodeBinary(buf, channel, remoteAddress);
}
diff --git a/src/org/traccar/protocol/H02ProtocolEncoder.java b/src/org/traccar/protocol/H02ProtocolEncoder.java
index 948495b61..4045b46d4 100644
--- a/src/org/traccar/protocol/H02ProtocolEncoder.java
+++ b/src/org/traccar/protocol/H02ProtocolEncoder.java
@@ -1,5 +1,6 @@
/*
* Copyright 2016 Gabor Somogyi (gabor.g.somogyi@gmail.com)
+ * 2016 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,16 +28,16 @@ public class H02ProtocolEncoder extends StringProtocolEncoder {
private Object formatCommand(DateTime time, String uniqueId, String type, String... params) {
- String result = String.format("*%s,%s,%s,%02d%02d%02d",
- MARKER, uniqueId, type, time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute());
+ StringBuilder result = new StringBuilder(String.format("*%s,%s,%s,%02d%02d%02d",
+ MARKER, uniqueId, type, time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute()));
for (String param : params) {
- result += "," + param;
+ result.append(",").append(param);
}
- result += "#";
+ result.append("#");
- return result;
+ return result.toString();
}
protected Object encodeCommand(Command command, DateTime time) {
diff --git a/src/org/traccar/protocol/HaicomProtocolDecoder.java b/src/org/traccar/protocol/HaicomProtocolDecoder.java
index 009c6046c..fd989cecb 100644
--- a/src/org/traccar/protocol/HaicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/HaicomProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
@@ -26,6 +24,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class HaicomProtocolDecoder extends BaseProtocolDecoder {
public HaicomProtocolDecoder(HaicomProtocol protocol) {
diff --git a/src/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/org/traccar/protocol/HuabaoProtocolDecoder.java
index 6ed490c1a..1978fae94 100644
--- a/src/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -28,7 +28,7 @@ import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.TimeZone;
public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
@@ -91,7 +91,7 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
ChannelBuffer response = ChannelBuffers.dynamicBuffer();
response.writeShort(index);
response.writeByte(RESULT_SUCCESS);
- response.writeBytes("authentication".getBytes(Charset.defaultCharset()));
+ response.writeBytes("authentication".getBytes(StandardCharsets.US_ASCII));
sendResponse(channel, remoteAddress, MSG_TERMINAL_REGISTER_RESPONSE, id, response);
} else if (type == MSG_TERMINAL_AUTH) {
diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
index fbab27c17..11f7aab8d 100644
--- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java
+++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
public IntellitracProtocolDecoder(IntellitracProtocol protocol) {
diff --git a/src/org/traccar/protocol/Jt600FrameDecoder.java b/src/org/traccar/protocol/Jt600FrameDecoder.java
index 5c6deaac4..cb7fce0c0 100644
--- a/src/org/traccar/protocol/Jt600FrameDecoder.java
+++ b/src/org/traccar/protocol/Jt600FrameDecoder.java
@@ -15,12 +15,13 @@
*/
package org.traccar.protocol;
-import java.text.ParseException;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.FrameDecoder;
+import java.text.ParseException;
+
public class Jt600FrameDecoder extends FrameDecoder {
@Override
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index 3cd6aedb7..5c247c08a 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.util.regex.Pattern;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -30,6 +27,10 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.regex.Pattern;
+
public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
public Jt600ProtocolDecoder(Jt600Protocol protocol) {
@@ -141,7 +142,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
private Position decodeAlertMessage(ChannelBuffer buf, Channel channel, SocketAddress remoteAddress) {
- Parser parser = new Parser(PATTERN, buf.toString(Charset.defaultCharset()));
+ Parser parser = new Parser(PATTERN, buf.toString(StandardCharsets.US_ASCII));
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/KenjiProtocolDecoder.java b/src/org/traccar/protocol/KenjiProtocolDecoder.java
index e190af948..39bd72b48 100755
--- a/src/org/traccar/protocol/KenjiProtocolDecoder.java
+++ b/src/org/traccar/protocol/KenjiProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class KenjiProtocolDecoder extends BaseProtocolDecoder {
public KenjiProtocolDecoder(KenjiProtocol protocol) {
diff --git a/src/org/traccar/protocol/KhdProtocolDecoder.java b/src/org/traccar/protocol/KhdProtocolDecoder.java
index 07db78c94..b54b8860f 100644
--- a/src/org/traccar/protocol/KhdProtocolDecoder.java
+++ b/src/org/traccar/protocol/KhdProtocolDecoder.java
@@ -15,7 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -27,6 +26,8 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+
public class KhdProtocolDecoder extends BaseProtocolDecoder {
public KhdProtocolDecoder(KhdProtocol protocol) {
diff --git a/src/org/traccar/protocol/LaipacProtocolDecoder.java b/src/org/traccar/protocol/LaipacProtocolDecoder.java
index 292e8adbb..ba0dad4b4 100644
--- a/src/org/traccar/protocol/LaipacProtocolDecoder.java
+++ b/src/org/traccar/protocol/LaipacProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Checksum;
@@ -25,6 +23,9 @@ import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class LaipacProtocolDecoder extends BaseProtocolDecoder {
public LaipacProtocolDecoder(LaipacProtocol protocol) {
diff --git a/src/org/traccar/protocol/M2mProtocolDecoder.java b/src/org/traccar/protocol/M2mProtocolDecoder.java
index dbb73c469..ad9db9a0b 100644
--- a/src/org/traccar/protocol/M2mProtocolDecoder.java
+++ b/src/org/traccar/protocol/M2mProtocolDecoder.java
@@ -15,16 +15,15 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+
public class M2mProtocolDecoder extends BaseProtocolDecoder {
public M2mProtocolDecoder(M2mProtocol protocol) {
diff --git a/src/org/traccar/protocol/ManPowerProtocolDecoder.java b/src/org/traccar/protocol/ManPowerProtocolDecoder.java
index 8c189eef9..dd3d72d42 100644
--- a/src/org/traccar/protocol/ManPowerProtocolDecoder.java
+++ b/src/org/traccar/protocol/ManPowerProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class ManPowerProtocolDecoder extends BaseProtocolDecoder {
public ManPowerProtocolDecoder(ManPowerProtocol protocol) {
diff --git a/src/org/traccar/protocol/MegastekFrameDecoder.java b/src/org/traccar/protocol/MegastekFrameDecoder.java
index a53468017..ba2cc1d25 100644
--- a/src/org/traccar/protocol/MegastekFrameDecoder.java
+++ b/src/org/traccar/protocol/MegastekFrameDecoder.java
@@ -21,7 +21,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.FrameDecoder;
import org.traccar.helper.StringFinder;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
public class MegastekFrameDecoder extends FrameDecoder {
@@ -34,7 +34,7 @@ public class MegastekFrameDecoder extends FrameDecoder {
}
if (Character.isDigit(buf.getByte(buf.readerIndex()))) {
- int length = 4 + Integer.parseInt(buf.toString(buf.readerIndex(), 4, Charset.defaultCharset()));
+ int length = 4 + Integer.parseInt(buf.toString(buf.readerIndex(), 4, StandardCharsets.US_ASCII));
if (buf.readableBytes() >= length) {
return buf.readBytes(length);
}
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java
index 2eebc8d2f..aa60dde58 100644
--- a/src/org/traccar/protocol/MegastekProtocolDecoder.java
+++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class MegastekProtocolDecoder extends BaseProtocolDecoder {
public MegastekProtocolDecoder(MegastekProtocol protocol) {
diff --git a/src/org/traccar/protocol/MeiligaoProtocol.java b/src/org/traccar/protocol/MeiligaoProtocol.java
index 04e15fcee..bce9b3196 100644
--- a/src/org/traccar/protocol/MeiligaoProtocol.java
+++ b/src/org/traccar/protocol/MeiligaoProtocol.java
@@ -15,7 +15,6 @@
*/
package org.traccar.protocol;
-import java.util.List;
import org.jboss.netty.bootstrap.ConnectionlessBootstrap;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
@@ -23,6 +22,8 @@ import org.traccar.BaseProtocol;
import org.traccar.TrackerServer;
import org.traccar.model.Command;
+import java.util.List;
+
public class MeiligaoProtocol extends BaseProtocol {
public MeiligaoProtocol() {
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 5c17aab61..92df085a6 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -15,10 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.util.regex.Pattern;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -31,6 +27,11 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.regex.Pattern;
+
public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
public MeiligaoProtocolDecoder(MeiligaoProtocol protocol) {
@@ -179,7 +180,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
case MSG_SERVER:
if (channel != null) {
response = ChannelBuffers.copiedBuffer(
- getMeiligaoServer(channel), Charset.defaultCharset());
+ getMeiligaoServer(channel), StandardCharsets.US_ASCII);
sendResponse(channel, remoteAddress, id, MSG_SERVER, response);
}
return null;
@@ -226,7 +227,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
}
Parser parser = new Parser(
- pattern, buf.toString(buf.readerIndex(), buf.readableBytes() - 4, Charset.defaultCharset()));
+ pattern, buf.toString(buf.readerIndex(), buf.readableBytes() - 4, StandardCharsets.US_ASCII));
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/MeiligaoProtocolEncoder.java b/src/org/traccar/protocol/MeiligaoProtocolEncoder.java
index a40ce9271..93399df60 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolEncoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolEncoder.java
@@ -23,7 +23,7 @@ import org.traccar.helper.Log;
import org.traccar.model.Command;
import javax.xml.bind.DatatypeConverter;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.Map;
public class MeiligaoProtocolEncoder extends BaseProtocolEncoder {
@@ -81,7 +81,7 @@ public class MeiligaoProtocolEncoder extends BaseProtocolEncoder {
return encodeContent(command.getDeviceId(), MSG_MOVEMENT_ALARM, content);
case Command.TYPE_SET_TIMEZONE:
int offset = ((Number) attributes.get(Command.KEY_TIMEZONE)).intValue() / 60;
- content.writeBytes(String.valueOf(offset).getBytes(Charset.defaultCharset()));
+ content.writeBytes(String.valueOf(offset).getBytes(StandardCharsets.US_ASCII));
return encodeContent(command.getDeviceId(), MSG_TIME_ZONE, content);
case Command.TYPE_REBOOT_DEVICE:
return encodeContent(command.getDeviceId(), MSG_REBOOT_GPS, content);
diff --git a/src/org/traccar/protocol/MeitrackFrameDecoder.java b/src/org/traccar/protocol/MeitrackFrameDecoder.java
index c2ab370a8..3c2d34394 100644
--- a/src/org/traccar/protocol/MeitrackFrameDecoder.java
+++ b/src/org/traccar/protocol/MeitrackFrameDecoder.java
@@ -15,12 +15,13 @@
*/
package org.traccar.protocol;
-import java.nio.charset.Charset;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.FrameDecoder;
+import java.nio.charset.StandardCharsets;
+
public class MeitrackFrameDecoder extends FrameDecoder {
@Override
@@ -34,7 +35,7 @@ public class MeitrackFrameDecoder extends FrameDecoder {
int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) ',');
if (index != -1) {
int length = index - buf.readerIndex() + Integer.parseInt(
- buf.toString(buf.readerIndex() + 3, index - buf.readerIndex() - 3, Charset.defaultCharset()));
+ buf.toString(buf.readerIndex() + 3, index - buf.readerIndex() - 3, StandardCharsets.US_ASCII));
if (buf.readableBytes() >= length) {
return buf.readBytes(length);
}
diff --git a/src/org/traccar/protocol/MeitrackProtocol.java b/src/org/traccar/protocol/MeitrackProtocol.java
index a004d5cb6..01fdcc08c 100644
--- a/src/org/traccar/protocol/MeitrackProtocol.java
+++ b/src/org/traccar/protocol/MeitrackProtocol.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.nio.ByteOrder;
-import java.util.List;
-
import org.jboss.netty.bootstrap.ConnectionlessBootstrap;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
@@ -26,6 +23,9 @@ import org.traccar.BaseProtocol;
import org.traccar.TrackerServer;
import org.traccar.model.Command;
+import java.nio.ByteOrder;
+import java.util.List;
+
public class MeitrackProtocol extends BaseProtocol {
public MeitrackProtocol() {
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index a920c6e76..bbd7c521c 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -15,12 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.regex.Pattern;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
@@ -32,6 +26,13 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Pattern;
+
public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
public MeitrackProtocolDecoder(MeitrackProtocol protocol) {
@@ -82,7 +83,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
private Position decodeRegularMessage(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) {
- Parser parser = new Parser(PATTERN, buf.toString(Charset.defaultCharset()));
+ Parser parser = new Parser(PATTERN, buf.toString(StandardCharsets.US_ASCII));
if (!parser.matches()) {
return null;
}
@@ -159,10 +160,10 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
private List<Position> decodeBinaryMessage(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) {
List<Position> positions = new LinkedList<>();
- String flag = buf.toString(2, 1, Charset.defaultCharset());
+ String flag = buf.toString(2, 1, StandardCharsets.US_ASCII);
int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) ',');
- String imei = buf.toString(index + 1, 15, Charset.defaultCharset());
+ String imei = buf.toString(index + 1, 15, StandardCharsets.US_ASCII);
if (!identify(imei, channel, remoteAddress)) {
return null;
}
@@ -237,7 +238,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) ',');
index = buf.indexOf(index + 1, buf.writerIndex(), (byte) ',');
- String type = buf.toString(index + 1, 3, Charset.defaultCharset());
+ String type = buf.toString(index + 1, 3, StandardCharsets.US_ASCII);
switch (type) {
case "D03":
if (channel != null) {
diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
index 631a4b56b..42962f2f0 100644
--- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
+++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
@@ -26,6 +24,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
public MiniFinderProtocolDecoder(MiniFinderProtocol protocol) {
diff --git a/src/org/traccar/protocol/Mta6Protocol.java b/src/org/traccar/protocol/Mta6Protocol.java
index 607bf8118..ed578b2d7 100644
--- a/src/org/traccar/protocol/Mta6Protocol.java
+++ b/src/org/traccar/protocol/Mta6Protocol.java
@@ -15,7 +15,6 @@
*/
package org.traccar.protocol;
-import java.util.List;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.handler.codec.http.HttpRequestDecoder;
@@ -24,6 +23,8 @@ import org.traccar.BaseProtocol;
import org.traccar.Context;
import org.traccar.TrackerServer;
+import java.util.List;
+
public class Mta6Protocol extends BaseProtocol {
public Mta6Protocol() {
diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
index bc8d95551..aea6cbddc 100644
--- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
@@ -15,11 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -36,6 +31,12 @@ import org.traccar.helper.Log;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
private final boolean simple;
@@ -55,7 +56,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
HttpResponse response = new DefaultHttpResponse(
HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
- ChannelBuffer begin = ChannelBuffers.copiedBuffer("#ACK#", Charset.defaultCharset());
+ ChannelBuffer begin = ChannelBuffers.copiedBuffer("#ACK#", StandardCharsets.US_ASCII);
ChannelBuffer end = ChannelBuffers.directBuffer(3);
end.writeByte(packetId);
end.writeByte(packetCount);
@@ -282,7 +283,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
buf.skipBytes("id=".length());
int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '&');
- String uniqueId = buf.toString(buf.readerIndex(), index - buf.readerIndex(), Charset.defaultCharset());
+ String uniqueId = buf.toString(buf.readerIndex(), index - buf.readerIndex(), StandardCharsets.US_ASCII);
if (!identify(uniqueId, channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/MtxProtocolDecoder.java b/src/org/traccar/protocol/MtxProtocolDecoder.java
index 37a384be9..b524c23bb 100644
--- a/src/org/traccar/protocol/MtxProtocolDecoder.java
+++ b/src/org/traccar/protocol/MtxProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class MtxProtocolDecoder extends BaseProtocolDecoder {
public MtxProtocolDecoder(MtxProtocol protocol) {
diff --git a/src/org/traccar/protocol/MxtFrameDecoder.java b/src/org/traccar/protocol/MxtFrameDecoder.java
index 92723ec16..cb1d8ed8e 100644
--- a/src/org/traccar/protocol/MxtFrameDecoder.java
+++ b/src/org/traccar/protocol/MxtFrameDecoder.java
@@ -15,13 +15,14 @@
*/
package org.traccar.protocol;
-import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.FrameDecoder;
+import java.nio.ByteOrder;
+
public class MxtFrameDecoder extends FrameDecoder {
@Override
diff --git a/src/org/traccar/protocol/MxtProtocolDecoder.java b/src/org/traccar/protocol/MxtProtocolDecoder.java
index 53d5b8b09..600be753d 100644
--- a/src/org/traccar/protocol/MxtProtocolDecoder.java
+++ b/src/org/traccar/protocol/MxtProtocolDecoder.java
@@ -15,7 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
@@ -25,6 +24,8 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+
public class MxtProtocolDecoder extends BaseProtocolDecoder {
public MxtProtocolDecoder(MxtProtocol protocol) {
diff --git a/src/org/traccar/protocol/NavigilProtocolDecoder.java b/src/org/traccar/protocol/NavigilProtocolDecoder.java
index 5b1d67a45..22ae7ddee 100644
--- a/src/org/traccar/protocol/NavigilProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.ByteOrder;
-import java.util.Date;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -28,6 +25,10 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.ByteOrder;
+import java.util.Date;
+
public class NavigilProtocolDecoder extends BaseProtocolDecoder {
public NavigilProtocolDecoder(NavigilProtocol protocol) {
diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java
index 0d740298d..06af49893 100644
--- a/src/org/traccar/protocol/NavisProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavisProtocolDecoder.java
@@ -15,11 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.ByteOrder;
-import java.nio.charset.Charset;
-import java.util.LinkedList;
-import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -30,13 +25,17 @@ import org.traccar.helper.Log;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.ByteOrder;
+import java.nio.charset.StandardCharsets;
+import java.util.LinkedList;
+import java.util.List;
+
public class NavisProtocolDecoder extends BaseProtocolDecoder {
private String prefix;
private long deviceUniqueId, serverId;
- private static final Charset CHARSET = Charset.defaultCharset();
-
public NavisProtocolDecoder(NavisProtocol protocol) {
super(protocol);
}
@@ -183,7 +182,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
ParseResult result = parsePosition(buf);
ChannelBuffer response = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 8);
- response.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "*<T", CHARSET));
+ response.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "*<T", StandardCharsets.US_ASCII));
response.writeInt((int) result.getId());
sendReply(channel, response);
@@ -206,7 +205,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
}
ChannelBuffer response = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 8);
- response.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "*<A", CHARSET));
+ response.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "*<A", StandardCharsets.US_ASCII));
response.writeByte(count);
sendReply(channel, response);
@@ -219,8 +218,8 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
private Object processHandshake(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) {
buf.readByte(); // semicolon symbol
- if (identify(buf.toString(Charset.defaultCharset()), channel, remoteAddress)) {
- sendReply(channel, ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "*<S", CHARSET));
+ if (identify(buf.toString(StandardCharsets.US_ASCII), channel, remoteAddress)) {
+ sendReply(channel, ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "*<S", StandardCharsets.US_ASCII));
}
return null;
}
@@ -235,7 +234,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
private void sendReply(Channel channel, ChannelBuffer data) {
ChannelBuffer header = ChannelBuffers.directBuffer(ByteOrder.LITTLE_ENDIAN, 16);
- header.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, prefix, CHARSET));
+ header.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, prefix, StandardCharsets.US_ASCII));
header.writeInt((int) deviceUniqueId);
header.writeInt((int) serverId);
header.writeShort(data.readableBytes());
@@ -253,7 +252,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
ChannelBuffer buf = (ChannelBuffer) msg;
- prefix = buf.toString(buf.readerIndex(), 4, CHARSET);
+ prefix = buf.toString(buf.readerIndex(), 4, StandardCharsets.US_ASCII);
buf.skipBytes(prefix.length()); // prefix @NTC by default
serverId = buf.readUnsignedInt();
deviceUniqueId = buf.readUnsignedInt();
@@ -264,7 +263,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
return null; // keep alive message
}
- String type = buf.toString(buf.readerIndex(), 3, CHARSET);
+ String type = buf.toString(buf.readerIndex(), 3, StandardCharsets.US_ASCII);
buf.skipBytes(type.length());
switch (type) {
diff --git a/src/org/traccar/protocol/NoranProtocolDecoder.java b/src/org/traccar/protocol/NoranProtocolDecoder.java
index ff1bc2549..693947e58 100644
--- a/src/org/traccar/protocol/NoranProtocolDecoder.java
+++ b/src/org/traccar/protocol/NoranProtocolDecoder.java
@@ -15,11 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.ByteOrder;
-import java.nio.charset.Charset;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -30,6 +25,12 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.ByteOrder;
+import java.nio.charset.StandardCharsets;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
public class NoranProtocolDecoder extends BaseProtocolDecoder {
public NoranProtocolDecoder(NoranProtocol protocol) {
@@ -59,13 +60,13 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder {
ChannelBuffer response = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 13);
response.writeBytes(
- ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "\r\n*KW", Charset.defaultCharset()));
+ ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "\r\n*KW", StandardCharsets.US_ASCII));
response.writeByte(0);
response.writeShort(response.capacity());
response.writeShort(MSG_SHAKE_HAND_RESPONSE);
response.writeByte(1); // status
response.writeBytes(
- ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "\r\n", Charset.defaultCharset()));
+ ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "\r\n", StandardCharsets.US_ASCII));
channel.write(response, remoteAddress);
@@ -119,7 +120,7 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder {
} else {
rawId = buf.readBytes(11);
}
- String id = rawId.toString(Charset.defaultCharset()).replaceAll("[^\\p{Print}]", "");
+ String id = rawId.toString(StandardCharsets.US_ASCII).replaceAll("[^\\p{Print}]", "");
if (!identify(id, channel, remoteAddress)) {
return null;
}
@@ -127,7 +128,7 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder {
if (newFormat) {
DateFormat dateFormat = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
- position.setTime(dateFormat.parse(buf.readBytes(17).toString(Charset.defaultCharset())));
+ position.setTime(dateFormat.parse(buf.readBytes(17).toString(StandardCharsets.US_ASCII)));
buf.readByte();
}
diff --git a/src/org/traccar/protocol/NoranProtocolEncoder.java b/src/org/traccar/protocol/NoranProtocolEncoder.java
index 6a5bfdcb2..1f1988802 100644
--- a/src/org/traccar/protocol/NoranProtocolEncoder.java
+++ b/src/org/traccar/protocol/NoranProtocolEncoder.java
@@ -22,7 +22,7 @@ import org.traccar.helper.Log;
import org.traccar.model.Command;
import java.nio.ByteOrder;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
public class NoranProtocolEncoder extends BaseProtocolEncoder {
@@ -31,16 +31,16 @@ public class NoranProtocolEncoder extends BaseProtocolEncoder {
ChannelBuffer buf = ChannelBuffers.buffer(ByteOrder.LITTLE_ENDIAN, 12 + 56);
buf.writeBytes(
- ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "\r\n*KW", Charset.defaultCharset()));
+ ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "\r\n*KW", StandardCharsets.US_ASCII));
buf.writeByte(0);
buf.writeShort(buf.capacity());
buf.writeShort(NoranProtocolDecoder.MSG_CONTROL);
buf.writeInt(0); // gis ip
buf.writeShort(0); // gis port
- buf.writeBytes(content.getBytes(Charset.defaultCharset()));
+ buf.writeBytes(content.getBytes(StandardCharsets.US_ASCII));
buf.writerIndex(buf.writerIndex() + 50 - content.length());
buf.writeBytes(
- ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "\r\n", Charset.defaultCharset()));
+ ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "\r\n", StandardCharsets.US_ASCII));
return buf;
}
diff --git a/src/org/traccar/protocol/NvsProtocolDecoder.java b/src/org/traccar/protocol/NvsProtocolDecoder.java
index 9dcf31899..5d91a04ab 100644
--- a/src/org/traccar/protocol/NvsProtocolDecoder.java
+++ b/src/org/traccar/protocol/NvsProtocolDecoder.java
@@ -24,7 +24,7 @@ import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
@@ -37,7 +37,7 @@ public class NvsProtocolDecoder extends BaseProtocolDecoder {
private void sendResponse(Channel channel, String response) {
if (channel != null) {
- channel.write(ChannelBuffers.copiedBuffer(response, Charset.defaultCharset()));
+ channel.write(ChannelBuffers.copiedBuffer(response, StandardCharsets.US_ASCII));
}
}
@@ -52,7 +52,7 @@ public class NvsProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // length
- String imei = buf.toString(buf.readerIndex(), 15, Charset.defaultCharset());
+ String imei = buf.toString(buf.readerIndex(), 15, StandardCharsets.US_ASCII);
if (!identify(imei, channel, remoteAddress)) {
sendResponse(channel, "NO01");
diff --git a/src/org/traccar/protocol/OrionProtocolDecoder.java b/src/org/traccar/protocol/OrionProtocolDecoder.java
index d2b0ed5ea..341110ea8 100644
--- a/src/org/traccar/protocol/OrionProtocolDecoder.java
+++ b/src/org/traccar/protocol/OrionProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.LinkedList;
-import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -26,6 +23,10 @@ import org.traccar.helper.DateBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.LinkedList;
+import java.util.List;
+
public class OrionProtocolDecoder extends BaseProtocolDecoder {
public OrionProtocolDecoder(OrionProtocol protocol) {
diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
index e732c6631..61a83f317 100644
--- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java
+++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
@@ -15,13 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelFutureListener;
import org.jboss.netty.handler.codec.http.DefaultHttpResponse;
@@ -35,6 +28,14 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
public OsmAndProtocolDecoder(OsmAndProtocol protocol) {
@@ -50,7 +51,7 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
Map<String, List<String>> params = decoder.getParameters();
if (params.isEmpty()) {
decoder = new QueryStringDecoder(
- request.getContent().toString(Charset.defaultCharset()), false);
+ request.getContent().toString(StandardCharsets.US_ASCII), false);
params = decoder.getParameters();
}
diff --git a/src/org/traccar/protocol/PiligrimProtocolDecoder.java b/src/org/traccar/protocol/PiligrimProtocolDecoder.java
index 9cd2c1dc1..b191d2d1f 100644
--- a/src/org/traccar/protocol/PiligrimProtocolDecoder.java
+++ b/src/org/traccar/protocol/PiligrimProtocolDecoder.java
@@ -15,12 +15,6 @@
*/
package org.traccar.protocol;
-import java.nio.ByteOrder;
-import java.nio.charset.Charset;
-import java.net.SocketAddress;
-import java.util.LinkedList;
-import java.util.List;
-
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -30,13 +24,18 @@ import org.jboss.netty.handler.codec.http.HttpResponse;
import org.jboss.netty.handler.codec.http.HttpResponseStatus;
import org.jboss.netty.handler.codec.http.HttpVersion;
import org.jboss.netty.handler.codec.http.QueryStringDecoder;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.ByteOrder;
+import java.nio.charset.StandardCharsets;
+import java.util.LinkedList;
+import java.util.List;
+
public class PiligrimProtocolDecoder extends BaseProtocolDecoder {
public PiligrimProtocolDecoder(PiligrimProtocol protocol) {
@@ -48,7 +47,7 @@ public class PiligrimProtocolDecoder extends BaseProtocolDecoder {
HttpResponse response = new DefaultHttpResponse(
HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
response.setContent(ChannelBuffers.copiedBuffer(
- ByteOrder.BIG_ENDIAN, message, Charset.defaultCharset()));
+ ByteOrder.BIG_ENDIAN, message, StandardCharsets.US_ASCII));
channel.write(response);
}
}
diff --git a/src/org/traccar/protocol/ProgressProtocolDecoder.java b/src/org/traccar/protocol/ProgressProtocolDecoder.java
index eead2b4bb..e45cf313c 100644
--- a/src/org/traccar/protocol/ProgressProtocolDecoder.java
+++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java
@@ -15,12 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.ByteOrder;
-import java.nio.charset.Charset;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -29,6 +23,13 @@ import org.traccar.helper.BitUtil;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.ByteOrder;
+import java.nio.charset.StandardCharsets;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
public class ProgressProtocolDecoder extends BaseProtocolDecoder {
private long lastIndex;
@@ -77,7 +78,7 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
length = buf.readUnsignedShort();
buf.skipBytes(length);
length = buf.readUnsignedShort();
- String imei = buf.readBytes(length).toString(Charset.defaultCharset());
+ String imei = buf.readBytes(length).toString(StandardCharsets.US_ASCII);
identify(imei, channel, remoteAddress);
} else if (hasDeviceId() && (type == MSG_POINT || type == MSG_ALARM || type == MSG_LOGMSG)) {
@@ -135,7 +136,7 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(extraFlags, 1)) {
int size = buf.readUnsignedShort();
- position.set("can", buf.toString(buf.readerIndex(), size, Charset.defaultCharset()));
+ position.set("can", buf.toString(buf.readerIndex(), size, StandardCharsets.US_ASCII));
buf.skipBytes(size);
}
diff --git a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
index d0476d66b..146e3f0a4 100644
--- a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -24,6 +22,9 @@ import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class Pt3000ProtocolDecoder extends BaseProtocolDecoder {
public Pt3000ProtocolDecoder(Pt3000Protocol protocol) {
diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
index faca2a620..5a1a97056 100644
--- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
@@ -16,8 +16,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -26,6 +24,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
public Pt502ProtocolDecoder(Pt502Protocol protocol) {
diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java
index 1b95bb8f6..5db126a83 100644
--- a/src/org/traccar/protocol/RitiProtocolDecoder.java
+++ b/src/org/traccar/protocol/RitiProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.util.regex.Pattern;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
@@ -27,6 +24,10 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.regex.Pattern;
+
public class RitiProtocolDecoder extends BaseProtocolDecoder {
public RitiProtocolDecoder(RitiProtocol protocol) {
@@ -76,7 +77,7 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder {
// Parse GPRMC
int end = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '*');
- String gprmc = buf.toString(buf.readerIndex(), end - buf.readerIndex(), Charset.defaultCharset());
+ String gprmc = buf.toString(buf.readerIndex(), end - buf.readerIndex(), StandardCharsets.US_ASCII);
Parser parser = new Parser(PATTERN, gprmc);
if (!parser.matches()) {
return null;
diff --git a/src/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/org/traccar/protocol/RuptelaProtocolDecoder.java
index 3bb8ad1f4..ef54bdd19 100644
--- a/src/org/traccar/protocol/RuptelaProtocolDecoder.java
+++ b/src/org/traccar/protocol/RuptelaProtocolDecoder.java
@@ -15,10 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -27,6 +23,11 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
public RuptelaProtocolDecoder(RuptelaProtocol protocol) {
diff --git a/src/org/traccar/protocol/SanavProtocolDecoder.java b/src/org/traccar/protocol/SanavProtocolDecoder.java
index 2adefcf3a..156e730a9 100644
--- a/src/org/traccar/protocol/SanavProtocolDecoder.java
+++ b/src/org/traccar/protocol/SanavProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -24,6 +22,9 @@ import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class SanavProtocolDecoder extends BaseProtocolDecoder {
public SanavProtocolDecoder(SanavProtocol protocol) {
diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
index 262bafa6e..087dc8841 100644
--- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
+++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
@@ -27,6 +25,9 @@ import org.traccar.helper.Log;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+
public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
private final long defaultMask;
@@ -75,10 +76,10 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
String id;
if (BitUtil.check(mask, 23)) {
- id = buf.toString(buf.readerIndex(), 8, Charset.defaultCharset()).trim();
+ id = buf.toString(buf.readerIndex(), 8, StandardCharsets.US_ASCII).trim();
buf.skipBytes(8);
} else if (BitUtil.check(mask, 2)) {
- id = buf.toString(buf.readerIndex(), 22, Charset.defaultCharset()).trim();
+ id = buf.toString(buf.readerIndex(), 22, StandardCharsets.US_ASCII).trim();
buf.skipBytes(22);
} else {
Log.warning("No device id field");
diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
index e85831b5d..59a76e4b2 100644
--- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class Stl060ProtocolDecoder extends BaseProtocolDecoder {
public Stl060ProtocolDecoder(Stl060Protocol protocol) {
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java
index 89c8b2ebd..0203f8277 100644
--- a/src/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -26,6 +24,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class SuntechProtocolDecoder extends BaseProtocolDecoder {
public SuntechProtocolDecoder(SuntechProtocol protocol) {
diff --git a/src/org/traccar/protocol/SupermateProtocolDecoder.java b/src/org/traccar/protocol/SupermateProtocolDecoder.java
index af0b1ac8e..cc02c8615 100755
--- a/src/org/traccar/protocol/SupermateProtocolDecoder.java
+++ b/src/org/traccar/protocol/SupermateProtocolDecoder.java
@@ -25,7 +25,7 @@ import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.Calendar;
import java.util.regex.Pattern;
@@ -116,7 +116,7 @@ public class SupermateProtocolDecoder extends BaseProtocolDecoder {
String content = String.format("#1:%s:1:*,00000000,UP,%02x%02x%02x,%02x%02x%02x#", imei,
calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.DAY_OF_MONTH),
calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND));
- channel.write(ChannelBuffers.copiedBuffer(content, Charset.defaultCharset()));
+ channel.write(ChannelBuffers.copiedBuffer(content, StandardCharsets.US_ASCII));
}
return position;
diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java
index a71ef6b33..e4d94b0aa 100644
--- a/src/org/traccar/protocol/T55ProtocolDecoder.java
+++ b/src/org/traccar/protocol/T55ProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.Date;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.socket.DatagramChannel;
import org.traccar.BaseProtocolDecoder;
@@ -27,6 +24,10 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.Date;
+import java.util.regex.Pattern;
+
public class T55ProtocolDecoder extends BaseProtocolDecoder {
public T55ProtocolDecoder(T55Protocol protocol) {
diff --git a/src/org/traccar/protocol/TaipProtocolDecoder.java b/src/org/traccar/protocol/TaipProtocolDecoder.java
index 3611544d5..3e1529338 100644
--- a/src/org/traccar/protocol/TaipProtocolDecoder.java
+++ b/src/org/traccar/protocol/TaipProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.Date;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -28,6 +25,10 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.Date;
+import java.util.regex.Pattern;
+
public class TaipProtocolDecoder extends BaseProtocolDecoder {
private final boolean sendResponse;
diff --git a/src/org/traccar/protocol/TelicProtocolDecoder.java b/src/org/traccar/protocol/TelicProtocolDecoder.java
index ba6d9c47e..0399271d6 100644
--- a/src/org/traccar/protocol/TelicProtocolDecoder.java
+++ b/src/org/traccar/protocol/TelicProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class TelicProtocolDecoder extends BaseProtocolDecoder {
public TelicProtocolDecoder(TelicProtocol protocol) {
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index f8266d076..f4c5c6932 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -15,11 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -29,6 +24,12 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
public TeltonikaProtocolDecoder(TeltonikaProtocol protocol) {
@@ -38,7 +39,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
private void parseIdentification(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) {
int length = buf.readUnsignedShort();
- String imei = buf.toString(buf.readerIndex(), length, Charset.defaultCharset());
+ String imei = buf.toString(buf.readerIndex(), length, StandardCharsets.US_ASCII);
boolean result = identify(imei, channel, remoteAddress);
if (channel != null) {
diff --git a/src/org/traccar/protocol/ThinkRaceProtocolDecoder.java b/src/org/traccar/protocol/ThinkRaceProtocolDecoder.java
index 678f96f2a..ed8cd827a 100644
--- a/src/org/traccar/protocol/ThinkRaceProtocolDecoder.java
+++ b/src/org/traccar/protocol/ThinkRaceProtocolDecoder.java
@@ -24,7 +24,7 @@ import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.Date;
public class ThinkRaceProtocolDecoder extends BaseProtocolDecoder {
@@ -63,7 +63,7 @@ public class ThinkRaceProtocolDecoder extends BaseProtocolDecoder {
int command = buf.readUnsignedByte(); // 0x00 - heartbeat
if (command == 0x01) {
- String imei = buf.toString(buf.readerIndex(), 15, Charset.defaultCharset());
+ String imei = buf.toString(buf.readerIndex(), 15, StandardCharsets.US_ASCII);
if (identify(imei, channel, remoteAddress) && channel != null) {
ChannelBuffer response = ChannelBuffers.dynamicBuffer();
response.writeByte(0x48); response.writeByte(0x52); // header
diff --git a/src/org/traccar/protocol/Tk102ProtocolDecoder.java b/src/org/traccar/protocol/Tk102ProtocolDecoder.java
index 70ee9bd84..8323d6a3d 100644
--- a/src/org/traccar/protocol/Tk102ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk102ProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -24,6 +22,9 @@ import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class Tk102ProtocolDecoder extends BaseProtocolDecoder {
public Tk102ProtocolDecoder(Tk102Protocol protocol) {
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 322ec9747..760b089de 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
@@ -28,6 +26,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
public Tk103ProtocolDecoder(Tk103Protocol protocol) {
diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
index 802b00f1f..f78dbd5eb 100644
--- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -15,10 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -27,6 +23,11 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Pattern;
+
public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
public Tlt2hProtocolDecoder(Tlt2hProtocol protocol) {
diff --git a/src/org/traccar/protocol/TopflytechProtocolDecoder.java b/src/org/traccar/protocol/TopflytechProtocolDecoder.java
index 231d71f24..7333c4c86 100644
--- a/src/org/traccar/protocol/TopflytechProtocolDecoder.java
+++ b/src/org/traccar/protocol/TopflytechProtocolDecoder.java
@@ -15,17 +15,16 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class TopflytechProtocolDecoder extends BaseProtocolDecoder {
public TopflytechProtocolDecoder(TopflytechProtocol protocol) {
diff --git a/src/org/traccar/protocol/TotemFrameDecoder.java b/src/org/traccar/protocol/TotemFrameDecoder.java
index 83c328173..374161758 100644
--- a/src/org/traccar/protocol/TotemFrameDecoder.java
+++ b/src/org/traccar/protocol/TotemFrameDecoder.java
@@ -15,13 +15,14 @@
*/
package org.traccar.protocol;
-import java.nio.charset.Charset;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.FrameDecoder;
import org.traccar.helper.StringFinder;
+import java.nio.charset.StandardCharsets;
+
public class TotemFrameDecoder extends FrameDecoder {
@Override
@@ -43,9 +44,9 @@ public class TotemFrameDecoder extends FrameDecoder {
int flagIndex = buf.indexOf(buf.readerIndex(), buf.writerIndex(), new StringFinder("AA"));
if (flagIndex != -1 && flagIndex - beginIndex == 6) {
- length = Integer.parseInt(buf.toString(buf.readerIndex() + 2, 4, Charset.defaultCharset()));
+ length = Integer.parseInt(buf.toString(buf.readerIndex() + 2, 4, StandardCharsets.US_ASCII));
} else {
- length = Integer.parseInt(buf.toString(buf.readerIndex() + 2, 2, Charset.defaultCharset()), 16);
+ length = Integer.parseInt(buf.toString(buf.readerIndex() + 2, 2, StandardCharsets.US_ASCII), 16);
}
if (length <= buf.readableBytes()) {
diff --git a/src/org/traccar/protocol/TotemProtocol.java b/src/org/traccar/protocol/TotemProtocol.java
index 4d7f0a135..e573adcc6 100644
--- a/src/org/traccar/protocol/TotemProtocol.java
+++ b/src/org/traccar/protocol/TotemProtocol.java
@@ -18,12 +18,12 @@ package org.traccar.protocol;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.handler.codec.string.StringDecoder;
+import org.jboss.netty.handler.codec.string.StringEncoder;
import org.traccar.BaseProtocol;
import org.traccar.TrackerServer;
+import org.traccar.model.Command;
import java.util.List;
-import org.jboss.netty.handler.codec.string.StringEncoder;
-import org.traccar.model.Command;
public class TotemProtocol extends BaseProtocol {
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java
index bb72c2d64..95cb37138 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -26,6 +24,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class TotemProtocolDecoder extends BaseProtocolDecoder {
public TotemProtocolDecoder(TotemProtocol protocol) {
diff --git a/src/org/traccar/protocol/Tr20ProtocolDecoder.java b/src/org/traccar/protocol/Tr20ProtocolDecoder.java
index 338c0533d..de16fafb6 100644
--- a/src/org/traccar/protocol/Tr20ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tr20ProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class Tr20ProtocolDecoder extends BaseProtocolDecoder {
public Tr20ProtocolDecoder(Tr20Protocol protocol) {
diff --git a/src/org/traccar/protocol/Tr900ProtocolDecoder.java b/src/org/traccar/protocol/Tr900ProtocolDecoder.java
index b3500d552..8e96df2bf 100644
--- a/src/org/traccar/protocol/Tr900ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tr900ProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class Tr900ProtocolDecoder extends BaseProtocolDecoder {
public Tr900ProtocolDecoder(Tr900Protocol protocol) {
diff --git a/src/org/traccar/protocol/TrackboxProtocolDecoder.java b/src/org/traccar/protocol/TrackboxProtocolDecoder.java
index f220972ad..63249e25e 100644
--- a/src/org/traccar/protocol/TrackboxProtocolDecoder.java
+++ b/src/org/traccar/protocol/TrackboxProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class TrackboxProtocolDecoder extends BaseProtocolDecoder {
public TrackboxProtocolDecoder(TrackboxProtocol protocol) {
diff --git a/src/org/traccar/protocol/TramigoFrameDecoder.java b/src/org/traccar/protocol/TramigoFrameDecoder.java
index aeeb4152c..4178fba8d 100644
--- a/src/org/traccar/protocol/TramigoFrameDecoder.java
+++ b/src/org/traccar/protocol/TramigoFrameDecoder.java
@@ -15,13 +15,14 @@
*/
package org.traccar.protocol;
-import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder;
+import java.nio.ByteOrder;
+
public class TramigoFrameDecoder extends LengthFieldBasedFrameDecoder {
public TramigoFrameDecoder() {
diff --git a/src/org/traccar/protocol/TramigoProtocolDecoder.java b/src/org/traccar/protocol/TramigoProtocolDecoder.java
index 1fd427ecf..6291ece14 100644
--- a/src/org/traccar/protocol/TramigoProtocolDecoder.java
+++ b/src/org/traccar/protocol/TramigoProtocolDecoder.java
@@ -15,15 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -33,6 +24,16 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
public class TramigoProtocolDecoder extends BaseProtocolDecoder {
public TramigoProtocolDecoder(TramigoProtocol protocol) {
@@ -101,10 +102,10 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder {
} else if (protocol == 0x80) {
if (channel != null) {
- channel.write(ChannelBuffers.copiedBuffer("gprs,ack," + index, Charset.defaultCharset()));
+ channel.write(ChannelBuffers.copiedBuffer("gprs,ack," + index, StandardCharsets.US_ASCII));
}
- String sentence = buf.toString(Charset.defaultCharset());
+ String sentence = buf.toString(StandardCharsets.US_ASCII);
Pattern pattern = Pattern.compile("(-?\\d+\\.\\d+), (-?\\d+\\.\\d+)");
Matcher matcher = pattern.matcher(sentence);
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java
index 40861bacb..a30bd6763 100644
--- a/src/org/traccar/protocol/TytanProtocolDecoder.java
+++ b/src/org/traccar/protocol/TytanProtocolDecoder.java
@@ -15,12 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -30,6 +24,12 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
public class TytanProtocolDecoder extends BaseProtocolDecoder {
public TytanProtocolDecoder(TytanProtocol protocol) {
@@ -132,7 +132,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
if (channel != null) {
ChannelBuffer response = ChannelBuffers.copiedBuffer(
- "^" + index, Charset.defaultCharset());
+ "^" + index, StandardCharsets.US_ASCII);
channel.write(response, remoteAddress);
}
diff --git a/src/org/traccar/protocol/TzoneProtocol.java b/src/org/traccar/protocol/TzoneProtocol.java
index 79c73d418..2d98e3f79 100644
--- a/src/org/traccar/protocol/TzoneProtocol.java
+++ b/src/org/traccar/protocol/TzoneProtocol.java
@@ -15,13 +15,14 @@
*/
package org.traccar.protocol;
-import java.util.List;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder;
import org.traccar.BaseProtocol;
import org.traccar.TrackerServer;
+import java.util.List;
+
public class TzoneProtocol extends BaseProtocol {
public TzoneProtocol() {
diff --git a/src/org/traccar/protocol/TzoneProtocolDecoder.java b/src/org/traccar/protocol/TzoneProtocolDecoder.java
index eb08664e5..01e42964d 100644
--- a/src/org/traccar/protocol/TzoneProtocolDecoder.java
+++ b/src/org/traccar/protocol/TzoneProtocolDecoder.java
@@ -15,7 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -25,6 +24,8 @@ import org.traccar.helper.DateBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+
public class TzoneProtocolDecoder extends BaseProtocolDecoder {
public TzoneProtocolDecoder(TzoneProtocol protocol) {
diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
index efa63bee2..60d8ba52d 100644
--- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java
+++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
@@ -15,9 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.util.Date;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -29,6 +26,10 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.Date;
+
public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
private final long timeZone;
@@ -204,11 +205,11 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
break;
case DATA_VIN:
- position.set(Event.KEY_VIN, buf.readBytes(length).toString(Charset.defaultCharset()));
+ position.set(Event.KEY_VIN, buf.readBytes(length).toString(StandardCharsets.US_ASCII));
break;
case DATA_RFID:
- position.set(Event.KEY_RFID, buf.readBytes(length - 1).toString(Charset.defaultCharset()));
+ position.set(Event.KEY_RFID, buf.readBytes(length - 1).toString(StandardCharsets.US_ASCII));
position.set("authorized", buf.readUnsignedByte() != 0);
break;
diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java
index 3ba6c8f0e..aa1ae83fb 100644
--- a/src/org/traccar/protocol/V680ProtocolDecoder.java
+++ b/src/org/traccar/protocol/V680ProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class V680ProtocolDecoder extends BaseProtocolDecoder {
public V680ProtocolDecoder(V680Protocol protocol) {
diff --git a/src/org/traccar/protocol/VisiontekProtocolDecoder.java b/src/org/traccar/protocol/VisiontekProtocolDecoder.java
index e4c9656f7..63f43fda8 100644
--- a/src/org/traccar/protocol/VisiontekProtocolDecoder.java
+++ b/src/org/traccar/protocol/VisiontekProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -26,6 +24,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class VisiontekProtocolDecoder extends BaseProtocolDecoder {
public VisiontekProtocolDecoder(VisiontekProtocol protocol) {
diff --git a/src/org/traccar/protocol/WatchProtocol.java b/src/org/traccar/protocol/WatchProtocol.java
index 05308a7e2..325137c47 100644
--- a/src/org/traccar/protocol/WatchProtocol.java
+++ b/src/org/traccar/protocol/WatchProtocol.java
@@ -31,7 +31,15 @@ public class WatchProtocol extends BaseProtocol {
public WatchProtocol() {
super("watch");
setSupportedCommands(
- Command.TYPE_REBOOT_DEVICE);
+ Command.TYPE_SOS_NUMBER,
+ Command.TYPE_ALARM_SOS,
+ Command.TYPE_ALARM_BATTERY,
+ Command.TYPE_REBOOT_DEVICE,
+ Command.TYPE_ALARM_REMOVE,
+ Command.TYPE_SILENCE_TIME,
+ Command.TYPE_ALARM_CLOCK,
+ Command.TYPE_SET_PHONEBOOK,
+ Command.TYPE_VOICE_MESSAGE);
}
@Override
diff --git a/src/org/traccar/protocol/WatchProtocolEncoder.java b/src/org/traccar/protocol/WatchProtocolEncoder.java
index b31c2e076..3e7f198ff 100644
--- a/src/org/traccar/protocol/WatchProtocolEncoder.java
+++ b/src/org/traccar/protocol/WatchProtocolEncoder.java
@@ -20,9 +20,7 @@ import org.traccar.helper.Log;
import org.traccar.model.Command;
import javax.xml.bind.DatatypeConverter;
-import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java
index bfaa19954..bf6857ee9 100644
--- a/src/org/traccar/protocol/WialonProtocolDecoder.java
+++ b/src/org/traccar/protocol/WialonProtocolDecoder.java
@@ -15,11 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -28,6 +23,12 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
public class WialonProtocolDecoder extends BaseProtocolDecoder {
public WialonProtocolDecoder(WialonProtocol protocol) {
diff --git a/src/org/traccar/protocol/WondexProtocolDecoder.java b/src/org/traccar/protocol/WondexProtocolDecoder.java
index f2c617898..def878727 100644
--- a/src/org/traccar/protocol/WondexProtocolDecoder.java
+++ b/src/org/traccar/protocol/WondexProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -26,6 +24,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class WondexProtocolDecoder extends BaseProtocolDecoder {
public WondexProtocolDecoder(WondexProtocol protocol) {
diff --git a/src/org/traccar/protocol/XexunProtocol.java b/src/org/traccar/protocol/XexunProtocol.java
index ea3ed8c10..f99a3a9ee 100644
--- a/src/org/traccar/protocol/XexunProtocol.java
+++ b/src/org/traccar/protocol/XexunProtocol.java
@@ -15,7 +15,6 @@
*/
package org.traccar.protocol;
-import java.util.List;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder;
@@ -24,6 +23,8 @@ import org.traccar.BaseProtocol;
import org.traccar.Context;
import org.traccar.TrackerServer;
+import java.util.List;
+
public class XexunProtocol extends BaseProtocol {
public XexunProtocol() {
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index 4d4831a20..3a1005f09 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class XexunProtocolDecoder extends BaseProtocolDecoder {
private final boolean full;
diff --git a/src/org/traccar/protocol/XirgoProtocolDecoder.java b/src/org/traccar/protocol/XirgoProtocolDecoder.java
index 0f6ad50ba..38a14ffcf 100644
--- a/src/org/traccar/protocol/XirgoProtocolDecoder.java
+++ b/src/org/traccar/protocol/XirgoProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -26,6 +24,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class XirgoProtocolDecoder extends BaseProtocolDecoder {
public XirgoProtocolDecoder(XirgoProtocol protocol) {
diff --git a/src/org/traccar/protocol/Xt013ProtocolDecoder.java b/src/org/traccar/protocol/Xt013ProtocolDecoder.java
index b5e20d92e..45897b4aa 100644
--- a/src/org/traccar/protocol/Xt013ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xt013ProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -26,6 +24,9 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class Xt013ProtocolDecoder extends BaseProtocolDecoder {
public Xt013ProtocolDecoder(Xt013Protocol protocol) {
diff --git a/src/org/traccar/protocol/YwtProtocolDecoder.java b/src/org/traccar/protocol/YwtProtocolDecoder.java
index 2977e3cf8..384fe1184 100644
--- a/src/org/traccar/protocol/YwtProtocolDecoder.java
+++ b/src/org/traccar/protocol/YwtProtocolDecoder.java
@@ -15,8 +15,6 @@
*/
package org.traccar.protocol;
-import java.net.SocketAddress;
-import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.DateBuilder;
@@ -25,6 +23,9 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
public class YwtProtocolDecoder extends BaseProtocolDecoder {
public YwtProtocolDecoder(YwtProtocol protocol) {