From 457bda5a0e8501dfae1d3dd4e0d39f778ee4d9da Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 27 Jul 2016 13:58:37 +1200 Subject: Update custom T55 protocol format --- src/org/traccar/protocol/T55ProtocolDecoder.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java index 34efc376f..1909d9bea 100644 --- a/src/org/traccar/protocol/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/T55ProtocolDecoder.java @@ -50,7 +50,9 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { .expression("[^,]+") .number(",(d+)") // satellites .number(",(d+)") // imei - .number(",(d+)").optional(3) + .number(",([01])") // ignition + .number(",(d+)") // fuel + .number(",(d+)").optional(5) // battery .any() .compile(); @@ -123,13 +125,18 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt()); position.setTime(dateBuilder.getDate()); - if (parser.hasNext(3)) { + if (parser.hasNext(5)) { position.set(Position.KEY_SATELLITES, parser.next()); + deviceSession = getDeviceSession(channel, remoteAddress, parser.next()); if (deviceSession == null) { return null; } position.setDeviceId(deviceSession.getDeviceId()); + + position.set(Position.KEY_IGNITION, parser.hasNext() && parser.next().equals("1")); + position.set(Position.KEY_FUEL, parser.nextInt()); + position.set(Position.KEY_BATTERY, parser.nextInt()); } if (deviceSession != null) { -- cgit v1.2.3