From d0ed5e6964a5e44793b8c72106f09e4ce147f47d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 4 Sep 2017 05:19:40 +1200 Subject: Support CK300 device protocol --- src/org/traccar/protocol/Gl200TextProtocolDecoder.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java index e05182022..988fd71c8 100644 --- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java @@ -80,7 +80,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { .number("d{14},") // last fix time .groupBegin() .number("(d+),") // battery percentage - .expression("[01]?,") // flash type + .number("[d.]*,") // flash type / power .number("(-?[d.]+)?,,,") // temperature .or() .expression("(?:[01])?,").optional() // pin15 mode @@ -394,7 +394,21 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { return null; } - position.set(Position.KEY_STATUS, parser.next()); + String status = parser.next(); + + if (status.charAt(0) == '2') { + position.set(Position.KEY_IGNITION, true); + } else if (status.charAt(0) == '4') { + position.set(Position.KEY_IGNITION, false); + } + + if (status.charAt(1) == '1') { + position.set(Position.KEY_MOTION, false); + } else if (status.charAt(1) == '2') { + position.set(Position.KEY_MOTION, true); + } + + position.set(Position.KEY_STATUS, status); position.set(Position.KEY_RSSI, parser.nextInt()); -- cgit v1.2.3