aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-02-25 16:23:13 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-02-25 16:23:13 +1300
commitfddcc3fd41423720ab5034ec527af8086e301e0a (patch)
tree1d22864a073bcebe366569b53603ebdf48b63c44 /src/org/traccar
parentc2248f7d46c992f24205f28622ccc72f7fc20b9c (diff)
downloadtraccar-server-fddcc3fd41423720ab5034ec527af8086e301e0a.tar.gz
traccar-server-fddcc3fd41423720ab5034ec527af8086e301e0a.tar.bz2
traccar-server-fddcc3fd41423720ab5034ec527af8086e301e0a.zip
Implement Meiligao odometer decoding
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index cb2139a00..5c17aab61 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -54,23 +54,19 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
.number("|(xxxx)?") // state
.groupBegin()
.number("|(xxxx),(xxxx)") // adc
+ .number("(?:,(xxxx),(xxxx),(xxxx),(xxxx),(xxxx),(xxxx))?")
.groupBegin()
- .number(",(xxxx),(xxxx),(xxxx),(xxxx),(xxxx),(xxxx)")
- .groupEnd("?")
- .groupBegin()
- .text("|")
- .groupBegin()
- .number("(x{16})") // cell
+ .number("|x{16}") // cell
.number("|(xx)") // gsm
- .number("|(x{8})|") // odometer
- .number("(x{9})") // odometer
+ .number("|(x{8})") // odometer
+ .or()
+ .number("|(x{9})") // odometer
.groupBegin()
.number("|(x{5,})") // rfid
.groupEnd("?")
.groupEnd("?")
.groupEnd("?")
.groupEnd("?")
- .groupEnd("?")
.any()
.compile();
@@ -283,15 +279,14 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
}
}
- position.set(Event.KEY_CID, parser.next());
-
if (parser.hasNext()) {
position.set(Event.KEY_GSM, parser.nextInt(16));
}
if (parser.hasNext()) {
position.set(Event.KEY_ODOMETER, parser.nextInt(16));
- } else if (parser.hasNext()) {
+ }
+ if (parser.hasNext()) {
position.set(Event.KEY_ODOMETER, parser.nextInt(16));
}