From f9187c8d4c8b9e147fcfbdf6ffaddbdfccddc88d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 4 Mar 2014 21:02:59 +1300 Subject: Add aspicore support (fix #584) --- src/org/traccar/protocol/T55ProtocolDecoder.java | 10 ++++++++++ test/org/traccar/protocol/T55ProtocolDecoderTest.java | 8 ++++++++ 2 files changed, 18 insertions(+) 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")); } -- cgit v1.2.3