diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-10-26 23:53:52 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-10-26 23:53:52 +1300 |
commit | 65ffcb945a0cd62198d0570f9044114bb1e57528 (patch) | |
tree | edd3d60055e4f8575f0ed95139a175de35727f4d /src/org/traccar | |
parent | dcc7e0c6ed949604af5e62c671e293f582146bc0 (diff) | |
download | trackermap-server-65ffcb945a0cd62198d0570f9044114bb1e57528.tar.gz trackermap-server-65ffcb945a0cd62198d0570f9044114bb1e57528.tar.bz2 trackermap-server-65ffcb945a0cd62198d0570f9044114bb1e57528.zip |
Update D-WAY protocol decoder
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/DwayProtocolDecoder.java | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/DwayProtocolDecoder.java b/src/org/traccar/protocol/DwayProtocolDecoder.java index 993aa91b2..767b35c72 100644 --- a/src/org/traccar/protocol/DwayProtocolDecoder.java +++ b/src/org/traccar/protocol/DwayProtocolDecoder.java @@ -42,15 +42,16 @@ public class DwayProtocolDecoder extends BaseProtocolDecoder { .number("(-?d+.d+),") // latitude .number("(-?d+.d+),") // longitude .number("(-?d+),") // altitude - .number("(d+.d+),") // speed + .number(" ?(d+.d+),") // speed .number("(d+),") // course .number("([01]{4}),") // input .number("([01]{4}),") // output - .number("([01])([01])([01])([01]),") // flags + .number("([01]+),") // flags .number("(d+),") // battery .number("(d+),") // adc1 .number("(d+),") // adc2 .number("(d+)") // driver + .any() .compile(); @Override @@ -79,6 +80,7 @@ public class DwayProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); + position.setValid(true); position.setTime(parser.nextDateTime()); position.setLatitude(parser.nextDouble()); position.setLongitude(parser.nextDouble()); @@ -89,15 +91,6 @@ public class DwayProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_INPUT, parser.nextBinInt()); position.set(Position.KEY_OUTPUT, parser.nextBinInt()); - position.setValid(parser.next().equals("1")); - - position.set(Position.KEY_IGNITION, parser.next().equals("1")); - position.set(Position.KEY_CHARGE, parser.next().equals("1")); - - if (parser.next().equals("1")) { - position.set(Position.KEY_ALARM, Position.ALARM_SHOCK); - } - position.set(Position.KEY_BATTERY, parser.nextInt() * 0.001); position.set(Position.PREFIX_ADC + 1, parser.nextInt() * 0.001); position.set(Position.PREFIX_ADC + 2, parser.nextInt() * 0.001); |