aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/traccar/BaseProtocolEncoder.java12
-rw-r--r--src/main/java/org/traccar/StringProtocolEncoder.java6
-rw-r--r--src/main/java/org/traccar/protocol/AdmProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/AdmProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/AtrackProtocol.java6
-rw-r--r--src/main/java/org/traccar/protocol/AtrackProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/BceProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/BceProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/CarcellProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/CarcellProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/CastelProtocol.java6
-rw-r--r--src/main/java/org/traccar/protocol/CastelProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/CellocatorProtocol.java6
-rw-r--r--src/main/java/org/traccar/protocol/CellocatorProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/CityeasyProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/CityeasyProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/EelinkProtocol.java6
-rw-r--r--src/main/java/org/traccar/protocol/EelinkProtocolEncoder.java6
-rw-r--r--src/main/java/org/traccar/protocol/EnforaProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/EnforaProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/EsealProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/EsealProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/FifotrackProtocol.java2
-rw-r--r--src/main/java/org/traccar/protocol/FifotrackProtocolEncoder.java5
-rw-r--r--src/main/java/org/traccar/protocol/GalileoProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/GalileoProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/Gl200Protocol.java6
-rw-r--r--src/main/java/org/traccar/protocol/Gl200ProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/Gps103Protocol.java6
-rw-r--r--src/main/java/org/traccar/protocol/Gps103ProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/GranitProtocol.java6
-rw-r--r--src/main/java/org/traccar/protocol/GranitProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/GranitProtocolSmsEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/Gt06Protocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/H02Protocol.java6
-rw-r--r--src/main/java/org/traccar/protocol/H02ProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolEncoder.java5
-rw-r--r--src/main/java/org/traccar/protocol/ItsProtocolEncoder.java5
-rw-r--r--src/main/java/org/traccar/protocol/Jt600Protocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/Jt600ProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/KhdProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/KhdProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/LaipacProtocol.java2
-rw-r--r--src/main/java/org/traccar/protocol/LaipacProtocolEncoder.java5
-rw-r--r--src/main/java/org/traccar/protocol/MeiligaoProtocol.java6
-rw-r--r--src/main/java/org/traccar/protocol/MeiligaoProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/MeitrackProtocol.java6
-rw-r--r--src/main/java/org/traccar/protocol/MeitrackProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/MiniFinderProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/MiniFinderProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/NoranProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/NoranProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/PretraceProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/PretraceProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/Pt502Protocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/Pt502ProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/RuptelaProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/RuptelaProtocolEncoder.java5
-rw-r--r--src/main/java/org/traccar/protocol/SuntechProtocol.java2
-rw-r--r--src/main/java/org/traccar/protocol/SuntechProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/SviasProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/SviasProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/T800xProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/T800xProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/TeltonikaProtocol.java6
-rw-r--r--src/main/java/org/traccar/protocol/TeltonikaProtocolEncoder.java5
-rw-r--r--src/main/java/org/traccar/protocol/Tk103Protocol.java6
-rw-r--r--src/main/java/org/traccar/protocol/Tk103ProtocolEncoder.java9
-rw-r--r--src/main/java/org/traccar/protocol/TotemProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/TotemProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/WatchProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/WatchProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/WialonProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/WialonProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/WondexProtocol.java8
-rw-r--r--src/main/java/org/traccar/protocol/WondexProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/XexunProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/XexunProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/XirgoProtocol.java6
-rw-r--r--src/main/java/org/traccar/protocol/XirgoProtocolEncoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/Xrb28Protocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/Xrb28ProtocolEncoder.java7
-rw-r--r--src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/EelinkProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java14
-rw-r--r--src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java54
-rw-r--r--src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java8
115 files changed, 445 insertions, 224 deletions
diff --git a/src/main/java/org/traccar/BaseProtocolEncoder.java b/src/main/java/org/traccar/BaseProtocolEncoder.java
index 6d96280f7..69d1fe6f5 100644
--- a/src/main/java/org/traccar/BaseProtocolEncoder.java
+++ b/src/main/java/org/traccar/BaseProtocolEncoder.java
@@ -27,6 +27,18 @@ public abstract class BaseProtocolEncoder extends ChannelOutboundHandlerAdapter
private static final Logger LOGGER = LoggerFactory.getLogger(BaseProtocolEncoder.class);
+ private static final String PROTOCOL_UNKNOWN = "unknown";
+
+ private final Protocol protocol;
+
+ public BaseProtocolEncoder(Protocol protocol) {
+ this.protocol = protocol;
+ }
+
+ public String getProtocolName() {
+ return protocol != null ? protocol.getName() : PROTOCOL_UNKNOWN;
+ }
+
protected String getUniqueId(long deviceId) {
return Context.getIdentityManager().getById(deviceId).getUniqueId();
}
diff --git a/src/main/java/org/traccar/StringProtocolEncoder.java b/src/main/java/org/traccar/StringProtocolEncoder.java
index 1945ae174..d9acce7f0 100644
--- a/src/main/java/org/traccar/StringProtocolEncoder.java
+++ b/src/main/java/org/traccar/StringProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,10 @@ import java.util.Map;
public abstract class StringProtocolEncoder extends BaseProtocolEncoder {
+ public StringProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
public interface ValueFormatter {
String formatValue(String key, Object value);
}
diff --git a/src/main/java/org/traccar/protocol/AdmProtocol.java b/src/main/java/org/traccar/protocol/AdmProtocol.java
index 08f932ceb..93b1e355a 100644
--- a/src/main/java/org/traccar/protocol/AdmProtocol.java
+++ b/src/main/java/org/traccar/protocol/AdmProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ public class AdmProtocol extends BaseProtocol {
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 1024, 2, 1, -3, 0, true));
pipeline.addLast(new StringEncoder());
- pipeline.addLast(new AdmProtocolEncoder());
+ pipeline.addLast(new AdmProtocolEncoder(AdmProtocol.this));
pipeline.addLast(new AdmProtocolDecoder(AdmProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/AdmProtocolEncoder.java b/src/main/java/org/traccar/protocol/AdmProtocolEncoder.java
index e76bc2ddc..1c3dfc156 100644
--- a/src/main/java/org/traccar/protocol/AdmProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/AdmProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Anatoliy Golubev (darth.naihil@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,9 +18,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class AdmProtocolEncoder extends StringProtocolEncoder {
+ public AdmProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
diff --git a/src/main/java/org/traccar/protocol/AtrackProtocol.java b/src/main/java/org/traccar/protocol/AtrackProtocol.java
index 8e5cfe9ff..429708b26 100644
--- a/src/main/java/org/traccar/protocol/AtrackProtocol.java
+++ b/src/main/java/org/traccar/protocol/AtrackProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,14 +29,14 @@ public class AtrackProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new AtrackFrameDecoder());
- pipeline.addLast(new AtrackProtocolEncoder());
+ pipeline.addLast(new AtrackProtocolEncoder(AtrackProtocol.this));
pipeline.addLast(new AtrackProtocolDecoder(AtrackProtocol.this));
}
});
addServer(new TrackerServer(true, getName()) {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
- pipeline.addLast(new AtrackProtocolEncoder());
+ pipeline.addLast(new AtrackProtocolEncoder(AtrackProtocol.this));
pipeline.addLast(new AtrackProtocolDecoder(AtrackProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/AtrackProtocolEncoder.java b/src/main/java/org/traccar/protocol/AtrackProtocolEncoder.java
index 1e085cb26..d803ae391 100644
--- a/src/main/java/org/traccar/protocol/AtrackProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/AtrackProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,11 +18,16 @@ package org.traccar.protocol;
import io.netty.buffer.Unpooled;
import org.traccar.BaseProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import java.nio.charset.StandardCharsets;
public class AtrackProtocolEncoder extends BaseProtocolEncoder {
+ public AtrackProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
diff --git a/src/main/java/org/traccar/protocol/BceProtocol.java b/src/main/java/org/traccar/protocol/BceProtocol.java
index 6453a05a9..c5e1dd04c 100644
--- a/src/main/java/org/traccar/protocol/BceProtocol.java
+++ b/src/main/java/org/traccar/protocol/BceProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ public class BceProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new BceFrameDecoder());
- pipeline.addLast(new BceProtocolEncoder());
+ pipeline.addLast(new BceProtocolEncoder(BceProtocol.this));
pipeline.addLast(new BceProtocolDecoder(BceProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/BceProtocolEncoder.java b/src/main/java/org/traccar/protocol/BceProtocolEncoder.java
index 1bbf3db12..53ac51581 100644
--- a/src/main/java/org/traccar/protocol/BceProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/BceProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,9 +20,14 @@ import io.netty.buffer.Unpooled;
import org.traccar.BaseProtocolEncoder;
import org.traccar.helper.Checksum;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class BceProtocolEncoder extends BaseProtocolEncoder {
+ public BceProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
diff --git a/src/main/java/org/traccar/protocol/CarcellProtocol.java b/src/main/java/org/traccar/protocol/CarcellProtocol.java
index 0c305efcb..f08ab3bd9 100644
--- a/src/main/java/org/traccar/protocol/CarcellProtocol.java
+++ b/src/main/java/org/traccar/protocol/CarcellProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ public class CarcellProtocol extends BaseProtocol {
pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '\r'));
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
- pipeline.addLast(new CarcellProtocolEncoder());
+ pipeline.addLast(new CarcellProtocolEncoder(CarcellProtocol.this));
pipeline.addLast(new CarcellProtocolDecoder(CarcellProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/CarcellProtocolEncoder.java b/src/main/java/org/traccar/protocol/CarcellProtocolEncoder.java
index e8f0081a0..083fe9a9e 100644
--- a/src/main/java/org/traccar/protocol/CarcellProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/CarcellProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class CarcellProtocolEncoder extends StringProtocolEncoder {
+ public CarcellProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
diff --git a/src/main/java/org/traccar/protocol/CastelProtocol.java b/src/main/java/org/traccar/protocol/CastelProtocol.java
index 9b854afc3..44c52d68f 100644
--- a/src/main/java/org/traccar/protocol/CastelProtocol.java
+++ b/src/main/java/org/traccar/protocol/CastelProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,14 +32,14 @@ public class CastelProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 1024, 2, 2, -4, 0, true));
- pipeline.addLast(new CastelProtocolEncoder());
+ pipeline.addLast(new CastelProtocolEncoder(CastelProtocol.this));
pipeline.addLast(new CastelProtocolDecoder(CastelProtocol.this));
}
});
addServer(new TrackerServer(true, getName()) {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
- pipeline.addLast(new CastelProtocolEncoder());
+ pipeline.addLast(new CastelProtocolEncoder(CastelProtocol.this));
pipeline.addLast(new CastelProtocolDecoder(CastelProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/CastelProtocolEncoder.java b/src/main/java/org/traccar/protocol/CastelProtocolEncoder.java
index e1f78e7c1..dc694da28 100644
--- a/src/main/java/org/traccar/protocol/CastelProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/CastelProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,11 +21,16 @@ import org.traccar.BaseProtocolEncoder;
import org.traccar.Context;
import org.traccar.helper.Checksum;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import java.nio.charset.StandardCharsets;
public class CastelProtocolEncoder extends BaseProtocolEncoder {
+ public CastelProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private ByteBuf encodeContent(long deviceId, short type, ByteBuf content) {
ByteBuf buf = Unpooled.buffer(0);
diff --git a/src/main/java/org/traccar/protocol/CellocatorProtocol.java b/src/main/java/org/traccar/protocol/CellocatorProtocol.java
index a52170dc9..d910877cf 100644
--- a/src/main/java/org/traccar/protocol/CellocatorProtocol.java
+++ b/src/main/java/org/traccar/protocol/CellocatorProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,14 +29,14 @@ public class CellocatorProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new CellocatorFrameDecoder());
- pipeline.addLast(new CellocatorProtocolEncoder());
+ pipeline.addLast(new CellocatorProtocolEncoder(CellocatorProtocol.this));
pipeline.addLast(new CellocatorProtocolDecoder(CellocatorProtocol.this));
}
});
addServer(new TrackerServer(true, getName()) {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
- pipeline.addLast(new CellocatorProtocolEncoder());
+ pipeline.addLast(new CellocatorProtocolEncoder(CellocatorProtocol.this));
pipeline.addLast(new CellocatorProtocolDecoder(CellocatorProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/CellocatorProtocolEncoder.java b/src/main/java/org/traccar/protocol/CellocatorProtocolEncoder.java
index 0382dbbc7..52de4593c 100644
--- a/src/main/java/org/traccar/protocol/CellocatorProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/CellocatorProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,9 +19,14 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.traccar.BaseProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class CellocatorProtocolEncoder extends BaseProtocolEncoder {
+ public CellocatorProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private ByteBuf encodeContent(long deviceId, int command, int data1, int data2) {
ByteBuf buf = Unpooled.buffer(0);
diff --git a/src/main/java/org/traccar/protocol/CityeasyProtocol.java b/src/main/java/org/traccar/protocol/CityeasyProtocol.java
index f4b49c9ff..8ab4ce93a 100644
--- a/src/main/java/org/traccar/protocol/CityeasyProtocol.java
+++ b/src/main/java/org/traccar/protocol/CityeasyProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ public class CityeasyProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 2, 2, -4, 0));
- pipeline.addLast(new CityeasyProtocolEncoder());
+ pipeline.addLast(new CityeasyProtocolEncoder(CityeasyProtocol.this));
pipeline.addLast(new CityeasyProtocolDecoder(CityeasyProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/CityeasyProtocolEncoder.java b/src/main/java/org/traccar/protocol/CityeasyProtocolEncoder.java
index 350fdf0ab..934105862 100644
--- a/src/main/java/org/traccar/protocol/CityeasyProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/CityeasyProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,9 +22,14 @@ import io.netty.buffer.Unpooled;
import org.traccar.BaseProtocolEncoder;
import org.traccar.helper.Checksum;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class CityeasyProtocolEncoder extends BaseProtocolEncoder {
+ public CityeasyProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private ByteBuf encodeContent(int type, ByteBuf content) {
ByteBuf buf = Unpooled.buffer();
diff --git a/src/main/java/org/traccar/protocol/EelinkProtocol.java b/src/main/java/org/traccar/protocol/EelinkProtocol.java
index de4ea971b..8a055d643 100644
--- a/src/main/java/org/traccar/protocol/EelinkProtocol.java
+++ b/src/main/java/org/traccar/protocol/EelinkProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,14 +34,14 @@ public class EelinkProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 3, 2));
- pipeline.addLast(new EelinkProtocolEncoder(false));
+ pipeline.addLast(new EelinkProtocolEncoder(EelinkProtocol.this, false));
pipeline.addLast(new EelinkProtocolDecoder(EelinkProtocol.this));
}
});
addServer(new TrackerServer(true, getName()) {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
- pipeline.addLast(new EelinkProtocolEncoder(true));
+ pipeline.addLast(new EelinkProtocolEncoder(EelinkProtocol.this, true));
pipeline.addLast(new EelinkProtocolDecoder(EelinkProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/EelinkProtocolEncoder.java b/src/main/java/org/traccar/protocol/EelinkProtocolEncoder.java
index 8f33441fb..3673c35b3 100644
--- a/src/main/java/org/traccar/protocol/EelinkProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/EelinkProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import io.netty.buffer.Unpooled;
import org.traccar.BaseProtocolEncoder;
import org.traccar.helper.DataConverter;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
@@ -28,7 +29,8 @@ public class EelinkProtocolEncoder extends BaseProtocolEncoder {
private boolean connectionless;
- public EelinkProtocolEncoder(boolean connectionless) {
+ public EelinkProtocolEncoder(Protocol protocol, boolean connectionless) {
+ super(protocol);
this.connectionless = connectionless;
}
diff --git a/src/main/java/org/traccar/protocol/EnforaProtocol.java b/src/main/java/org/traccar/protocol/EnforaProtocol.java
index f78e4b377..e462ab322 100644
--- a/src/main/java/org/traccar/protocol/EnforaProtocol.java
+++ b/src/main/java/org/traccar/protocol/EnforaProtocol.java
@@ -32,14 +32,14 @@ public class EnforaProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 0, 2, -2, 2));
- pipeline.addLast(new EnforaProtocolEncoder());
+ pipeline.addLast(new EnforaProtocolEncoder(EnforaProtocol.this));
pipeline.addLast(new EnforaProtocolDecoder(EnforaProtocol.this));
}
});
addServer(new TrackerServer(true, getName()) {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
- pipeline.addLast(new EnforaProtocolEncoder());
+ pipeline.addLast(new EnforaProtocolEncoder(EnforaProtocol.this));
pipeline.addLast(new EnforaProtocolDecoder(EnforaProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/EnforaProtocolEncoder.java b/src/main/java/org/traccar/protocol/EnforaProtocolEncoder.java
index a46e6367d..8cc24dc0f 100644
--- a/src/main/java/org/traccar/protocol/EnforaProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/EnforaProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Jose Castellanos
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,11 +20,16 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import java.nio.charset.StandardCharsets;
public class EnforaProtocolEncoder extends StringProtocolEncoder {
+ public EnforaProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private ByteBuf encodeContent(String content) {
ByteBuf buf = Unpooled.buffer();
diff --git a/src/main/java/org/traccar/protocol/EsealProtocol.java b/src/main/java/org/traccar/protocol/EsealProtocol.java
index 7a27c617d..fc1d342e1 100644
--- a/src/main/java/org/traccar/protocol/EsealProtocol.java
+++ b/src/main/java/org/traccar/protocol/EsealProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ public class EsealProtocol extends BaseProtocol {
pipeline.addLast(new LineBasedFrameDecoder(1024));
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
- pipeline.addLast(new EsealProtocolEncoder());
+ pipeline.addLast(new EsealProtocolEncoder(EsealProtocol.this));
pipeline.addLast(new EsealProtocolDecoder(EsealProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/EsealProtocolEncoder.java b/src/main/java/org/traccar/protocol/EsealProtocolEncoder.java
index b9bcc5b0a..6ee305ed8 100644
--- a/src/main/java/org/traccar/protocol/EsealProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/EsealProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class EsealProtocolEncoder extends StringProtocolEncoder {
+ public EsealProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
diff --git a/src/main/java/org/traccar/protocol/FifotrackProtocol.java b/src/main/java/org/traccar/protocol/FifotrackProtocol.java
index d1c3cf695..4a0a12ed3 100644
--- a/src/main/java/org/traccar/protocol/FifotrackProtocol.java
+++ b/src/main/java/org/traccar/protocol/FifotrackProtocol.java
@@ -32,7 +32,7 @@ public class FifotrackProtocol extends BaseProtocol {
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new FifotrackFrameDecoder());
pipeline.addLast(new StringEncoder());
- pipeline.addLast(new FifotrackProtocolEncoder());
+ pipeline.addLast(new FifotrackProtocolEncoder(FifotrackProtocol.this));
pipeline.addLast(new FifotrackProtocolDecoder(FifotrackProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/FifotrackProtocolEncoder.java b/src/main/java/org/traccar/protocol/FifotrackProtocolEncoder.java
index ff0a2e56e..a4e69b47b 100644
--- a/src/main/java/org/traccar/protocol/FifotrackProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/FifotrackProtocolEncoder.java
@@ -18,9 +18,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.helper.Checksum;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class FifotrackProtocolEncoder extends StringProtocolEncoder {
+ public FifotrackProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private Object formatCommand(Command command, String content) {
String uniqueId = getUniqueId(command.getDeviceId());
int length = 1 + uniqueId.length() + 3 + content.length();
diff --git a/src/main/java/org/traccar/protocol/GalileoProtocol.java b/src/main/java/org/traccar/protocol/GalileoProtocol.java
index 9b7fe1a4b..a1570c9b0 100644
--- a/src/main/java/org/traccar/protocol/GalileoProtocol.java
+++ b/src/main/java/org/traccar/protocol/GalileoProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@ public class GalileoProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new GalileoFrameDecoder());
- pipeline.addLast(new GalileoProtocolEncoder());
+ pipeline.addLast(new GalileoProtocolEncoder(GalileoProtocol.this));
pipeline.addLast(new GalileoProtocolDecoder(GalileoProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/GalileoProtocolEncoder.java b/src/main/java/org/traccar/protocol/GalileoProtocolEncoder.java
index 3b2145e74..cd068b251 100644
--- a/src/main/java/org/traccar/protocol/GalileoProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/GalileoProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,11 +20,16 @@ import io.netty.buffer.Unpooled;
import org.traccar.BaseProtocolEncoder;
import org.traccar.helper.Checksum;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import java.nio.charset.StandardCharsets;
public class GalileoProtocolEncoder extends BaseProtocolEncoder {
+ public GalileoProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private ByteBuf encodeText(String uniqueId, String text) {
ByteBuf buf = Unpooled.buffer(256);
diff --git a/src/main/java/org/traccar/protocol/Gl200Protocol.java b/src/main/java/org/traccar/protocol/Gl200Protocol.java
index c5343dae0..e2d0c6d2a 100644
--- a/src/main/java/org/traccar/protocol/Gl200Protocol.java
+++ b/src/main/java/org/traccar/protocol/Gl200Protocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ public class Gl200Protocol extends BaseProtocol {
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new Gl200FrameDecoder());
pipeline.addLast(new StringEncoder());
- pipeline.addLast(new Gl200ProtocolEncoder());
+ pipeline.addLast(new Gl200ProtocolEncoder(Gl200Protocol.this));
pipeline.addLast(new Gl200ProtocolDecoder(Gl200Protocol.this));
}
});
@@ -44,7 +44,7 @@ public class Gl200Protocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new StringEncoder());
- pipeline.addLast(new Gl200ProtocolEncoder());
+ pipeline.addLast(new Gl200ProtocolEncoder(Gl200Protocol.this));
pipeline.addLast(new Gl200ProtocolDecoder(Gl200Protocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/Gl200ProtocolEncoder.java b/src/main/java/org/traccar/protocol/Gl200ProtocolEncoder.java
index 285106c67..32307446b 100644
--- a/src/main/java/org/traccar/protocol/Gl200ProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/Gl200ProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class Gl200ProtocolEncoder extends StringProtocolEncoder {
+ public Gl200ProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
diff --git a/src/main/java/org/traccar/protocol/Gps103Protocol.java b/src/main/java/org/traccar/protocol/Gps103Protocol.java
index 6272a3fd1..5356387ce 100644
--- a/src/main/java/org/traccar/protocol/Gps103Protocol.java
+++ b/src/main/java/org/traccar/protocol/Gps103Protocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ public class Gps103Protocol extends BaseProtocol {
pipeline.addLast(new CharacterDelimiterFrameDecoder(2048, false, "\r\n", "\n", ";", "*"));
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
- pipeline.addLast(new Gps103ProtocolEncoder());
+ pipeline.addLast(new Gps103ProtocolEncoder(Gps103Protocol.this));
pipeline.addLast(new Gps103ProtocolDecoder(Gps103Protocol.this));
}
});
@@ -51,7 +51,7 @@ public class Gps103Protocol extends BaseProtocol {
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
- pipeline.addLast(new Gps103ProtocolEncoder());
+ pipeline.addLast(new Gps103ProtocolEncoder(Gps103Protocol.this));
pipeline.addLast(new Gps103ProtocolDecoder(Gps103Protocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/Gps103ProtocolEncoder.java b/src/main/java/org/traccar/protocol/Gps103ProtocolEncoder.java
index 47ef2f333..7128823ed 100644
--- a/src/main/java/org/traccar/protocol/Gps103ProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/Gps103ProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class Gps103ProtocolEncoder extends StringProtocolEncoder implements StringProtocolEncoder.ValueFormatter {
+ public Gps103ProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
public String formatValue(String key, Object value) {
diff --git a/src/main/java/org/traccar/protocol/GranitProtocol.java b/src/main/java/org/traccar/protocol/GranitProtocol.java
index 6785f2a2e..cc5b125f1 100644
--- a/src/main/java/org/traccar/protocol/GranitProtocol.java
+++ b/src/main/java/org/traccar/protocol/GranitProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
* Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -28,7 +28,7 @@ public class GranitProtocol extends BaseProtocol {
Command.TYPE_IDENTIFICATION,
Command.TYPE_REBOOT_DEVICE,
Command.TYPE_POSITION_SINGLE);
- setTextCommandEncoder(new GranitProtocolSmsEncoder());
+ setTextCommandEncoder(new GranitProtocolSmsEncoder(GranitProtocol.this));
setSupportedTextCommands(
Command.TYPE_REBOOT_DEVICE,
Command.TYPE_POSITION_PERIODIC);
@@ -36,7 +36,7 @@ public class GranitProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new GranitFrameDecoder());
- pipeline.addLast(new GranitProtocolEncoder());
+ pipeline.addLast(new GranitProtocolEncoder(GranitProtocol.this));
pipeline.addLast(new GranitProtocolDecoder(GranitProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/GranitProtocolEncoder.java b/src/main/java/org/traccar/protocol/GranitProtocolEncoder.java
index 6345ff971..66c2a4973 100644
--- a/src/main/java/org/traccar/protocol/GranitProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/GranitProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,9 +21,14 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.traccar.BaseProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class GranitProtocolEncoder extends BaseProtocolEncoder {
+ public GranitProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private ByteBuf encodeCommand(String commandString) {
ByteBuf buffer = Unpooled.buffer();
buffer.writeBytes(commandString.getBytes(StandardCharsets.US_ASCII));
diff --git a/src/main/java/org/traccar/protocol/GranitProtocolSmsEncoder.java b/src/main/java/org/traccar/protocol/GranitProtocolSmsEncoder.java
index 7d5518c17..7dd4b2d77 100644
--- a/src/main/java/org/traccar/protocol/GranitProtocolSmsEncoder.java
+++ b/src/main/java/org/traccar/protocol/GranitProtocolSmsEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,9 +18,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class GranitProtocolSmsEncoder extends StringProtocolEncoder {
+ public GranitProtocolSmsEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected String encodeCommand(Command command) {
switch (command.getType()) {
diff --git a/src/main/java/org/traccar/protocol/Gt06Protocol.java b/src/main/java/org/traccar/protocol/Gt06Protocol.java
index 6e5435cd4..9ec8de098 100644
--- a/src/main/java/org/traccar/protocol/Gt06Protocol.java
+++ b/src/main/java/org/traccar/protocol/Gt06Protocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ public class Gt06Protocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new Gt06FrameDecoder());
- pipeline.addLast(new Gt06ProtocolEncoder());
+ pipeline.addLast(new Gt06ProtocolEncoder(Gt06Protocol.this));
pipeline.addLast(new Gt06ProtocolDecoder(Gt06Protocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java
index 05560229f..2fb18d2a2 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,11 +21,16 @@ import org.traccar.BaseProtocolEncoder;
import org.traccar.Context;
import org.traccar.helper.Checksum;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import java.nio.charset.StandardCharsets;
public class Gt06ProtocolEncoder extends BaseProtocolEncoder {
+ public Gt06ProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private ByteBuf encodeContent(long deviceId, String content) {
boolean language = Context.getIdentityManager().lookupAttributeBoolean(deviceId, "gt06.language", false, true);
diff --git a/src/main/java/org/traccar/protocol/H02Protocol.java b/src/main/java/org/traccar/protocol/H02Protocol.java
index 251beac5e..b897d83ad 100644
--- a/src/main/java/org/traccar/protocol/H02Protocol.java
+++ b/src/main/java/org/traccar/protocol/H02Protocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ public class H02Protocol extends BaseProtocol {
int messageLength = Context.getConfig().getInteger(getName() + ".messageLength");
pipeline.addLast(new H02FrameDecoder(messageLength));
pipeline.addLast(new StringEncoder());
- pipeline.addLast(new H02ProtocolEncoder());
+ pipeline.addLast(new H02ProtocolEncoder(H02Protocol.this));
pipeline.addLast(new H02ProtocolDecoder(H02Protocol.this));
}
});
@@ -46,7 +46,7 @@ public class H02Protocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new StringEncoder());
- pipeline.addLast(new H02ProtocolEncoder());
+ pipeline.addLast(new H02ProtocolEncoder(H02Protocol.this));
pipeline.addLast(new H02ProtocolDecoder(H02Protocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/H02ProtocolEncoder.java b/src/main/java/org/traccar/protocol/H02ProtocolEncoder.java
index 614a07dd1..3dbdf879e 100644
--- a/src/main/java/org/traccar/protocol/H02ProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/H02ProtocolEncoder.java
@@ -1,6 +1,6 @@
/*
* Copyright 2016 Gabor Somogyi (gabor.g.somogyi@gmail.com)
- * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.traccar.protocol;
import org.traccar.Context;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import java.util.Date;
@@ -26,6 +27,10 @@ public class H02ProtocolEncoder extends StringProtocolEncoder {
private static final String MARKER = "HQ";
+ public H02ProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private Object formatCommand(Date time, String uniqueId, String type, String... params) {
StringBuilder result = new StringBuilder(
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocol.java b/src/main/java/org/traccar/protocol/HuabaoProtocol.java
index 44c9f7ac7..791672b85 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocol.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@ public class HuabaoProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new HuabaoFrameDecoder());
- pipeline.addLast(new HuabaoProtocolEncoder());
+ pipeline.addLast(new HuabaoProtocolEncoder(HuabaoProtocol.this));
pipeline.addLast(new HuabaoProtocolDecoder(HuabaoProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolEncoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolEncoder.java
index 7759790c4..2038c8d48 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocolEncoder.java
@@ -21,12 +21,17 @@ import org.traccar.BaseProtocolEncoder;
import org.traccar.Context;
import org.traccar.helper.DataConverter;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import java.text.SimpleDateFormat;
import java.util.Date;
public class HuabaoProtocolEncoder extends BaseProtocolEncoder {
+ public HuabaoProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
diff --git a/src/main/java/org/traccar/protocol/ItsProtocolEncoder.java b/src/main/java/org/traccar/protocol/ItsProtocolEncoder.java
index ebbbd87cd..f82b8e3ac 100644
--- a/src/main/java/org/traccar/protocol/ItsProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/ItsProtocolEncoder.java
@@ -17,9 +17,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class ItsProtocolEncoder extends StringProtocolEncoder {
+ public ItsProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
diff --git a/src/main/java/org/traccar/protocol/Jt600Protocol.java b/src/main/java/org/traccar/protocol/Jt600Protocol.java
index 97c5fa6ce..37c82f741 100644
--- a/src/main/java/org/traccar/protocol/Jt600Protocol.java
+++ b/src/main/java/org/traccar/protocol/Jt600Protocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ public class Jt600Protocol extends BaseProtocol {
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new Jt600FrameDecoder());
pipeline.addLast(new StringEncoder());
- pipeline.addLast(new Jt600ProtocolEncoder());
+ pipeline.addLast(new Jt600ProtocolEncoder(Jt600Protocol.this));
pipeline.addLast(new Jt600ProtocolDecoder(Jt600Protocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/Jt600ProtocolEncoder.java b/src/main/java/org/traccar/protocol/Jt600ProtocolEncoder.java
index fe5c63c32..199467a38 100644
--- a/src/main/java/org/traccar/protocol/Jt600ProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/Jt600ProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,9 +19,14 @@ import java.util.TimeZone;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class Jt600ProtocolEncoder extends StringProtocolEncoder {
+ public Jt600ProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
diff --git a/src/main/java/org/traccar/protocol/KhdProtocol.java b/src/main/java/org/traccar/protocol/KhdProtocol.java
index cec7158ed..f77f4c311 100644
--- a/src/main/java/org/traccar/protocol/KhdProtocol.java
+++ b/src/main/java/org/traccar/protocol/KhdProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ public class KhdProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new LengthFieldBasedFrameDecoder(512, 3, 2));
- pipeline.addLast(new KhdProtocolEncoder());
+ pipeline.addLast(new KhdProtocolEncoder(KhdProtocol.this));
pipeline.addLast(new KhdProtocolDecoder(KhdProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/KhdProtocolEncoder.java b/src/main/java/org/traccar/protocol/KhdProtocolEncoder.java
index c66129283..4a8df26c8 100644
--- a/src/main/java/org/traccar/protocol/KhdProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/KhdProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +20,17 @@ import io.netty.buffer.Unpooled;
import org.traccar.BaseProtocolEncoder;
import org.traccar.helper.Checksum;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class KhdProtocolEncoder extends BaseProtocolEncoder {
public static final int MSG_CUT_OIL = 0x39;
public static final int MSG_RESUME_OIL = 0x38;
+ public KhdProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private ByteBuf encodeCommand(int command, String uniqueId) {
ByteBuf buf = Unpooled.buffer();
diff --git a/src/main/java/org/traccar/protocol/LaipacProtocol.java b/src/main/java/org/traccar/protocol/LaipacProtocol.java
index b325755c8..1d561dbd2 100644
--- a/src/main/java/org/traccar/protocol/LaipacProtocol.java
+++ b/src/main/java/org/traccar/protocol/LaipacProtocol.java
@@ -38,7 +38,7 @@ public class LaipacProtocol extends BaseProtocol {
pipeline.addLast(new LineBasedFrameDecoder(1024));
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
- pipeline.addLast(new LaipacProtocolEncoder());
+ pipeline.addLast(new LaipacProtocolEncoder(LaipacProtocol.this));
pipeline.addLast(new LaipacProtocolDecoder(LaipacProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/LaipacProtocolEncoder.java b/src/main/java/org/traccar/protocol/LaipacProtocolEncoder.java
index dec76b83c..343ac9431 100644
--- a/src/main/java/org/traccar/protocol/LaipacProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/LaipacProtocolEncoder.java
@@ -18,9 +18,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
import org.traccar.helper.Checksum;
+import org.traccar.Protocol;
public class LaipacProtocolEncoder extends StringProtocolEncoder {
+ public LaipacProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected String formatCommand(Command command, String format, String... keys) {
String sentence = super.formatCommand(command, "$" + format, keys);
diff --git a/src/main/java/org/traccar/protocol/MeiligaoProtocol.java b/src/main/java/org/traccar/protocol/MeiligaoProtocol.java
index c307c7318..e8a66e49f 100644
--- a/src/main/java/org/traccar/protocol/MeiligaoProtocol.java
+++ b/src/main/java/org/traccar/protocol/MeiligaoProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,14 +36,14 @@ public class MeiligaoProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new MeiligaoFrameDecoder());
- pipeline.addLast(new MeiligaoProtocolEncoder());
+ pipeline.addLast(new MeiligaoProtocolEncoder(MeiligaoProtocol.this));
pipeline.addLast(new MeiligaoProtocolDecoder(MeiligaoProtocol.this));
}
});
addServer(new TrackerServer(true, getName()) {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
- pipeline.addLast(new MeiligaoProtocolEncoder());
+ pipeline.addLast(new MeiligaoProtocolEncoder(MeiligaoProtocol.this));
pipeline.addLast(new MeiligaoProtocolDecoder(MeiligaoProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/MeiligaoProtocolEncoder.java b/src/main/java/org/traccar/protocol/MeiligaoProtocolEncoder.java
index 57cbbe0fc..36e94195c 100644
--- a/src/main/java/org/traccar/protocol/MeiligaoProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/MeiligaoProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,12 +21,17 @@ import org.traccar.BaseProtocolEncoder;
import org.traccar.helper.Checksum;
import org.traccar.helper.DataConverter;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import java.nio.charset.StandardCharsets;
import java.util.TimeZone;
public class MeiligaoProtocolEncoder extends BaseProtocolEncoder {
+ public MeiligaoProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private ByteBuf encodeContent(long deviceId, int type, ByteBuf content) {
ByteBuf buf = Unpooled.buffer();
diff --git a/src/main/java/org/traccar/protocol/MeitrackProtocol.java b/src/main/java/org/traccar/protocol/MeitrackProtocol.java
index c887cd3a0..7439ea611 100644
--- a/src/main/java/org/traccar/protocol/MeitrackProtocol.java
+++ b/src/main/java/org/traccar/protocol/MeitrackProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ public class MeitrackProtocol extends BaseProtocol {
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new MeitrackFrameDecoder());
pipeline.addLast(new StringEncoder());
- pipeline.addLast(new MeitrackProtocolEncoder());
+ pipeline.addLast(new MeitrackProtocolEncoder(MeitrackProtocol.this));
pipeline.addLast(new MeitrackProtocolDecoder(MeitrackProtocol.this));
}
});
@@ -45,7 +45,7 @@ public class MeitrackProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new StringEncoder());
- pipeline.addLast(new MeitrackProtocolEncoder());
+ pipeline.addLast(new MeitrackProtocolEncoder(MeitrackProtocol.this));
pipeline.addLast(new MeitrackProtocolDecoder(MeitrackProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/MeitrackProtocolEncoder.java b/src/main/java/org/traccar/protocol/MeitrackProtocolEncoder.java
index abb6ec9d4..a0dc95c5d 100644
--- a/src/main/java/org/traccar/protocol/MeitrackProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/MeitrackProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,11 +19,16 @@ import org.traccar.Context;
import org.traccar.StringProtocolEncoder;
import org.traccar.helper.Checksum;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import java.util.Map;
public class MeitrackProtocolEncoder extends StringProtocolEncoder {
+ public MeitrackProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private Object formatCommand(Command command, char dataId, String content) {
String uniqueId = getUniqueId(command.getDeviceId());
int length = 1 + uniqueId.length() + 1 + content.length() + 5;
diff --git a/src/main/java/org/traccar/protocol/MiniFinderProtocol.java b/src/main/java/org/traccar/protocol/MiniFinderProtocol.java
index d4a154053..82534ecd8 100644
--- a/src/main/java/org/traccar/protocol/MiniFinderProtocol.java
+++ b/src/main/java/org/traccar/protocol/MiniFinderProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +44,7 @@ public class MiniFinderProtocol extends BaseProtocol {
pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, ';'));
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
- pipeline.addLast(new MiniFinderProtocolEncoder());
+ pipeline.addLast(new MiniFinderProtocolEncoder(MiniFinderProtocol.this));
pipeline.addLast(new MiniFinderProtocolDecoder(MiniFinderProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/MiniFinderProtocolEncoder.java b/src/main/java/org/traccar/protocol/MiniFinderProtocolEncoder.java
index 7a3d5b226..36fb9fc2f 100644
--- a/src/main/java/org/traccar/protocol/MiniFinderProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/MiniFinderProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,9 +19,14 @@ import java.util.TimeZone;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class MiniFinderProtocolEncoder extends StringProtocolEncoder implements StringProtocolEncoder.ValueFormatter {
+ public MiniFinderProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
public String formatValue(String key, Object value) {
switch (key) {
diff --git a/src/main/java/org/traccar/protocol/NoranProtocol.java b/src/main/java/org/traccar/protocol/NoranProtocol.java
index 9f3078d6d..3df364c30 100644
--- a/src/main/java/org/traccar/protocol/NoranProtocol.java
+++ b/src/main/java/org/traccar/protocol/NoranProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ public class NoranProtocol extends BaseProtocol {
addServer(new TrackerServer(true, getName()) {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
- pipeline.addLast(new NoranProtocolEncoder());
+ pipeline.addLast(new NoranProtocolEncoder(NoranProtocol.this));
pipeline.addLast(new NoranProtocolDecoder(NoranProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/NoranProtocolEncoder.java b/src/main/java/org/traccar/protocol/NoranProtocolEncoder.java
index 92826c8b2..e02a1313c 100644
--- a/src/main/java/org/traccar/protocol/NoranProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/NoranProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,11 +19,16 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.traccar.BaseProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import java.nio.charset.StandardCharsets;
public class NoranProtocolEncoder extends BaseProtocolEncoder {
+ public NoranProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private ByteBuf encodeContent(String content) {
ByteBuf buf = Unpooled.buffer(12 + 56);
diff --git a/src/main/java/org/traccar/protocol/PretraceProtocol.java b/src/main/java/org/traccar/protocol/PretraceProtocol.java
index f753cbdb4..9d35c1c2f 100644
--- a/src/main/java/org/traccar/protocol/PretraceProtocol.java
+++ b/src/main/java/org/traccar/protocol/PretraceProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ public class PretraceProtocol extends BaseProtocol {
pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, ')'));
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
- pipeline.addLast(new PretraceProtocolEncoder());
+ pipeline.addLast(new PretraceProtocolEncoder(PretraceProtocol.this));
pipeline.addLast(new PretraceProtocolDecoder(PretraceProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/PretraceProtocolEncoder.java b/src/main/java/org/traccar/protocol/PretraceProtocolEncoder.java
index 9cf951e3b..1083a252e 100644
--- a/src/main/java/org/traccar/protocol/PretraceProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/PretraceProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,9 +19,14 @@ import org.traccar.BaseProtocolEncoder;
import org.traccar.Context;
import org.traccar.helper.Checksum;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class PretraceProtocolEncoder extends BaseProtocolEncoder {
+ public PretraceProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private String formatCommand(String uniqueId, String data) {
String content = uniqueId + data;
return String.format("(%s^%02X)", content, Checksum.xor(content));
diff --git a/src/main/java/org/traccar/protocol/Pt502Protocol.java b/src/main/java/org/traccar/protocol/Pt502Protocol.java
index 5afb9451d..56444fb42 100644
--- a/src/main/java/org/traccar/protocol/Pt502Protocol.java
+++ b/src/main/java/org/traccar/protocol/Pt502Protocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ public class Pt502Protocol extends BaseProtocol {
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new Pt502FrameDecoder());
pipeline.addLast(new StringEncoder());
- pipeline.addLast(new Pt502ProtocolEncoder());
+ pipeline.addLast(new Pt502ProtocolEncoder(Pt502Protocol.this));
pipeline.addLast(new Pt502ProtocolDecoder(Pt502Protocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/Pt502ProtocolEncoder.java b/src/main/java/org/traccar/protocol/Pt502ProtocolEncoder.java
index ed18208cc..ba08b16ae 100644
--- a/src/main/java/org/traccar/protocol/Pt502ProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/Pt502ProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,9 +19,14 @@ import java.util.TimeZone;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class Pt502ProtocolEncoder extends StringProtocolEncoder implements StringProtocolEncoder.ValueFormatter {
+ public Pt502ProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
public String formatValue(String key, Object value) {
if (key.equals(Command.KEY_TIMEZONE)) {
diff --git a/src/main/java/org/traccar/protocol/RuptelaProtocol.java b/src/main/java/org/traccar/protocol/RuptelaProtocol.java
index a574293cd..b8f72336b 100644
--- a/src/main/java/org/traccar/protocol/RuptelaProtocol.java
+++ b/src/main/java/org/traccar/protocol/RuptelaProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ public class RuptelaProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 0, 2, 2, 0));
- pipeline.addLast(new RuptelaProtocolEncoder());
+ pipeline.addLast(new RuptelaProtocolEncoder(RuptelaProtocol.this));
pipeline.addLast(new RuptelaProtocolDecoder(RuptelaProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/RuptelaProtocolEncoder.java b/src/main/java/org/traccar/protocol/RuptelaProtocolEncoder.java
index 96d0da5a7..51967403d 100644
--- a/src/main/java/org/traccar/protocol/RuptelaProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/RuptelaProtocolEncoder.java
@@ -20,11 +20,16 @@ import io.netty.buffer.Unpooled;
import org.traccar.BaseProtocolEncoder;
import org.traccar.helper.Checksum;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import java.nio.charset.StandardCharsets;
public class RuptelaProtocolEncoder extends BaseProtocolEncoder {
+ public RuptelaProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private ByteBuf encodeContent(int type, ByteBuf content) {
ByteBuf buf = Unpooled.buffer();
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocol.java b/src/main/java/org/traccar/protocol/SuntechProtocol.java
index 48d6e81c1..7e2c20e6f 100644
--- a/src/main/java/org/traccar/protocol/SuntechProtocol.java
+++ b/src/main/java/org/traccar/protocol/SuntechProtocol.java
@@ -39,7 +39,7 @@ public class SuntechProtocol extends BaseProtocol {
pipeline.addLast(new SuntechFrameDecoder());
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
- pipeline.addLast(new SuntechProtocolEncoder());
+ pipeline.addLast(new SuntechProtocolEncoder(SuntechProtocol.this));
pipeline.addLast(new SuntechProtocolDecoder(SuntechProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolEncoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolEncoder.java
index 90fa4aa39..6dae42ad5 100644
--- a/src/main/java/org/traccar/protocol/SuntechProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/SuntechProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class SuntechProtocolEncoder extends StringProtocolEncoder {
+ public SuntechProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
diff --git a/src/main/java/org/traccar/protocol/SviasProtocol.java b/src/main/java/org/traccar/protocol/SviasProtocol.java
index f01f28389..accfa173f 100644
--- a/src/main/java/org/traccar/protocol/SviasProtocol.java
+++ b/src/main/java/org/traccar/protocol/SviasProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ public class SviasProtocol extends BaseProtocol {
pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "]"));
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
- pipeline.addLast(new SviasProtocolEncoder());
+ pipeline.addLast(new SviasProtocolEncoder(SviasProtocol.this));
pipeline.addLast(new SviasProtocolDecoder(SviasProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/SviasProtocolEncoder.java b/src/main/java/org/traccar/protocol/SviasProtocolEncoder.java
index 8bfbef119..2607d7bd1 100644
--- a/src/main/java/org/traccar/protocol/SviasProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/SviasProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 - 2019 Anton Tananaev (anton@traccar.org)
* Copyright 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,9 +18,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class SviasProtocolEncoder extends StringProtocolEncoder {
+ public SviasProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
switch (command.getType()) {
diff --git a/src/main/java/org/traccar/protocol/T800xProtocol.java b/src/main/java/org/traccar/protocol/T800xProtocol.java
index 85749d0cf..8b91265cb 100644
--- a/src/main/java/org/traccar/protocol/T800xProtocol.java
+++ b/src/main/java/org/traccar/protocol/T800xProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@ public class T800xProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 3, 2, -5, 0));
- pipeline.addLast(new T800xProtocolEncoder());
+ pipeline.addLast(new T800xProtocolEncoder(T800xProtocol.this));
pipeline.addLast(new T800xProtocolDecoder(T800xProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/T800xProtocolEncoder.java b/src/main/java/org/traccar/protocol/T800xProtocolEncoder.java
index 34f30b147..439bedb57 100644
--- a/src/main/java/org/traccar/protocol/T800xProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/T800xProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import io.netty.buffer.Unpooled;
import org.traccar.BaseProtocolEncoder;
import org.traccar.helper.DataConverter;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import java.nio.charset.StandardCharsets;
@@ -29,6 +30,10 @@ public class T800xProtocolEncoder extends BaseProtocolEncoder {
public static final int MODE_BROADCAST = 0x02;
public static final int MODE_FORWARD = 0x03;
+ public T800xProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private ByteBuf encodeContent(Command command, String content) {
ByteBuf buf = Unpooled.buffer();
diff --git a/src/main/java/org/traccar/protocol/TeltonikaProtocol.java b/src/main/java/org/traccar/protocol/TeltonikaProtocol.java
index eef9662d7..5817b86be 100644
--- a/src/main/java/org/traccar/protocol/TeltonikaProtocol.java
+++ b/src/main/java/org/traccar/protocol/TeltonikaProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,14 +29,14 @@ public class TeltonikaProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new TeltonikaFrameDecoder());
- pipeline.addLast(new TeltonikaProtocolEncoder());
+ pipeline.addLast(new TeltonikaProtocolEncoder(TeltonikaProtocol.this));
pipeline.addLast(new TeltonikaProtocolDecoder(TeltonikaProtocol.this, false));
}
});
addServer(new TrackerServer(true, getName()) {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
- pipeline.addLast(new TeltonikaProtocolEncoder());
+ pipeline.addLast(new TeltonikaProtocolEncoder(TeltonikaProtocol.this));
pipeline.addLast(new TeltonikaProtocolDecoder(TeltonikaProtocol.this, true));
}
});
diff --git a/src/main/java/org/traccar/protocol/TeltonikaProtocolEncoder.java b/src/main/java/org/traccar/protocol/TeltonikaProtocolEncoder.java
index 5380cf3a0..8a614618a 100644
--- a/src/main/java/org/traccar/protocol/TeltonikaProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/TeltonikaProtocolEncoder.java
@@ -19,6 +19,7 @@ import org.traccar.BaseProtocolEncoder;
import org.traccar.helper.Checksum;
import org.traccar.helper.DataConverter;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
@@ -27,6 +28,10 @@ import java.nio.charset.StandardCharsets;
public class TeltonikaProtocolEncoder extends BaseProtocolEncoder {
+ public TeltonikaProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private ByteBuf encodeContent(byte[] content) {
ByteBuf buf = Unpooled.buffer();
diff --git a/src/main/java/org/traccar/protocol/Tk103Protocol.java b/src/main/java/org/traccar/protocol/Tk103Protocol.java
index fa83133e2..ff0bedfb7 100644
--- a/src/main/java/org/traccar/protocol/Tk103Protocol.java
+++ b/src/main/java/org/traccar/protocol/Tk103Protocol.java
@@ -1,6 +1,6 @@
/*
* Copyright 2017 Christoph Krey (c@ckrey.de)
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ public class Tk103Protocol extends BaseProtocol {
pipeline.addLast(new Tk103FrameDecoder());
pipeline.addLast(new StringDecoder());
pipeline.addLast(new StringEncoder());
- pipeline.addLast(new Tk103ProtocolEncoder());
+ pipeline.addLast(new Tk103ProtocolEncoder(Tk103Protocol.this));
pipeline.addLast(new Tk103ProtocolDecoder(Tk103Protocol.this));
}
});
@@ -60,7 +60,7 @@ public class Tk103Protocol extends BaseProtocol {
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new StringDecoder());
pipeline.addLast(new StringEncoder());
- pipeline.addLast(new Tk103ProtocolEncoder());
+ pipeline.addLast(new Tk103ProtocolEncoder(Tk103Protocol.this));
pipeline.addLast(new Tk103ProtocolDecoder(Tk103Protocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/Tk103ProtocolEncoder.java b/src/main/java/org/traccar/protocol/Tk103ProtocolEncoder.java
index 98edc8cb5..cc79968b7 100644
--- a/src/main/java/org/traccar/protocol/Tk103ProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/Tk103ProtocolEncoder.java
@@ -1,6 +1,6 @@
/*
* Copyright 2017 Christoph Krey (c@ckrey.de)
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,16 +19,19 @@ package org.traccar.protocol;
import org.traccar.Context;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class Tk103ProtocolEncoder extends StringProtocolEncoder {
private final boolean forceAlternative;
- public Tk103ProtocolEncoder() {
+ public Tk103ProtocolEncoder(Protocol protocol) {
+ super(protocol);
this.forceAlternative = false;
}
- public Tk103ProtocolEncoder(boolean forceAlternative) {
+ public Tk103ProtocolEncoder(Protocol protocol, boolean forceAlternative) {
+ super(protocol);
this.forceAlternative = forceAlternative;
}
diff --git a/src/main/java/org/traccar/protocol/TotemProtocol.java b/src/main/java/org/traccar/protocol/TotemProtocol.java
index 66e1ec4f1..f8cda8358 100644
--- a/src/main/java/org/traccar/protocol/TotemProtocol.java
+++ b/src/main/java/org/traccar/protocol/TotemProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ public class TotemProtocol extends BaseProtocol {
pipeline.addLast(new TotemFrameDecoder());
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
- pipeline.addLast(new TotemProtocolEncoder());
+ pipeline.addLast(new TotemProtocolEncoder(TotemProtocol.this));
pipeline.addLast(new TotemProtocolDecoder(TotemProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/TotemProtocolEncoder.java b/src/main/java/org/traccar/protocol/TotemProtocolEncoder.java
index b5049859d..3bbb92031 100644
--- a/src/main/java/org/traccar/protocol/TotemProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/TotemProtocolEncoder.java
@@ -1,6 +1,6 @@
/*
* Copyright 2015 Irving Gonzalez
- * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +18,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class TotemProtocolEncoder extends StringProtocolEncoder {
+ public TotemProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
diff --git a/src/main/java/org/traccar/protocol/WatchProtocol.java b/src/main/java/org/traccar/protocol/WatchProtocol.java
index fe285e70d..6dc3bf9fb 100644
--- a/src/main/java/org/traccar/protocol/WatchProtocol.java
+++ b/src/main/java/org/traccar/protocol/WatchProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +44,7 @@ public class WatchProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new WatchFrameDecoder());
- pipeline.addLast(new WatchProtocolEncoder());
+ pipeline.addLast(new WatchProtocolEncoder(WatchProtocol.this));
pipeline.addLast(new WatchProtocolDecoder(WatchProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/WatchProtocolEncoder.java b/src/main/java/org/traccar/protocol/WatchProtocolEncoder.java
index 264aec81f..b433dfd2a 100644
--- a/src/main/java/org/traccar/protocol/WatchProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/WatchProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import io.netty.channel.Channel;
import org.traccar.StringProtocolEncoder;
import org.traccar.helper.DataConverter;
import org.traccar.model.Command;
+import org.traccar.Protocol;
import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
@@ -32,6 +33,10 @@ import java.util.TimeZone;
public class WatchProtocolEncoder extends StringProtocolEncoder implements StringProtocolEncoder.ValueFormatter {
+ public WatchProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
public String formatValue(String key, Object value) {
if (key.equals(Command.KEY_TIMEZONE)) {
diff --git a/src/main/java/org/traccar/protocol/WialonProtocol.java b/src/main/java/org/traccar/protocol/WialonProtocol.java
index 06b54dceb..3838791a7 100644
--- a/src/main/java/org/traccar/protocol/WialonProtocol.java
+++ b/src/main/java/org/traccar/protocol/WialonProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ public class WialonProtocol extends BaseProtocol {
} else {
pipeline.addLast(new StringDecoder());
}
- pipeline.addLast(new WialonProtocolEncoder());
+ pipeline.addLast(new WialonProtocolEncoder(WialonProtocol.this));
pipeline.addLast(new WialonProtocolDecoder(WialonProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/WialonProtocolEncoder.java b/src/main/java/org/traccar/protocol/WialonProtocolEncoder.java
index 9ff1631eb..c45edf00d 100644
--- a/src/main/java/org/traccar/protocol/WialonProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/WialonProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
* Copyright 2016 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,9 +18,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class WialonProtocolEncoder extends StringProtocolEncoder {
+ public WialonProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
switch (command.getType()) {
diff --git a/src/main/java/org/traccar/protocol/WondexProtocol.java b/src/main/java/org/traccar/protocol/WondexProtocol.java
index 8c6283d66..82a18840e 100644
--- a/src/main/java/org/traccar/protocol/WondexProtocol.java
+++ b/src/main/java/org/traccar/protocol/WondexProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ import io.netty.handler.codec.string.StringEncoder;
public class WondexProtocol extends BaseProtocol {
public WondexProtocol() {
- setTextCommandEncoder(new WondexProtocolEncoder());
+ setTextCommandEncoder(new WondexProtocolEncoder(WondexProtocol.this));
setSupportedCommands(
Command.TYPE_GET_DEVICE_STATUS,
Command.TYPE_GET_MODEM_STATUS,
@@ -38,7 +38,7 @@ public class WondexProtocol extends BaseProtocol {
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new WondexFrameDecoder());
pipeline.addLast(new StringEncoder());
- pipeline.addLast(new WondexProtocolEncoder());
+ pipeline.addLast(new WondexProtocolEncoder(WondexProtocol.this));
pipeline.addLast(new WondexProtocolDecoder(WondexProtocol.this));
}
});
@@ -46,7 +46,7 @@ public class WondexProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new StringEncoder());
- pipeline.addLast(new WondexProtocolEncoder());
+ pipeline.addLast(new WondexProtocolEncoder(WondexProtocol.this));
pipeline.addLast(new WondexProtocolDecoder(WondexProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/WondexProtocolEncoder.java b/src/main/java/org/traccar/protocol/WondexProtocolEncoder.java
index f9e8eeb9b..e9bb23d15 100644
--- a/src/main/java/org/traccar/protocol/WondexProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/WondexProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class WondexProtocolEncoder extends StringProtocolEncoder {
+ public WondexProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
diff --git a/src/main/java/org/traccar/protocol/XexunProtocol.java b/src/main/java/org/traccar/protocol/XexunProtocol.java
index 0005270fb..401844e7b 100644
--- a/src/main/java/org/traccar/protocol/XexunProtocol.java
+++ b/src/main/java/org/traccar/protocol/XexunProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ public class XexunProtocol extends BaseProtocol {
}
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
- pipeline.addLast(new XexunProtocolEncoder());
+ pipeline.addLast(new XexunProtocolEncoder(XexunProtocol.this));
pipeline.addLast(new XexunProtocolDecoder(XexunProtocol.this, full));
}
});
diff --git a/src/main/java/org/traccar/protocol/XexunProtocolEncoder.java b/src/main/java/org/traccar/protocol/XexunProtocolEncoder.java
index 515cfbbd0..fc849fe15 100644
--- a/src/main/java/org/traccar/protocol/XexunProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/XexunProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class XexunProtocolEncoder extends StringProtocolEncoder {
+ public XexunProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
diff --git a/src/main/java/org/traccar/protocol/XirgoProtocol.java b/src/main/java/org/traccar/protocol/XirgoProtocol.java
index 4979fda5d..1be5b6c4b 100644
--- a/src/main/java/org/traccar/protocol/XirgoProtocol.java
+++ b/src/main/java/org/traccar/protocol/XirgoProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ public class XirgoProtocol extends BaseProtocol {
pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "##"));
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
- pipeline.addLast(new XirgoProtocolEncoder());
+ pipeline.addLast(new XirgoProtocolEncoder(XirgoProtocol.this));
pipeline.addLast(new XirgoProtocolDecoder(XirgoProtocol.this));
}
});
@@ -44,7 +44,7 @@ public class XirgoProtocol extends BaseProtocol {
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
- pipeline.addLast(new XirgoProtocolEncoder());
+ pipeline.addLast(new XirgoProtocolEncoder(XirgoProtocol.this));
pipeline.addLast(new XirgoProtocolDecoder(XirgoProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/XirgoProtocolEncoder.java b/src/main/java/org/traccar/protocol/XirgoProtocolEncoder.java
index dd5e30cca..aa85e9e0e 100644
--- a/src/main/java/org/traccar/protocol/XirgoProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/XirgoProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,14 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class XirgoProtocolEncoder extends StringProtocolEncoder {
+ public XirgoProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
@Override
protected Object encodeCommand(Command command) {
diff --git a/src/main/java/org/traccar/protocol/Xrb28Protocol.java b/src/main/java/org/traccar/protocol/Xrb28Protocol.java
index b1f1c34fb..5d8af418b 100644
--- a/src/main/java/org/traccar/protocol/Xrb28Protocol.java
+++ b/src/main/java/org/traccar/protocol/Xrb28Protocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@ public class Xrb28Protocol extends BaseProtocol {
pipeline.addLast(new LineBasedFrameDecoder(1024));
pipeline.addLast(new StringEncoder(StandardCharsets.ISO_8859_1));
pipeline.addLast(new StringDecoder());
- pipeline.addLast(new Xrb28ProtocolEncoder());
+ pipeline.addLast(new Xrb28ProtocolEncoder(Xrb28Protocol.this));
pipeline.addLast(new Xrb28ProtocolDecoder(Xrb28Protocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/Xrb28ProtocolEncoder.java b/src/main/java/org/traccar/protocol/Xrb28ProtocolEncoder.java
index 617639312..3e69af329 100644
--- a/src/main/java/org/traccar/protocol/Xrb28ProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/Xrb28ProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +18,14 @@ package org.traccar.protocol;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolEncoder;
import org.traccar.model.Command;
+import org.traccar.Protocol;
public class Xrb28ProtocolEncoder extends BaseProtocolEncoder {
+ public Xrb28ProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
private String formatCommand(Command command, String content) {
return String.format("\u00ff\u00ff*SCOS,OM,%s,%s#\n", getUniqueId(command.getDeviceId()), content);
}
diff --git a/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java
index cb0a31ceb..fd6214c57 100644
--- a/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Anatoliy Golubev (darth.naihil@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,7 +27,7 @@ public class AdmProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- AdmProtocolEncoder encoder = new AdmProtocolEncoder();
+ AdmProtocolEncoder encoder = new AdmProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java
index bdcc1f9e8..be5877193 100644
--- a/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class BceProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- BceProtocolEncoder encoder = new BceProtocolEncoder();
-
+ BceProtocolEncoder encoder = new BceProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_OUTPUT_CONTROL);
diff --git a/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java
index bcb93a010..1864d9e84 100644
--- a/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class CastelProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- CastelProtocolEncoder encoder = new CastelProtocolEncoder();
-
+ CastelProtocolEncoder encoder = new CastelProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
diff --git a/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java
index 89850fb5f..616640116 100644
--- a/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java
@@ -11,8 +11,8 @@ public class CellocatorProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- CellocatorProtocolEncoder encoder = new CellocatorProtocolEncoder();
-
+ CellocatorProtocolEncoder encoder = new CellocatorProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_OUTPUT_CONTROL);
diff --git a/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java
index 7c03b7d5b..f0eede4bf 100644
--- a/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class CityeasyProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- CityeasyProtocolEncoder encoder = new CityeasyProtocolEncoder();
+ CityeasyProtocolEncoder encoder = new CityeasyProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/EelinkProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/EelinkProtocolEncoderTest.java
index e4502f919..616ca0b52 100644
--- a/src/test/java/org/traccar/protocol/EelinkProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/EelinkProtocolEncoderTest.java
@@ -13,9 +13,9 @@ public class EelinkProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
- verifyCommand(new EelinkProtocolEncoder(false), command, binary("676780000f0000010000000052454c41592c3123"));
+ verifyCommand(new EelinkProtocolEncoder(null, false), command, binary("676780000f0000010000000052454c41592c3123"));
- verifyCommand(new EelinkProtocolEncoder(true), command, binary("454c001eb41a0123456789012345676780000f0000010000000052454c41592c3123"));
+ verifyCommand(new EelinkProtocolEncoder(null, true), command, binary("454c001eb41a0123456789012345676780000f0000010000000052454c41592c3123"));
}
diff --git a/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java
index 16f00d69b..7bf4f844e 100644
--- a/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class EsealProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- EsealProtocolEncoder encoder = new EsealProtocolEncoder();
+ EsealProtocolEncoder encoder = new EsealProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java
index 53ae8510a..b60313956 100644
--- a/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java
@@ -11,8 +11,8 @@ public class FifotrackProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- FifotrackProtocolEncoder encoder = new FifotrackProtocolEncoder();
-
+ FifotrackProtocolEncoder encoder = new FifotrackProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_REQUEST_PHOTO);
diff --git a/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java
index 34423578d..6a68752bb 100644
--- a/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class GalileoProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- GalileoProtocolEncoder encoder = new GalileoProtocolEncoder();
+ GalileoProtocolEncoder encoder = new GalileoProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java
index f888ee252..23a05fcee 100644
--- a/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java
@@ -11,13 +11,13 @@ public class Gps103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodic() throws Exception {
- Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder();
-
+ Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_PERIODIC);
command.set(Command.KEY_FREQUENCY, 300);
-
+
assertEquals("**,imei:123456789012345,C,05m", encoder.encodeCommand(command));
}
@@ -25,7 +25,7 @@ public class Gps103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() throws Exception {
- Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder();
+ Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java
index aceaef434..178c7b763 100644
--- a/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class Gt06ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- Gt06ProtocolEncoder encoder = new Gt06ProtocolEncoder();
-
+ Gt06ProtocolEncoder encoder = new Gt06ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
diff --git a/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java
index a7ce3fc7e..155869b24 100644
--- a/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java
@@ -14,7 +14,7 @@ import static org.junit.Assert.assertEquals;
public class H02ProtocolEncoderTest extends ProtocolTest {
- private H02ProtocolEncoder encoder = new H02ProtocolEncoder();
+ private H02ProtocolEncoder encoder = new H02ProtocolEncoder(null);
private Date time = Date.from(
LocalDateTime.of(LocalDate.now(), LocalTime.of(1, 2, 3)).atZone(ZoneOffset.systemDefault()).toInstant());
diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java
index 771e6d28c..d0a0427c8 100644
--- a/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java
@@ -11,8 +11,8 @@ public class HuabaoProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- HuabaoProtocolEncoder encoder = new HuabaoProtocolEncoder();
-
+ HuabaoProtocolEncoder encoder = new HuabaoProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
diff --git a/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java
index e7c4318b3..225edd643 100644
--- a/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class ItsProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- ItsProtocolEncoder encoder = new ItsProtocolEncoder();
+ ItsProtocolEncoder encoder = new ItsProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java
index 100d7492a..c0b399c63 100644
--- a/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java
@@ -7,7 +7,7 @@ import org.traccar.ProtocolTest;
import org.traccar.model.Command;
public class Jt600ProtocolEncoderTest extends ProtocolTest {
- Jt600ProtocolEncoder encoder = new Jt600ProtocolEncoder();
+ Jt600ProtocolEncoder encoder = new Jt600ProtocolEncoder(null);
Command command = new Command();
@Test
diff --git a/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java
index ab858041a..390defe6f 100644
--- a/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class KhdProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- KhdProtocolEncoder encoder = new KhdProtocolEncoder();
-
+ KhdProtocolEncoder encoder = new KhdProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
diff --git a/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java
index ee4a869f9..d7aa25be8 100644
--- a/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class MeiligaoProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- MeiligaoProtocolEncoder encoder = new MeiligaoProtocolEncoder();
+ MeiligaoProtocolEncoder encoder = new MeiligaoProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java
index b63ce5051..2b5054cee 100644
--- a/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java
@@ -11,8 +11,8 @@ public class MeitrackProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- MeitrackProtocolEncoder encoder = new MeitrackProtocolEncoder();
-
+ MeitrackProtocolEncoder encoder = new MeitrackProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_SINGLE);
diff --git a/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java
index e9422da9f..5de1346a2 100644
--- a/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class MiniFinderProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- MiniFinderProtocolEncoder encoder = new MiniFinderProtocolEncoder();
+ MiniFinderProtocolEncoder encoder = new MiniFinderProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java
index 38599e0ba..4991f1371 100644
--- a/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class NoranProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- NoranProtocolEncoder encoder = new NoranProtocolEncoder();
-
+ NoranProtocolEncoder encoder = new NoranProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
diff --git a/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java
index 1b2780325..aa08ecea2 100644
--- a/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java
@@ -11,13 +11,13 @@ public class PretraceProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodic() throws Exception {
- PretraceProtocolEncoder encoder = new PretraceProtocolEncoder();
-
+ PretraceProtocolEncoder encoder = new PretraceProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_PERIODIC);
command.set(Command.KEY_FREQUENCY, 300);
-
+
assertEquals("(123456789012345D221300,300,,^69)", encoder.encodeCommand(command));
}
@@ -25,7 +25,7 @@ public class PretraceProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() throws Exception {
- PretraceProtocolEncoder encoder = new PretraceProtocolEncoder();
+ PretraceProtocolEncoder encoder = new PretraceProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java
index a6c8bb50f..9e4a8a9a0 100644
--- a/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class Pt502ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() throws Exception {
- Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder();
+ Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -25,22 +25,22 @@ public class Pt502ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeOutputControl() throws Exception {
- Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder();
-
+ Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_OUTPUT_CONTROL);
command.set(Command.KEY_INDEX, 2);
command.set(Command.KEY_DATA, "1");
-
+
assertEquals("#OPC2,1\r\n", encoder.encodeCommand(command));
}
-
+
@Test
public void testEncodeTimezone() throws Exception {
- Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder();
+ Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -55,7 +55,7 @@ public class Pt502ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeAlarmSpeed() throws Exception {
- Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder();
+ Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java
index 8a00caa09..5868b07df 100644
--- a/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class RuptelaProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- RuptelaProtocolEncoder encoder = new RuptelaProtocolEncoder();
-
+ RuptelaProtocolEncoder encoder = new RuptelaProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_CUSTOM);
diff --git a/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java
index e41b91281..683aa9d80 100644
--- a/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class T800xProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- T800xProtocolEncoder encoder = new T800xProtocolEncoder();
-
+ T800xProtocolEncoder encoder = new T800xProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_CUSTOM);
diff --git a/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java
index 5dc78c012..0318b9896 100644
--- a/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class TeltonikaProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- TeltonikaProtocolEncoder encoder = new TeltonikaProtocolEncoder();
-
+ TeltonikaProtocolEncoder encoder = new TeltonikaProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_CUSTOM);
diff --git a/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
index 34b2acf86..d1dad8c92 100644
--- a/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeOutputControl() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -25,8 +25,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeEngineStop() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
-
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
@@ -38,8 +38,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionSingle() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
-
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_SINGLE);
@@ -51,8 +51,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodic() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
-
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_PERIODIC);
@@ -65,8 +65,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionStop() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
-
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_STOP);
@@ -78,8 +78,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeGetVersion() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
-
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_GET_VERSION);
@@ -91,8 +91,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeRebootDevice() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
-
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_REBOOT_DEVICE);
@@ -104,8 +104,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSetOdometer() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
-
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_SET_ODOMETER);
@@ -117,7 +117,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionSingleAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -130,7 +130,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodicAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -143,7 +143,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionStopAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -156,7 +156,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeGetVersionAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -169,7 +169,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeRebootDeviceAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -182,7 +182,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeIdentificationAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -195,7 +195,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSosOnAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -209,7 +209,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSosOffAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -223,7 +223,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -237,7 +237,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustomAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -251,7 +251,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSetConnectionAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -266,7 +266,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSosNumberAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java
index 5a47f74cc..d8c54afbe 100644
--- a/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java
@@ -11,13 +11,13 @@ public class TotemProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- TotemProtocolEncoder encoder = new TotemProtocolEncoder();
-
+ TotemProtocolEncoder encoder = new TotemProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(2);
command.setType(Command.TYPE_ENGINE_STOP);
command.set(Command.KEY_DEVICE_PASSWORD, "000000");
-
+
assertEquals("*000000,025,C,1#", encoder.encodeCommand(command));
}
diff --git a/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java
index a0631be3b..798213c7b 100644
--- a/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class WatchProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- WatchProtocolEncoder encoder = new WatchProtocolEncoder();
-
+ WatchProtocolEncoder encoder = new WatchProtocolEncoder(null);
+
Command command;
command = new Command();
@@ -60,7 +60,7 @@ public class WatchProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeTimezone() {
- WatchProtocolEncoder encoder = new WatchProtocolEncoder();
+ WatchProtocolEncoder encoder = new WatchProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java
index 8209fc412..41fee2723 100644
--- a/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java
@@ -10,7 +10,7 @@ public class WondexProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- WondexProtocolEncoder encoder = new WondexProtocolEncoder();
+ WondexProtocolEncoder encoder = new WondexProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(2);
diff --git a/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java
index dd2e939c9..0ff47cad3 100644
--- a/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java
@@ -11,14 +11,14 @@ public class XirgoProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- XirgoProtocolEncoder encoder = new XirgoProtocolEncoder();
-
+ XirgoProtocolEncoder encoder = new XirgoProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_OUTPUT_CONTROL);
command.set(Command.KEY_INDEX, 0);
command.set(Command.KEY_DATA, 1);
-
+
assertEquals("+XT:7005,2,1", encoder.encodeCommand(command));
}
diff --git a/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java
index 49476d694..27efbd6db 100644
--- a/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java
@@ -11,13 +11,13 @@ public class Xrb28ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodic() {
- Xrb28ProtocolEncoder encoder = new Xrb28ProtocolEncoder();
-
+ Xrb28ProtocolEncoder encoder = new Xrb28ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_PERIODIC);
command.set(Command.KEY_FREQUENCY, 300);
-
+
assertEquals("\u00ff\u00ff*SCOS,OM,123456789012345,D1,300#\n", encoder.encodeCommand(null, command));
}
@@ -25,7 +25,7 @@ public class Xrb28ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() {
- Xrb28ProtocolEncoder encoder = new Xrb28ProtocolEncoder();
+ Xrb28ProtocolEncoder encoder = new Xrb28ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);