aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-12-15 21:07:42 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-12-15 21:07:42 -0800
commit3ca5ec4a61978ddcd89bd774d301796bd2718d1a (patch)
tree217b927b876c2bf7d3c23f4ed4e6df6eda4ff86b /src/main
parent83a139303ef18afcfe706b4f1123457906c89f82 (diff)
downloadtrackermap-server-3ca5ec4a61978ddcd89bd774d301796bd2718d1a.tar.gz
trackermap-server-3ca5ec4a61978ddcd89bd774d301796bd2718d1a.tar.bz2
trackermap-server-3ca5ec4a61978ddcd89bd774d301796bd2718d1a.zip
Fix status decoding
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/SwiftechProtocolDecoder.java8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/protocol/SwiftechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SwiftechProtocolDecoder.java
index b668202dd..8d0b31c8f 100644
--- a/src/main/java/org/traccar/protocol/SwiftechProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/SwiftechProtocolDecoder.java
@@ -19,7 +19,6 @@ import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
import org.traccar.Protocol;
-import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
@@ -47,7 +46,7 @@ public class SwiftechProtocolDecoder extends BaseProtocolDecoder {
.number("(d+.d+),") // speed
.number("(dd)(dd)(dd),") // date (ddmmyy)
.expression("([AV]),") // validity
- .number("([01]{4}),") // status
+ .number("(d{4}),") // status
.number("([01]),") // charge
.number("d+,") // reserved
.number("(d+),") // adc1
@@ -84,10 +83,7 @@ public class SwiftechProtocolDecoder extends BaseProtocolDecoder {
position.setValid(parser.next().equals("A"));
- int status = parser.nextBinInt();
- position.set(Position.KEY_IGNITION, BitUtil.check(status, 3));
- position.set(Position.PREFIX_OUT + 1, BitUtil.check(status, 1));
- position.set(Position.PREFIX_OUT + 2, BitUtil.check(status, 0));
+ position.set(Position.KEY_STATUS, parser.nextInt());
position.set(Position.KEY_CHARGE, parser.nextInt() > 0);