aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-07-27 08:16:18 +0200
committerAnton Tananaev <anton.tananaev@gmail.com>2014-07-27 08:16:18 +0200
commit52315f99445c347b421dcae6a4c977d79d756b6a (patch)
tree317c43ed84badc93cdf8fe21df474b0fa4c6fa79
parent203b948f62d231a3e572c969477ac9ccfe09beae (diff)
downloadtrackermap-server-52315f99445c347b421dcae6a4c977d79d756b6a.tar.gz
trackermap-server-52315f99445c347b421dcae6a4c977d79d756b6a.tar.bz2
trackermap-server-52315f99445c347b421dcae6a4c977d79d756b6a.zip
Fix regex pattern (fix #784)
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index 9e30b885a..490d44226 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -61,7 +61,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
"(\\d+\\|\\d+\\|\\p{XDigit}+\\|\\p{XDigit}+)," + // Cell
"(\\p{XDigit}+)," + // State
"(\\p{XDigit}+)\\|" + // ADC1
- "(\\p{XDigit}+)\\|" + // ADC2
+ "(\\p{XDigit}+)?\\|" + // ADC2
"(\\p{XDigit}+)?\\|" + // ADC3
"(\\p{XDigit}+)\\|" + // Battery
"(\\p{XDigit}+)," + // Power
@@ -138,7 +138,10 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
// ADC
extendedInfo.set("adc1", Integer.parseInt(parser.group(index++), 16));
- extendedInfo.set("adc2", Integer.parseInt(parser.group(index++), 16));
+ String adc2 = parser.group(index++);
+ if (adc2 != null) {
+ extendedInfo.set("adc2", Integer.parseInt(adc2, 16));
+ }
String adc3 = parser.group(index++);
if (adc3 != null) {
extendedInfo.set("adc3", Integer.parseInt(adc3, 16));