diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-01 02:37:01 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-01 11:37:52 +1200 |
commit | 035deb166330dd7bf204a2acd2e8045317e0e440 (patch) | |
tree | c98ff9e7ba53bad91e695908e35a04fb288998b8 /src/org/traccar | |
parent | dc5f2151d9e74f525d74663d599320b8cf3d9c47 (diff) | |
download | traccar-server-035deb166330dd7bf204a2acd2e8045317e0e440.tar.gz traccar-server-035deb166330dd7bf204a2acd2e8045317e0e440.tar.bz2 traccar-server-035deb166330dd7bf204a2acd2e8045317e0e440.zip |
Add GV300 temperature sensor support
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/Gl200ProtocolDecoder.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index 7e76fd6c9..a6da38ef4 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -217,7 +217,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { .number("(x+)?,") // adc 2 .number("(d{1,3})?,") // battery .number("(?:(xx)(xx)(xx))?,") // device status - .any() + .expression("(.*)") // additional data .number("(dddd)(dd)(dd)") // date (yyyymmdd) .number("(dd)(dd)(dd)").optional(2) // time (hhmmss) .text(",") @@ -601,6 +601,20 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { decodeStatus(position, parser); + int index = 0; + String[] data = parser.next().split(","); + if (data.length > 1) { + int deviceType = Integer.parseInt(data[index++]); + if (deviceType == 2) { + int deviceCount = Integer.parseInt(data[index++]); + for (int i = 1; i <= deviceCount; i++) { + index++; // id + index++; // type + position.set(Position.PREFIX_TEMP + i, Short.parseShort(data[index++], 16) * 0.0625); + } + } + } + decodeDeviceTime(position, parser); return positions; |