aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-11-06 23:08:22 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2012-11-06 23:08:22 +1300
commit85317819e2ff62941ecc76031248792b430ac0b3 (patch)
tree37a77667ccc3c28fe4261a9088bc5cae006d3110 /src/org/traccar
parentf629297ceecfd6fb1ad64adf1549980d30e0343f (diff)
downloadtraccar-server-85317819e2ff62941ecc76031248792b430ac0b3.tar.gz
traccar-server-85317819e2ff62941ecc76031248792b430ac0b3.tar.bz2
traccar-server-85317819e2ff62941ecc76031248792b430ac0b3.zip
Add course to gps103 protocol
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 020feb6f6..4c8c4255c 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -47,13 +47,14 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder {
"(\\d{2})(\\d{2})(\\d{2})\\d+," + // Date
"[^,]*," +
"[FL]," + // F - full / L - low
- "(\\d{2})(\\d{2})(\\d{2}).(\\d{3})," + // Time (HHMMSS.SSS)
+ "(\\d{2})(\\d{2})(\\d{2})\\.(\\d{3})," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
- "(\\d{2})(\\d{2}.\\d{4})," + // Latitude (DDMM.MMMM)
+ "(\\d{2})(\\d{2}\\.\\d{4})," + // Latitude (DDMM.MMMM)
"([NS])," +
- "(\\d{3})(\\d{2}.\\d{4})," + // Longitude (DDDMM.MMMM)
+ "(\\d{3})(\\d{2}\\.\\d{4})," + // Longitude (DDDMM.MMMM)
"([EW])?," +
"(\\d+\\.?\\d*)," + // Speed
+ "(\\d+\\.\\d+)?" + // Course
".*");
/**
@@ -135,7 +136,14 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder {
// Speed
position.setSpeed(Double.valueOf(parser.group(index++)));
- position.setCourse(0.0);
+
+ // Course
+ String course = parser.group(index++);
+ if (course != null) {
+ position.setCourse(Double.valueOf(course));
+ } else {
+ position.setCourse(0.0);
+ }
// Extended info
position.setExtendedInfo(extendedInfo.toString());