aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-02-17 09:25:58 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-02-17 09:25:58 +1300
commitb7e24f5f74e658c2431f3a46b4c2cb1e912edfbe (patch)
tree484699e1a745b4e2a9e34be1ec29405e437e73f3
parent5ac7a4595d6b9f56cf2f43c2a623ee5ffeee2228 (diff)
downloadtrackermap-server-b7e24f5f74e658c2431f3a46b4c2cb1e912edfbe.tar.gz
trackermap-server-b7e24f5f74e658c2431f3a46b4c2cb1e912edfbe.tar.bz2
trackermap-server-b7e24f5f74e658c2431f3a46b4c2cb1e912edfbe.zip
Add Xexun Glonass support (fix #1082)
-rw-r--r--src/org/traccar/protocol/Xexun2ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/XexunFrameDecoder.java5
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java2
-rw-r--r--test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/XexunProtocolDecoderTest.java3
5 files changed, 12 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
index 3a9e1129e..ea2197b31 100644
--- a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
@@ -40,7 +40,7 @@ public class Xexun2ProtocolDecoder extends BaseProtocolDecoder {
"[\r\n]*" +
"(\\d+)," + // Serial
"([^,]+)?," + // Number
- "GPRMC," +
+ "G[PN]RMC," +
"(\\d{2})(\\d{2})(\\d{2})\\.(\\d+)," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
"(\\d{2})(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
diff --git a/src/org/traccar/protocol/XexunFrameDecoder.java b/src/org/traccar/protocol/XexunFrameDecoder.java
index 2dd9dad7d..1b3446ff9 100644
--- a/src/org/traccar/protocol/XexunFrameDecoder.java
+++ b/src/org/traccar/protocol/XexunFrameDecoder.java
@@ -38,7 +38,10 @@ public class XexunFrameDecoder extends FrameDecoder {
// Find start
Integer beginIndex = ChannelBufferTools.find(buf, 0, length, "GPRMC");
if (beginIndex == null) {
- return null;
+ beginIndex = ChannelBufferTools.find(buf, 0, length, "GNRMC");
+ if (beginIndex == null) {
+ return null;
+ }
}
// Find identifier
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index 01ce44964..dd9ed0528 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -38,7 +38,7 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
}
private static final Pattern pattern = Pattern.compile(
- "GPRMC," +
+ "G[PN]RMC," +
"(\\d{2})(\\d{2})(\\d{2}).(\\d+)," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
"(\\d+)(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
diff --git a/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java b/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java
index e6f4c4f80..bd8a40640 100644
--- a/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java
@@ -45,6 +45,9 @@ public class Xexun2ProtocolDecoderTest {
verify(decoder.decode(null, null,
"140602152533,TESCO_INFO,GPRMC,152533.000,A,5145.4275,N,00000.3448,E,0.00,0.00,020614,,,A*66,F,, imei:013227002781643,06,35.1,F:4.15V,1,135,38950,234,10,10B4,5235"));
+ verify(decoder.decode(null, null,
+ "150216154418,5277,GNRMC,134418.000,A,5533.8973,N,03745.4398,E,0.00,308.85,160215,,,A*7A,F,, imei:864244028033115,10,169.8,F:4.28V,1,132,48269,250,99,6D0D,8572"));
+
}
}
diff --git a/test/org/traccar/protocol/XexunProtocolDecoderTest.java b/test/org/traccar/protocol/XexunProtocolDecoderTest.java
index d81dbcf16..b1f019721 100644
--- a/test/org/traccar/protocol/XexunProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/XexunProtocolDecoderTest.java
@@ -31,6 +31,9 @@ public class XexunProtocolDecoderTest {
verify(decoder.decode(null, null,
"GPRMC,220828.678,A,5206.1446,N,02038.2403,,0,0,160912,,,E*23,L,imei:358948012501019,"));
+
+ verify(decoder.decode(null, null,
+ "GNRMC,134418.000,A,5533.8973,N,03745.4398,E,0.00,308.85,160215,,,A*7A,F,, imei:864244028033115,"));
}