diff options
author | edvalley <52469633+edvalley@users.noreply.github.com> | 2023-07-07 23:24:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-07 23:24:23 -0400 |
commit | 19e00af6d0c7b666841b181438e401bb8e7415ff (patch) | |
tree | ed012e0faad54764ab3133b7cd686426f656f0da /src | |
parent | eb7c310a6337328f73c33cb8f0e222dc286925f1 (diff) | |
download | trackermap-server-19e00af6d0c7b666841b181438e401bb8e7415ff.tar.gz trackermap-server-19e00af6d0c7b666841b181438e401bb8e7415ff.tar.bz2 trackermap-server-19e00af6d0c7b666841b181438e401bb8e7415ff.zip |
Use BitUtil instead of logical bitwise AND operator
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java index 60a9365c5..c2146c22d 100644 --- a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java @@ -28,6 +28,7 @@ import org.traccar.helper.PatternBuilder; import org.traccar.model.CellTower; import org.traccar.model.Network; import org.traccar.model.Position; +import org.traccar.helper.BitUtil; import java.net.SocketAddress; import java.util.regex.Pattern; @@ -114,14 +115,14 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { 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 + 1, BitUtil.check(inputStatusInt, 0)); + position.set(Position.PREFIX_IN + 2, BitUtil.check(inputStatusInt, 1)); 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 + 1, BitUtil.check(inputStatusInt, 0)); + position.set(Position.PREFIX_IN + 2, BitUtil.check(inputStatusInt, 1)); position.set(Position.PREFIX_IN + 3, 1); return null; } |