diff options
author | seym45 <seym45@gmail.com> | 2023-07-24 20:29:29 +0400 |
---|---|---|
committer | seym45 <seym45@gmail.com> | 2023-07-24 20:52:46 +0400 |
commit | 09daf15be1a874a8880645d4595e1b57d4cf2eee (patch) | |
tree | 8d57df2aa397431b3b3f2e296c1cae713dc1a803 /src/main/java/org | |
parent | 1ee9e9396d7274f057f5e6d2d69e72ec1a5c0135 (diff) | |
download | trackermap-server-09daf15be1a874a8880645d4595e1b57d4cf2eee.tar.gz trackermap-server-09daf15be1a874a8880645d4595e1b57d4cf2eee.tar.bz2 trackermap-server-09daf15be1a874a8880645d4595e1b57d4cf2eee.zip |
Add method to get calibration byte
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/protocol/GatorProtocolEncoder.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java b/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java index df85a712c..0d4353c8f 100644 --- a/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java +++ b/src/main/java/org/traccar/protocol/GatorProtocolEncoder.java @@ -62,12 +62,24 @@ public class GatorProtocolEncoder extends BaseProtocolEncoder { return encodedId.toString(); } + private static String getCalibrationByteFromHexString(String data) { + String response = ""; + int calib = 0; + int length = data.length() / 2; + for (int i = 0; i < length; i++) { + calib = calib ^ Integer.parseInt(data.substring(i * 2, i * 2 + 2), 16); + } + response = Integer.toHexString(calib).toUpperCase(); + response = String.format("%2s", response).replace(' ', '0'); + return response; + } private ByteBuf encodeContent(long deviceId, String mainOrder, String content) { // FIXME: implement this method return null; } + @Override protected Object encodeCommand(Command command) { |