aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
authoredvalley <52469633+edvalley@users.noreply.github.com>2023-07-07 08:08:48 -0400
committerGitHub <noreply@github.com>2023-07-07 08:08:48 -0400
commitc12f74fea206191877d4a727547bfdb0c9b938cc (patch)
treea004fd62e2d77743e80bb1f8e922a14be351254f /src/main/java/org/traccar/protocol
parent6c3b33275e2d8310011c38ed1bc292546e15cae9 (diff)
downloadtrackermap-server-c12f74fea206191877d4a727547bfdb0c9b938cc.tar.gz
trackermap-server-c12f74fea206191877d4a727547bfdb0c9b938cc.tar.bz2
trackermap-server-c12f74fea206191877d4a727547bfdb0c9b938cc.zip
Keep same structure as before
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java
index 3b654db0c..dbac159b3 100644
--- a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java
@@ -110,26 +110,25 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder {
private String decodeEvent(String event, Position position) {
- 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;
- }
-
- 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;
+ 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);
+ position.set(Position.PREFIX_IN + 3, 0);
+ return null;
+ } else if (inputStatus >= 'O' && inputStatus <= 'R') {
+ int inputStatusInt = inputStatus - 'O';
+ position.set(Position.PREFIX_IN + 1, inputStatusInt & 1);
+ position.set(Position.PREFIX_IN + 2, inputStatusInt & 2);
+ position.set(Position.PREFIX_IN + 3, 1);
+ return null;
+ }
+ }
+
+ return event;
+
}
private void sendEventResponse(