aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 605add0d5..574f9a8c3 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -22,6 +22,7 @@ import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
+import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
@@ -148,7 +149,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
.number("(x+)?,") // adc 1
.number("(x+)?,") // adc 2
.number("(d{1,3})?,") // battery
- .number("(x{6})?,,,,") // device status
+ .number("(?:(xx)(xx)(xx))?,,,,") // device status
.groupEnd()
.number("(dddd)(dd)(dd)") // date
.number("(dd)(dd)(dd)").optional(2) // time
@@ -350,7 +351,17 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.PREFIX_ADC + 1, parser.next());
position.set(Event.PREFIX_ADC + 2, parser.next());
position.set(Event.KEY_BATTERY, parser.next());
- position.set(Event.KEY_STATUS, parser.next());
+
+ if (parser.hasNext(3)) {
+ int ignition = parser.nextInt(16);
+ if (BitUtil.check(ignition, 4)) {
+ position.set(Event.KEY_IGNITION, false);
+ } else if (BitUtil.check(ignition, 5)) {
+ position.set(Event.KEY_IGNITION, true);
+ }
+ position.set(Event.KEY_INPUT, parser.nextInt(16));
+ position.set(Event.KEY_OUTPUT, parser.nextInt(16));
+ }
// workaround for wrong location time
if (parser.hasNext(6)) {