aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoredvalley <52469633+edvalley@users.noreply.github.com>2023-07-09 14:01:12 -0400
committerGitHub <noreply@github.com>2023-07-09 14:01:12 -0400
commit536888fd7e64f00ca9693ea9b41624360949c8ab (patch)
tree23fa60ad7c950fa5666621f2b8f0c02244457d0d /src
parent19e00af6d0c7b666841b181438e401bb8e7415ff (diff)
downloadtrackermap-server-536888fd7e64f00ca9693ea9b41624360949c8ab.tar.gz
trackermap-server-536888fd7e64f00ca9693ea9b41624360949c8ab.tar.bz2
trackermap-server-536888fd7e64f00ca9693ea9b41624360949c8ab.zip
Conditionally set digital input 3 and analog input 2 according to device model
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java
index c2146c22d..df0f1e2ed 100644
--- a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java
@@ -113,17 +113,22 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder {
if (event.length() == 1) {
char inputStatus = event.charAt(0);
+ String deviceModel = device.getModel();
if (inputStatus >= 'A' && inputStatus <= 'D') {
int inputStatusInt = inputStatus - 'A';
- position.set(Position.PREFIX_IN + 1, BitUtil.check(inputStatusInt, 0));
- position.set(Position.PREFIX_IN + 2, BitUtil.check(inputStatusInt, 1));
- position.set(Position.PREFIX_IN + 3, 0);
+ position.set(Position.PREFIX_IN + 1, (boolean) BitUtil.check(inputStatusInt, 0));
+ position.set(Position.PREFIX_IN + 2, (boolean) BitUtil.check(inputStatusInt, 1));
+ if (deviceModel == "SF-Lite") {
+ position.set(Position.PREFIX_IN + 3, false);
+ }
return null;
} else if (inputStatus >= 'O' && inputStatus <= 'R') {
int inputStatusInt = inputStatus - 'O';
- position.set(Position.PREFIX_IN + 1, BitUtil.check(inputStatusInt, 0));
- position.set(Position.PREFIX_IN + 2, BitUtil.check(inputStatusInt, 1));
- position.set(Position.PREFIX_IN + 3, 1);
+ position.set(Position.PREFIX_IN + 1, (boolean) BitUtil.check(inputStatusInt, 0));
+ position.set(Position.PREFIX_IN + 2, (boolean) BitUtil.check(inputStatusInt, 1));
+ if (deviceModel == "SF-Lite") {
+ position.set(Position.PREFIX_IN + 3, true);
+ }
return null;
}
}
@@ -247,7 +252,11 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
position.set(Position.KEY_GPS, parser.nextInt());
position.set(Position.PREFIX_ADC + 1, parser.nextDouble() * 0.001);
- position.set(Position.PREFIX_ADC + 2, parser.nextDouble() * 0.001);
+
+ String deviceModel = device.getModel();
+ if (deviceModel == "AVL110" || deviceModel == "AVL120") {
+ position.set(Position.PREFIX_ADC + 2, parser.nextDouble() * 0.001);
+ }
Integer lac = parser.nextHexInt();
Integer cid = parser.nextHexInt();