From 18c1e761fd203c994445ac85e808ca6f672d0ec5 Mon Sep 17 00:00:00 2001 From: seym45 Date: Wed, 26 Jul 2023 11:11:15 +0400 Subject: Resolve suggestions - Define MSG_POSITION_REQUEST - Change comment "calibration" to "checksum" --- src/main/java/org/traccar/protocol/GatorProtocolDecoder.java | 1 + src/main/java/org/traccar/protocol/GatorProtocolEncoder.java | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/java/org/traccar/protocol/GatorProtocolDecoder.java b/src/main/java/org/traccar/protocol/GatorProtocolDecoder.java index 644caee81..f7da5dc75 100644 --- a/src/main/java/org/traccar/protocol/GatorProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/GatorProtocolDecoder.java @@ -37,6 +37,7 @@ 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_DATA = 0x80; public static final int MSG_ROLLCALL_RESPONSE = 0x81; public static final int MSG_ALARM_DATA = 0x82; diff --git a/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java b/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java index c4f06dbc5..f2c522067 100644 --- a/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java +++ b/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java @@ -60,9 +60,7 @@ public class GatorProtocolEncoder extends BaseProtocolEncoder { buf.writeByte(0x24); buf.writeByte(mainOrder); buf.writeByte(0x00); - - int length = 4 + 1 + 1; // ip 4 bytes, calibration byte and end byte - buf.writeByte(length); + buf.writeByte(4 + 1 + 1); // ip 4 bytes, checksum and end byte ByteBuf pseudoIPAddress = encodeId(deviceId); buf.writeBytes(pseudoIPAddress); @@ -80,7 +78,7 @@ public class GatorProtocolEncoder extends BaseProtocolEncoder { switch (command.getType()) { case Command.TYPE_POSITION_SINGLE: - return encodeContent(command.getDeviceId(), 0x30); + return encodeContent(command.getDeviceId(), GatorProtocolDecoder.MSG_POSITION_REQUEST); default: return null; } -- cgit v1.2.3