diff options
-rw-r--r-- | pom.xml | 4 | ||||
-rw-r--r-- | setup/windows/traccar.iss | 2 | ||||
-rw-r--r-- | src/org/traccar/protocol/MeiligaoProtocolDecoder.java | 1 | ||||
-rw-r--r-- | src/org/traccar/protocol/ST210ProtocolDecoder.java | 38 | ||||
-rwxr-xr-x | test.sh | 10 | ||||
-rw-r--r-- | test/org/traccar/protocol/ST210ProtocolDecoderTest.java | 66 |
6 files changed, 61 insertions, 60 deletions
@@ -3,7 +3,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.traccar</groupId> <artifactId>traccar</artifactId> - <version>1.1-SNAPSHOT</version> + <version>1.2-SNAPSHOT</version> <name>traccar</name> <url>http://www.traccar.org</url> @@ -22,7 +22,7 @@ <dependency> <groupId>io.netty</groupId> <artifactId>netty</artifactId> - <version>3.5.2.Final</version> + <version>3.5.4.Final</version> </dependency> <dependency> diff --git a/setup/windows/traccar.iss b/setup/windows/traccar.iss index fc9ccfc99..37eaf29e7 100644 --- a/setup/windows/traccar.iss +++ b/setup/windows/traccar.iss @@ -1,6 +1,6 @@ [Setup]
AppName=Traccar
-AppVersion=1.1
+AppVersion=1.2
DefaultDirName={pf}\Traccar
AlwaysRestart=yes
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index db007f936..6b48b41fa 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -112,6 +112,7 @@ public class MeiligaoProtocolDecoder extends GenericProtocolDecoder { if (channel != null) { channel.write(sendBuf); } + return null; } // Data offset diff --git a/src/org/traccar/protocol/ST210ProtocolDecoder.java b/src/org/traccar/protocol/ST210ProtocolDecoder.java index d41a78da5..3d176098e 100644 --- a/src/org/traccar/protocol/ST210ProtocolDecoder.java +++ b/src/org/traccar/protocol/ST210ProtocolDecoder.java @@ -16,15 +16,15 @@ import org.traccar.model.DataManager; import org.traccar.model.Position; public class ST210ProtocolDecoder extends GenericProtocolDecoder { - + public ST210ProtocolDecoder(DataManager dataManager, Integer resetDelay) { - super(dataManager, resetDelay); - } + super(dataManager, resetDelay); + } - private enum ST210FIELDS { - HDR_STATUS("SA200STT;","Status Report"), - HDR_EMERGENCY("SA200EMG;","Emergency Report"), + private enum ST210FIELDS { + HDR_STATUS("SA200STT;","Status Report"), + HDR_EMERGENCY("SA200EMG;","Emergency Report"), HDR_EVENT("SA200EVT;", "Event Report"), HDR_ALERT("SA200ALT;","Alert Report"), HDR_ALIVE("SA200ALV;","Alive Report"), @@ -103,13 +103,13 @@ public class ST210ProtocolDecoder extends GenericProtocolDecoder { time.set(Calendar.MONTH, Integer.valueOf(Integer.valueOf(groupValue.substring(4, 6))-1)); time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(Integer.valueOf(groupValue.substring(6, 8)))); - Calendar ret = new GregorianCalendar(TimeZone.getTimeZone("UTC")); + /*Calendar ret = new GregorianCalendar(TimeZone.getTimeZone("UTC")); ret.setTimeInMillis(time.getTimeInMillis() + - TimeZone.getTimeZone("UTC").getOffset(time.getTimeInMillis()) - - TimeZone.getDefault().getOffset(time.getTimeInMillis())); + TimeZone.getTimeZone("UTC").getOffset(time.getTimeInMillis()) - + TimeZone.getDefault().getOffset(time.getTimeInMillis()));*/ - position.setTime(ret.getTime()); + position.setTime(time.getTime()); break; } @@ -124,13 +124,13 @@ public class ST210ProtocolDecoder extends GenericProtocolDecoder { time.set(Calendar.MINUTE, Integer.valueOf(Integer.valueOf(groupValue.substring(3, 5)))); time.set(Calendar.SECOND, Integer.valueOf(Integer.valueOf(groupValue.substring(6, 8)))); - Calendar ret = new GregorianCalendar(TimeZone.getTimeZone("UTC")); + /*Calendar ret = new GregorianCalendar(TimeZone.getTimeZone("UTC")); ret.setTimeInMillis(time.getTimeInMillis() + - TimeZone.getTimeZone("UTC").getOffset(time.getTimeInMillis()) - - TimeZone.getDefault().getOffset(time.getTimeInMillis())); + TimeZone.getTimeZone("UTC").getOffset(time.getTimeInMillis()) - + TimeZone.getDefault().getOffset(time.getTimeInMillis()));*/ - position.setTime(ret.getTime()); + position.setTime(time.getTime()); break; } @@ -488,7 +488,7 @@ public class ST210ProtocolDecoder extends GenericProtocolDecoder { } if(patternStr.endsWith(";")){ - patternStr = patternStr.substring(0, patternStr.length()-1); + patternStr = patternStr.substring(0, patternStr.length()-1); } return Pattern.compile(patternStr); @@ -610,11 +610,11 @@ public class ST210ProtocolDecoder extends GenericProtocolDecoder { Position position = null; try{ - position = decodeMsg(sentence); - Log.info("MESSAGE DECODED WITH SUCCESS!"); + position = decodeMsg(sentence); + Log.info("MESSAGE DECODED WITH SUCCESS!"); } catch(Exception e){ - Log.severe("ERROR WHILE DECODING MESSAGE: " + e.getMessage()); + Log.severe("ERROR WHILE DECODING MESSAGE: " + e.getMessage()); } return position; @@ -635,7 +635,7 @@ public class ST210ProtocolDecoder extends GenericProtocolDecoder { } if(report.equals(ST210REPORTS.ALIVE)){ - return null; + return null; } // Create new position @@ -2,6 +2,7 @@ # testing data: # imei - 123456789012345 +# id - 123456 (trackers that dont send imei) # time - 12:0X (where X is different for each tracker) # server - localhost # ports - default @@ -36,11 +37,10 @@ echo "8. enfora" (echo -n -e "\x00\x71\x00\x04\x02\x00 123456789012345 13 \$GPRMC,120800.00,A,6000.000000,N,13000.000000,E,0.0,0.0,010112,,,A*52\r\n";) | nc -v localhost 5008 echo "9. meiligao" -(echo -n -e "\x24\x24\x00\x11\x12\x34\x56\xFF\xFF\xFF\xFF\x50\x00\x8B\x9B\x0D\x0A";) | nc -v localhost 5009 - -echo "10. st210" -(echo -n -e "SA200STT;317652;042;20120807;10:43:23;16d41;-15.618767;-056.083214;000.011;000.00;11;1;41557;12.21;000000;1;3205\r";) | nc -v localhost 8801 - +(echo -n -e "\$\$\x00\x60\x12\x34\x56\xFF\xFF\xFF\xFF\x99\x55120900.000,A,6000.0000,N,13000.0000,E,0.00,,010112,,*1C|11.5|194|0000|0000,0000\x69\x62\x0D\x0A";) | nc -v localhost 5009 +echo "10. maxon" +echo "11. st210" +(echo -n -e "SA200STT;123456;042;20120101;12:11:00;16d41;-15.618767;-056.083214;000.011;000.00;11;1;41557;12.21;000000;1;3205\r";) | nc -v localhost 5011 diff --git a/test/org/traccar/protocol/ST210ProtocolDecoderTest.java b/test/org/traccar/protocol/ST210ProtocolDecoderTest.java index 403b5621a..8b083bdcc 100644 --- a/test/org/traccar/protocol/ST210ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/ST210ProtocolDecoderTest.java @@ -7,40 +7,40 @@ import org.junit.Test; public class ST210ProtocolDecoderTest { - @Test - public void testDecode() throws Exception { + @Test + public void testDecode() throws Exception { - ST210ProtocolDecoder decoder = new ST210ProtocolDecoder( - new TestDataManager(), 0); + ST210ProtocolDecoder decoder = new ST210ProtocolDecoder( + new TestDataManager(), 0); - assertNotNull(decoder - .decode(null, - null, - "SA200STT;317652;042;20120718;15:37:12;16d41;-15.618755;-056.083241;000.024;000.00;8;1;41548;12.17;100000;2;1979")); - assertNotNull(decoder - .decode(null, - null, - "SA200STT;317652;042;20120721;19:04:30;16d41;-15.618743;-056.083221;000.001;000.00;12;1;41557;12.21;000000;1;3125")); - assertNotNull(decoder - .decode(null, - null, - "SA200STT;317652;042;20120722;00:24:23;4f310;-15.618767;-056.083214;000.011;000.00;11;1;41557;12.21;000000;1;3205")); - assertNotNull(decoder - .decode(null, - null, - "SA200STT;315198;042;20120808;20:37:34;3fac25;-15.618731;-056.083216;000.007;000.00;12;1;48;0.00;000000;1;0127")); - assertNotNull(decoder - .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")); - 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")); - assertNull(decoder - .decode(null, - null, - "SA200ALV;317652")); - } + assertNotNull(decoder + .decode(null, + null, + "SA200STT;317652;042;20120718;15:37:12;16d41;-15.618755;-056.083241;000.024;000.00;8;1;41548;12.17;100000;2;1979")); + assertNotNull(decoder + .decode(null, + null, + "SA200STT;317652;042;20120721;19:04:30;16d41;-15.618743;-056.083221;000.001;000.00;12;1;41557;12.21;000000;1;3125")); + assertNotNull(decoder + .decode(null, + null, + "SA200STT;317652;042;20120722;00:24:23;4f310;-15.618767;-056.083214;000.011;000.00;11;1;41557;12.21;000000;1;3205")); + assertNotNull(decoder + .decode(null, + null, + "SA200STT;315198;042;20120808;20:37:34;3fac25;-15.618731;-056.083216;000.007;000.00;12;1;48;0.00;000000;1;0127")); + assertNotNull(decoder + .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")); + 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")); + assertNull(decoder + .decode(null, + null, + "SA200ALV;317652")); + } } |