aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java15
-rw-r--r--test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java3
2 files changed, 14 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 9a5cfb134..1d2b6584d 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -38,6 +38,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
}
//"134743.003,A,0648.9866,S,10707.5795,E,000.0,000.0,260313"
+ //,,*38|0.8|245|2000|03F6,0000,0000,001C,0000,0000,0000,0000|0194000201CC627C|1A|01160849yt
/**
* Regular expressions pattern
@@ -56,6 +57,9 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
"(\\d+\\.?\\d*)\\|)?" + // Altitude
"([0-9a-fA-F]+)?" + // State
"(?:\\|([0-9a-fA-F]+),([0-9a-fA-F]+))?" + // ADC
+ "(?:,([0-9a-fA-F]+),([0-9a-fA-F]+)" +
+ ",([0-9a-fA-F]+),([0-9a-fA-F]+)" +
+ ",([0-9a-fA-F]+),([0-9a-fA-F]+))?" +
"(?:\\|([0-9a-fA-F]+))?" + // Cell
"(?:\\|([0-9a-fA-F]+))?" + // Signal
"(?:\\|([0-9a-fA-F]+))?" + // Milage
@@ -196,9 +200,12 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
position.setTime(time.getTime());
// Dilution of precision
- extendedInfo.append("<hdop>");
- extendedInfo.append(parser.group(index++));
- extendedInfo.append("</hdop>");
+ String hdop = parser.group(index++);
+ if (hdop != null) {
+ extendedInfo.append("<hdop>");
+ extendedInfo.append(hdop);
+ extendedInfo.append("</hdop>");
+ }
// Altitude
String altitude = parser.group(index++);
@@ -217,7 +224,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
}
// ADC
- for (int i = 1; i <= 2; i++) {
+ for (int i = 1; i <= 8; i++) {
String adc = parser.group(index++);
if (adc != null) {
extendedInfo.append("<adc").append(i).append(">");
diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
index 66ce51b73..00c0412c6 100644
--- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
@@ -42,6 +42,9 @@ public class MeiligaoProtocolDecoderTest {
byte[] buf9 = {0x35,0x11,0x11,0x11,0x11,0x11,0x11,(byte)0x99,0x55,0x31,0x33,0x34,0x37,0x34,0x33,0x2e,0x30,0x30,0x33,0x2c,0x41,0x2c,0x30,0x36,0x34,0x38,0x2e,0x39,0x38,0x36,0x36,0x2c,0x53,0x2c,0x31,0x30,0x37,0x30,0x37,0x2e,0x35,0x37,0x39,0x35,0x2c,0x45,0x2c,0x30,0x30,0x30,0x2e,0x30,0x2c,0x30,0x30,0x30,0x2e,0x30,0x2c,0x32,0x36,0x30,0x33,0x31,0x33,(byte)0xf3,0x15,0x0d,0x0a};
assertNotNull(decoder.decode(null, null, factory.getBuffer(buf9, 0, buf9.length)));
+ byte[] buf10 = {0x00,(byte)0x91,(byte)0x80,0x03,0x69,0x76,0x41,(byte)0x99,0x55,0x30,0x38,0x35,0x31,0x33,0x30,0x2e,0x30,0x30,0x30,0x2c,0x41,0x2c,0x33,0x30,0x35,0x33,0x2e,0x31,0x36,0x34,0x35,0x2c,0x4e,0x2c,0x30,0x37,0x35,0x35,0x35,0x2e,0x37,0x34,0x37,0x36,0x2c,0x45,0x2c,0x30,0x2e,0x30,0x30,0x2c,0x32,0x37,0x2c,0x31,0x36,0x30,0x34,0x31,0x33,0x2c,0x2c,0x2a,0x33,0x46,0x7c,0x30,0x2e,0x38,0x7c,0x32,0x34,0x35,0x7c,0x32,0x30,0x30,0x30,0x7c,0x30,0x33,0x46,0x37,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x31,0x42,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x7c,0x30,0x31,0x39,0x34,0x30,0x30,0x30,0x32,0x30,0x31,0x43,0x43,0x36,0x32,0x37,0x43,0x7c,0x31,0x41,0x7c,0x30,0x31,0x31,0x36,0x30,0x38,0x34,0x39,(byte)0xe6,(byte)0xa7,0x0d,0x0a};
+ assertNotNull(decoder.decode(null, null, factory.getBuffer(buf10, 0, buf10.length)));
+
}
}