From 65ffcb945a0cd62198d0570f9044114bb1e57528 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 26 Oct 2017 23:53:52 +1300 Subject: Update D-WAY protocol decoder --- src/org/traccar/protocol/DwayProtocolDecoder.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src') 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); -- cgit v1.2.3