diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-03-04 21:02:59 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-03-04 21:02:59 +1300 |
commit | f9187c8d4c8b9e147fcfbdf6ffaddbdfccddc88d (patch) | |
tree | 9e71ebd8a9f076285565ab2d3b2f0d9ddddff827 | |
parent | 5374aaf7948bf4a77fa11d3dfad777ee67923356 (diff) | |
download | trackermap-server-f9187c8d4c8b9e147fcfbdf6ffaddbdfccddc88d.tar.gz trackermap-server-f9187c8d4c8b9e147fcfbdf6ffaddbdfccddc88d.tar.bz2 trackermap-server-f9187c8d4c8b9e147fcfbdf6ffaddbdfccddc88d.zip |
Add aspicore support (fix #584)
-rw-r--r-- | src/org/traccar/protocol/T55ProtocolDecoder.java | 10 | ||||
-rw-r--r-- | test/org/traccar/protocol/T55ProtocolDecoderTest.java | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java index 0cd7ca1b7..72cb32816 100644 --- a/src/org/traccar/protocol/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/T55ProtocolDecoder.java @@ -107,6 +107,16 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { Log.warning("Unknown device - " + id); } } + + // Identification + else if (sentence.startsWith("IMEI")) { + String id = sentence.substring(5, sentence.length()); + try { + deviceId = getDataManager().getDeviceByImei(id).getId(); + } catch(Exception error) { + Log.warning("Unknown device - " + id); + } + } // Identification else if (Character.isDigit(sentence.charAt(0)) & sentence.length() == 15) { diff --git a/test/org/traccar/protocol/T55ProtocolDecoderTest.java b/test/org/traccar/protocol/T55ProtocolDecoderTest.java index 88e145cae..283a9c88e 100644 --- a/test/org/traccar/protocol/T55ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/T55ProtocolDecoderTest.java @@ -16,6 +16,8 @@ public class T55ProtocolDecoderTest { assertNull(decoder.decode(null, null, "$PGID,359853000144328*0F")); assertNull(decoder.decode(null, null, "$PCPTI,CradlePoint Test,184453,184453.0,6F*57")); + + assertNull(decoder.decode(null, null, "IMEI 351467108700000")); verify(decoder.decode(null, null, "$GPRMC,094907.000,A,6000.5332,N,03020.5192,E,1.17,60.26,091111,,*33")); @@ -40,6 +42,12 @@ public class T55ProtocolDecoderTest { verify(decoder.decode(null, null, "$TRCCR,20140111000000.000,A,60.000000,60.000000,0.00,0.00,0.00,50,*3a")); + + verify(decoder.decode(null, null, + "$GPRMC,125735.000,A,6010.34349,N,02445.72838,E,1.0,101.7,050509,6.9,W,A*1F")); + + verify(decoder.decode(null, null, + "$GPGGA,000000.000,6010.34349,N,02445.72838,E,1,05,1.7,0.9,M,35.1,M,,*59")); } |