aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorseym45 <seym45@gmail.com>2023-07-24 20:34:00 +0400
committerseym45 <seym45@gmail.com>2023-07-24 20:52:46 +0400
commit103fbde721753b8be65c39e0e9118943c6bebc68 (patch)
treed0f6bec4abbe42ec6a5c1bac537e1efcf49d9135 /src/main/java
parent09daf15be1a874a8880645d4595e1b57d4cf2eee (diff)
downloadtrackermap-server-103fbde721753b8be65c39e0e9118943c6bebc68.tar.gz
trackermap-server-103fbde721753b8be65c39e0e9118943c6bebc68.tar.bz2
trackermap-server-103fbde721753b8be65c39e0e9118943c6bebc68.zip
Add Gator content encoder and test snippets
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/GatorProtocolEncoder.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java b/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java
index 0d4353c8f..125031eee 100644
--- a/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java
@@ -75,8 +75,14 @@ public class GatorProtocolEncoder extends BaseProtocolEncoder {
}
private ByteBuf encodeContent(long deviceId, String mainOrder, String content) {
- // FIXME: implement this method
- return null;
+ String pseudoIPAddress = encodeId(deviceId);
+ int length = 4 + 1 + 1; // ip 4 bytes, calibration byte and end byte
+ String hexStringLength = String.format("%02X", length);
+
+ String packet = "2424" + mainOrder + "00" + hexStringLength + pseudoIPAddress;
+ String calibration = getCalibrationByteFromHexString(packet);
+ packet = packet + calibration + "0D";
+ return Unpooled.wrappedBuffer(DataConverter.parseHex(packet));
}