aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/GatorProtocol.java2
-rw-r--r--src/main/java/org/traccar/protocol/GatorProtocolDecoder.java4
-rw-r--r--src/main/java/org/traccar/protocol/GatorProtocolEncoder.java8
-rw-r--r--src/test/java/org/traccar/protocol/GatorProtocolEncoderTest.java15
4 files changed, 27 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/GatorProtocol.java b/src/main/java/org/traccar/protocol/GatorProtocol.java
index bdea0fb00..0f44fbf47 100644
--- a/src/main/java/org/traccar/protocol/GatorProtocol.java
+++ b/src/main/java/org/traccar/protocol/GatorProtocol.java
@@ -32,6 +32,8 @@ public class GatorProtocol extends BaseProtocol {
setSupportedDataCommands(Command.TYPE_ENGINE_RESUME);
setSupportedDataCommands(Command.TYPE_ENGINE_STOP);
setSupportedDataCommands(Command.TYPE_POSITION_PERIODIC);
+ setSupportedDataCommands(Command.TYPE_SET_SPEED_LIMIT);
+ setSupportedDataCommands(Command.TYPE_SET_ODOMETER);
addServer(new TrackerServer(config, getName(), false) {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline, Config config) {
diff --git a/src/main/java/org/traccar/protocol/GatorProtocolDecoder.java b/src/main/java/org/traccar/protocol/GatorProtocolDecoder.java
index c68546c00..90fd5d0c6 100644
--- a/src/main/java/org/traccar/protocol/GatorProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/GatorProtocolDecoder.java
@@ -38,7 +38,9 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_HEARTBEAT = 0x21;
public static final int MSG_POSITION_REQUEST = 0x30;
- public static final int MSG_POSITION_PERIODIC = 0x34;
+ public static final int MSG_SET_POSITION_REQUEST_INTERVAL = 0x34;
+ public static final int MSG_SET_SPEED_LIMIT = 0x3F;
+ public static final int MSG_SET_ODOMETER = 0x6B;
public static final int MSG_RESTORES_THE_OIL_DUCT = 0x38;
public static final int MSG_CLOSE_THE_OIL_DUCT = 0x39;
public static final int MSG_POSITION_DATA = 0x80;
diff --git a/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java b/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java
index 5452d83c7..570dd269a 100644
--- a/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java
@@ -81,11 +81,17 @@ public class GatorProtocolEncoder extends BaseProtocolEncoder {
return encodeContent(command.getDeviceId(), GatorProtocolDecoder.MSG_CLOSE_THE_OIL_DUCT, content);
case Command.TYPE_ENGINE_RESUME:
return encodeContent(command.getDeviceId(), GatorProtocolDecoder.MSG_RESTORES_THE_OIL_DUCT, content);
+ case Command.TYPE_SET_SPEED_LIMIT:
+ content.writeByte(command.getInteger(Command.KEY_DATA));
+ return encodeContent(command.getDeviceId(), GatorProtocolDecoder.MSG_SET_SPEED_LIMIT, content);
+ case Command.TYPE_SET_ODOMETER:
+ content.writeShort(command.getInteger(Command.KEY_DATA));
+ return encodeContent(command.getDeviceId(), GatorProtocolDecoder.MSG_SET_ODOMETER, content);
case Command.TYPE_POSITION_PERIODIC:
content.writeShort(command.getInteger(Command.KEY_ENGINE_ON_INTERVAL));
content.writeShort(command.getInteger(Command.KEY_ENGINE_OFF_INTERVAL));
content.writeByte(command.getInteger(Command.KEY_HEARTBEAT_INTERVAL));
- return encodeContent(command.getDeviceId(), GatorProtocolDecoder.MSG_POSITION_PERIODIC, content);
+ return encodeContent(command.getDeviceId(), GatorProtocolDecoder.MSG_SET_POSITION_REQUEST_INTERVAL, content);
default:
return null;
}
diff --git a/src/test/java/org/traccar/protocol/GatorProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/GatorProtocolEncoderTest.java
index af6c71e37..7938ab630 100644
--- a/src/test/java/org/traccar/protocol/GatorProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/GatorProtocolEncoderTest.java
@@ -20,4 +20,19 @@ public class GatorProtocolEncoderTest extends ProtocolTest {
command.setType(Command.TYPE_POSITION_SINGLE);
verifyCommand(encoder, command, binary("24243000062008958C070D"));
}
+
+ @Test
+ public void testEncodePeriodicPositionRetrievalIntervalSet() throws Exception {
+ var encoder = inject(new GatorProtocolEncoder(null));
+ var device = encoder.getCacheManager().getObject(Device.class, 1);
+ when(device.getUniqueId()).thenReturn("13088005658");
+
+ Command command = new Command();
+ command.setDeviceId(1);
+ command.set("heartbeat_interval", 120);
+ command.set("engine_off_interval", 5);
+ command.set("engine_on_interval", 5);
+ command.setType(Command.TYPE_POSITION_PERIODIC);
+ verifyCommand(encoder, command, binary("242434000b5800383a00050005781d0d"));
+ }
}