aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-09-30 00:29:48 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2014-09-30 00:29:48 +1300
commitce00123fd32fdb9fab126ee7ba2e7f16d616ea3d (patch)
tree2230218cbf24e02e2b89347b6c34b1ec98a90545 /src/org/traccar
parentb1fd39287427aaf16768ee697263cb2aa872f1c9 (diff)
downloadtrackermap-server-ce00123fd32fdb9fab126ee7ba2e7f16d616ea3d.tar.gz
trackermap-server-ce00123fd32fdb9fab126ee7ba2e7f16d616ea3d.tar.bz2
trackermap-server-ce00123fd32fdb9fab126ee7ba2e7f16d616ea3d.zip
Fix Meitrack decoder
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index 490d44226..166c77e60 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -39,11 +39,14 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ //$$J163,123123123123123,AFF,0004,35,58.588926,16.180473,140928192856,A,10,27,0,161,1.2,19
+ //,1648894,435695,240|24|88B9|E435,0000,|||0A22|0000,00000001,,50,,,,,,,,,,,,,*70\r\n
private static final Pattern pattern = Pattern.compile(
"\\$\\$." + // Flag
"\\d+," + // Length
"(\\d+)," + // IMEI
"\\p{XDigit}{3}," + // Command
+ "(?:\\d+,)?" +
"(\\d+)," + // Event
"(-?\\d+\\.\\d+)," + // Latitude
"(-?\\d+\\.\\d+)," + // Longitude
@@ -60,11 +63,11 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
"(\\d+)," + // Runtime
"(\\d+\\|\\d+\\|\\p{XDigit}+\\|\\p{XDigit}+)," + // Cell
"(\\p{XDigit}+)," + // State
- "(\\p{XDigit}+)\\|" + // ADC1
+ "(\\p{XDigit}+)?\\|" + // ADC1
"(\\p{XDigit}+)?\\|" + // ADC2
"(\\p{XDigit}+)?\\|" + // ADC3
"(\\p{XDigit}+)\\|" + // Battery
- "(\\p{XDigit}+)," + // Power
+ "(\\p{XDigit}+)," + // Power*/
".*(\r\n)?");
private Position decodeRegularMessage(Channel channel, ChannelBuffer buf) {
@@ -137,7 +140,10 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("state", parser.group(index++));
// ADC
- extendedInfo.set("adc1", Integer.parseInt(parser.group(index++), 16));
+ String adc1 = parser.group(index++);
+ if (adc1 != null) {
+ extendedInfo.set("adc1", Integer.parseInt(adc1, 16));
+ }
String adc2 = parser.group(index++);
if (adc2 != null) {
extendedInfo.set("adc2", Integer.parseInt(adc2, 16));