aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net/sourceforge/opentracking/TrackerEventHandler.java10
-rw-r--r--src/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoder.java2
-rw-r--r--test/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoderTest.java3
3 files changed, 14 insertions, 1 deletions
diff --git a/src/net/sourceforge/opentracking/TrackerEventHandler.java b/src/net/sourceforge/opentracking/TrackerEventHandler.java
index d052cb86e..7bd3f5501 100644
--- a/src/net/sourceforge/opentracking/TrackerEventHandler.java
+++ b/src/net/sourceforge/opentracking/TrackerEventHandler.java
@@ -44,7 +44,15 @@ public class TrackerEventHandler extends SimpleChannelHandler {
Position position = (Position) e.getMessage();
- System.out.println("id: " + position.getDeviceId() + ", lat: " + position.getLatitude() + ", lon: " + position.getLongitude() );
+ System.out.println(
+ "id: " + position.getId() +
+ ", deviceId: " + position.getDeviceId() +
+ ", valid: " + position.getValid() +
+ ", time: " + position.getTime() +
+ ", latitude: " + position.getLatitude() +
+ ", longitude: " + position.getLongitude() +
+ ", speed: " + position.getSpeed() +
+ ", course: " + position.getCourse());
// Write position to database
try {
diff --git a/src/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoder.java b/src/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoder.java
index 15cb99f55..7b21a1a72 100644
--- a/src/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoder.java
+++ b/src/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoder.java
@@ -112,6 +112,8 @@ public class XexunProtocolDecoder extends OneToOneDecoder {
String course = parser.group(index++);
if (course != null) {
position.setCourse(Double.valueOf(course));
+ } else {
+ position.setCourse(0.0);
}
// Date
diff --git a/test/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoderTest.java b/test/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoderTest.java
index 23ef128ec..efbd020ed 100644
--- a/test/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoderTest.java
+++ b/test/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoderTest.java
@@ -35,6 +35,9 @@ public class XexunProtocolDecoderTest {
"imei:10000000000000,";
//"GPRMC,233842.000,A,5001.3060,N,01429.3243,E,0.00,,210211,,,A*74,F," +
//"imei:354776030495631,";
+ //1103100803,+79629503178,
+ //"GPRMC,080303.000,A,5546.7313,N,03738.6005,E,0.56,160.13,100311,,,A*6A,L," +
+ //"imei:354778030461167,";
XexunProtocolDecoder decoder = new XexunProtocolDecoder(new TestDataManager());
Position position = (Position) decoder.decode(null, null, testMsg);