diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-02-28 15:51:36 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-02-28 15:51:36 -0800 |
commit | 166852601ab6b4f0e7917ae7c53a216ce3ffb054 (patch) | |
tree | f712532d1b28d2da8134f7949726f2c8be0545a7 /src/main/java/org/traccar/protocol | |
parent | 74555e6c149dd4782afd28efea3f45a876892b2c (diff) | |
download | trackermap-server-166852601ab6b4f0e7917ae7c53a216ce3ffb054.tar.gz trackermap-server-166852601ab6b4f0e7917ae7c53a216ce3ffb054.tar.bz2 trackermap-server-166852601ab6b4f0e7917ae7c53a216ce3ffb054.zip |
Support GV200 temperature
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r-- | src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java index d438aa33d..a95c90616 100644 --- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2020 Anton Tananaev (anton@traccar.org) + * Copyright 2012 - 2021 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -237,8 +237,14 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { .number("(d{5}:dd:dd)?,") // hour meter .number("(x+)?,") // adc 1 .number("(x+)?,").optional() // adc 2 + .groupBegin() + .number("(x+)?,") // adc 3 + .number("(xx),") // inputs + .number("(xx),") // outputs + .or() .number("(d{1,3})?,") // battery .number("(?:(xx)(xx)(xx))?,") // device status + .groupEnd() .expression("(.*)") // additional data .or() .number("d*,,") @@ -920,15 +926,21 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_POWER, power * 0.001); } - if (parser.hasNext(9)) { + if (parser.hasNext(12)) { position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000); position.set(Position.KEY_HOURS, parseHours(parser.next())); position.set(Position.PREFIX_ADC + 1, parser.next()); position.set(Position.PREFIX_ADC + 2, parser.next()); - position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt()); - - decodeStatus(position, parser); + position.set(Position.PREFIX_ADC + 3, parser.next()); + if (parser.hasNext(2)) { + position.set(Position.KEY_INPUT, parser.nextHexInt()); + position.set(Position.KEY_OUTPUT, parser.nextHexInt()); + } + if (parser.hasNext(4)) { + position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt()); + decodeStatus(position, parser); + } int index = 0; String[] data = parser.next().split(","); |