aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authoredvalley <52469633+edvalley@users.noreply.github.com>2023-05-25 19:58:07 -0400
committerGitHub <noreply@github.com>2023-05-25 19:58:07 -0400
commit86511cd68d968c15db66ddfbe831a34be13e8ba1 (patch)
tree9e59b92cbea0eacbd79ffcaff990c36ca89a9658 /src/main/java/org/traccar
parentdee954b9f28c129215e9fa600e6860e2d4adb673 (diff)
downloadtrackermap-server-86511cd68d968c15db66ddfbe831a34be13e8ba1.tar.gz
trackermap-server-86511cd68d968c15db66ddfbe831a34be13e8ba1.tar.bz2
trackermap-server-86511cd68d968c15db66ddfbe831a34be13e8ba1.zip
Acknowledge mileage alert and decode third input status
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java
index e9570ee11..ede4650b8 100644
--- a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java
@@ -110,17 +110,25 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder {
private String decodeEvent(String event, Position position) {
- if (event.length() == 1) {
- char inputStatus = event.charAt(0);
- if (inputStatus >= 'A' && inputStatus <= 'D') {
- int inputStatusInt = inputStatus - 'A';
- position.set(Position.PREFIX_IN + 1, inputStatusInt & 1);
- position.set(Position.PREFIX_IN + 2, inputStatusInt & 2);
- return null;
- }
+ if (event.length() != 1)
+ return event;
+
+ int inputStatusInt = 0;
+ char inputStatus = event.charAt(0);
+
+ if (inputStatus >= 'A' && inputStatus <= 'D') {
+ inputStatusInt = inputStatus - 'A';
+ } else if(inputStatus >= 'O' && inputStatus <= 'R') {
+ inputStatusInt = inputStatus - 'O' + 4;
+ } else {
+ return event;
}
- return event;
+ position.set(Position.PREFIX_IN + 1, inputStatusInt & 1);
+ position.set(Position.PREFIX_IN + 2, inputStatusInt & 2);
+ position.set(Position.PREFIX_IN + 3, inputStatusInt & 4);
+
+ return null;
}
private void sendEventResponse(
@@ -132,6 +140,9 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder {
case "3":
responseCode = "d";
break;
+ case "M":
+ responseCode = "m";
+ break;
case "S":
case "T":
responseCode = "t";