aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-10-26 21:30:46 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2012-10-26 21:30:46 +1300
commit50bba1160c091e844a471b010dbe3835ca11a207 (patch)
tree2040b218354aaf237da1a13a90c97572a6cb1977
parentadd041a617fb105c2e17f9dd0266522d1034390f (diff)
downloadtrackermap-server-50bba1160c091e844a471b010dbe3835ca11a207.tar.gz
trackermap-server-50bba1160c091e844a471b010dbe3835ca11a207.tar.bz2
trackermap-server-50bba1160c091e844a471b010dbe3835ca11a207.zip
Pull from williamchitto
-rw-r--r--src/org/traccar/protocol/ST210ProtocolDecoder.java10
-rw-r--r--test/org/traccar/protocol/ST210ProtocolDecoderTest.java8
2 files changed, 15 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/ST210ProtocolDecoder.java b/src/org/traccar/protocol/ST210ProtocolDecoder.java
index 3d176098e..9418293fc 100644
--- a/src/org/traccar/protocol/ST210ProtocolDecoder.java
+++ b/src/org/traccar/protocol/ST210ProtocolDecoder.java
@@ -46,7 +46,7 @@ public class ST210ProtocolDecoder extends GenericProtocolDecoder {
MSG_NUM("(\\d{4});","Message number - After 9999 is reported, message number returns to 0000"),
EMG_ID("(\\d);", "Emergency type"),
EVT_ID("(\\d);", "Event type"),
- ALERT_ID("(\\d);", "Alert type");
+ ALERT_ID("(\\d+);", "Alert type");
private String pattern;
@@ -94,6 +94,10 @@ public class ST210ProtocolDecoder extends GenericProtocolDecoder {
case SPD:
position.setSpeed(Double.valueOf(groupValue));
break;
+
+ case MODE:
+ //position.setMode(Integer.parseInt(groupValue));
+ break;
case DATE: {
// Date
@@ -107,7 +111,7 @@ public class ST210ProtocolDecoder extends GenericProtocolDecoder {
ret.setTimeInMillis(time.getTimeInMillis() +
TimeZone.getTimeZone("UTC").getOffset(time.getTimeInMillis()) -
- TimeZone.getDefault().getOffset(time.getTimeInMillis()));*/
+ TimeZone.getDefault().getOffset(time.getTimeInMillis()));*/
position.setTime(time.getTime());
@@ -128,7 +132,7 @@ public class ST210ProtocolDecoder extends GenericProtocolDecoder {
ret.setTimeInMillis(time.getTimeInMillis() +
TimeZone.getTimeZone("UTC").getOffset(time.getTimeInMillis()) -
- TimeZone.getDefault().getOffset(time.getTimeInMillis()));*/
+ TimeZone.getDefault().getOffset(time.getTimeInMillis()));*/
position.setTime(time.getTime());
diff --git a/test/org/traccar/protocol/ST210ProtocolDecoderTest.java b/test/org/traccar/protocol/ST210ProtocolDecoderTest.java
index 8b083bdcc..0a1b11e67 100644
--- a/test/org/traccar/protocol/ST210ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/ST210ProtocolDecoderTest.java
@@ -13,6 +13,7 @@ public class ST210ProtocolDecoderTest {
ST210ProtocolDecoder decoder = new ST210ProtocolDecoder(
new TestDataManager(), 0);
+ //Status
assertNotNull(decoder
.decode(null,
null,
@@ -33,14 +34,21 @@ public class ST210ProtocolDecoderTest {
.decode(null,
null,
"SA200STT;315198;042;20120809;13:43:34;4f310;-15.618709;-056.083223;000.025;000.00;8;1;49;12.10;100000;2;0231"));
+ //Emergency
assertNotNull(decoder
.decode(null,
null,
"SA200EMG;317652;042;20120718;15:35:41;16d41;-15.618740;-056.083252;000.034;000.00;8;1;41548;12.17;110000;1"));
+ //Alive
assertNull(decoder
.decode(null,
null,
"SA200ALV;317652"));
+ //Alert
+ assertNotNull(decoder
+ .decode(null,
+ null,
+ "SA200ALT;317652;042;20120829;14:25:58;16d41;-15.618770;-056.083242;000.029;000.00;0;0;2404240;0.00;000000;10"));
}
}