diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-15 18:07:03 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-15 18:07:03 +1300 |
commit | 3ba58a7d025c33c5f4e5e2d595158ecf9f420008 (patch) | |
tree | 34bc7f52059822cbc27e6eac7d3c204fa267f881 /src/org/traccar/protocol/TotemProtocolDecoder.java | |
parent | de46b77e923d3412d74dbf745933bd62acaeca77 (diff) | |
download | trackermap-server-3ba58a7d025c33c5f4e5e2d595158ecf9f420008.tar.gz trackermap-server-3ba58a7d025c33c5f4e5e2d595158ecf9f420008.tar.bz2 trackermap-server-3ba58a7d025c33c5f4e5e2d595158ecf9f420008.zip |
Store LAC and CID in right format
Diffstat (limited to 'src/org/traccar/protocol/TotemProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/TotemProtocolDecoder.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index 321b78b7c..88eecab70 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -55,7 +55,8 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { .number("(ddd)") // battery .number("(dddd)|") // power .number("(d+)|").optional() // adc - .number("(x+)|") // location code + .number("x*(xxxx)") // lac + .number("(xxxx)|") // cid .number("(d+)|") // temperature .number("(d+.d+)|") // odometer .number("d+|") // serial number @@ -84,7 +85,8 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { .number("(dd)") // battery .number("(dd)|") // external power .number("(d+)|") // adc - .number("(x{8})|") // location code + .number("(xxxx)") // lac + .number("(xxxx)|") // cid .number("(d+)|") // temperature .number("(d+.d+)|") // odometer .number("d+|") // serial number @@ -107,7 +109,8 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { .number("(dddd)") // adc 2 .number("(ddd)") // temperature 1 .number("(ddd)") // temperature 2 - .number("(x{8})") // location code + .number("(xxxx)") // lac + .number("(xxxx)") // cid .expression("([AV])") // validity .number("(dd)") // satellites .number("(ddd)") // course @@ -185,7 +188,14 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_BATTERY, parser.next()); position.set(Event.KEY_POWER, parser.nextDouble()); position.set(Event.PREFIX_ADC + 1, parser.next()); - position.set(Event.KEY_LAC, parser.next()); + + int lac = parser.nextInt(16); + int cid = parser.nextInt(16); + if (lac != 0 && cid != 0) { + position.set(Event.KEY_LAC, lac); + position.set(Event.KEY_CID, cid); + } + position.set(Event.PREFIX_TEMP + 1, parser.next()); position.set(Event.KEY_ODOMETER, parser.next()); @@ -203,7 +213,8 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { position.set(Event.PREFIX_ADC + 2, parser.next()); position.set(Event.PREFIX_TEMP + 1, parser.next()); position.set(Event.PREFIX_TEMP + 2, parser.next()); - position.set(Event.KEY_LAC, parser.next()); + position.set(Event.KEY_LAC, parser.nextInt(16)); + position.set(Event.KEY_CID, parser.nextInt(16)); position.setValid(parser.next().equals("A")); position.set(Event.KEY_SATELLITES, parser.next()); |