aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-05-10 19:00:58 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2014-05-10 19:00:58 +1200
commit002f3d47cc4a31268dd2c0b018f70a0042268e0d (patch)
treea894196aa5428e141c2da616a1d41f020feff0fe /src/org/traccar/protocol
parent7ca0f09a4f07ece35e3294f9c22206205940440a (diff)
downloadtrackermap-server-002f3d47cc4a31268dd2c0b018f70a0042268e0d.tar.gz
trackermap-server-002f3d47cc4a31268dd2c0b018f70a0042268e0d.tar.bz2
trackermap-server-002f3d47cc4a31268dd2c0b018f70a0042268e0d.zip
Extend Meitrack protocol
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index ac72ea9d0..e2f31b207 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -37,7 +37,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
"\\$\\$." + // Flag
"\\d+," + // Length
"(\\d+)," + // IMEI
- "[0-9a-fA-F]{3}," + // Command
+ "\\p{XDigit}{3}," + // Command
"(\\d+)," + // Event
"(-?\\d+\\.\\d+)," + // Latitude
"(-?\\d+\\.\\d+)," + // Longitude
@@ -51,6 +51,14 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
"(\\d+\\.?\\d*)," + // HDOP
"(-?\\d+)," + // Altitude
"(\\d+)," + // Milage
+ "(\\d+)," + // Runtime
+ "(\\d+\\|\\d+\\|\\p{XDigit}+\\|\\p{XDigit}+)," + // Cell
+ "(\\p{XDigit}+)," + // State
+ "(\\p{XDigit}+)\\|" + // ADC1
+ "(\\p{XDigit}+)\\|" + // ADC2
+ "(\\p{XDigit}+)?\\|" + // ADC3
+ "(\\p{XDigit}+)\\|" + // Battery
+ "(\\p{XDigit}+)," + // Power
".*"); // TODO: parse other stuff
@Override
@@ -119,9 +127,22 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
// Altitude
position.setAltitude(Double.valueOf(parser.group(index++)));
- // Milage
+ // Other
extendedInfo.set("milage", parser.group(index++));
-
+ extendedInfo.set("runtime", parser.group(index++));
+ extendedInfo.set("cell", parser.group(index++));
+ extendedInfo.set("state", parser.group(index++));
+
+ // ADC
+ extendedInfo.set("adc1", Integer.parseInt(parser.group(index++), 16));
+ extendedInfo.set("adc2", Integer.parseInt(parser.group(index++), 16));
+ String adc3 = parser.group(index++);
+ if (adc3 != null) {
+ extendedInfo.set("adc3", Integer.parseInt(adc3, 16));
+ }
+ extendedInfo.set("battery", Integer.parseInt(parser.group(index++), 16));
+ extendedInfo.set("power", Integer.parseInt(parser.group(index++), 16));
+
// Extended info
position.setExtendedInfo(extendedInfo.toString());