From 58ade656e2070387f95984f5851cbc41990467ba Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 22 Jan 2018 19:33:56 +1300 Subject: Add new position constructor --- src/org/traccar/protocol/T55ProtocolDecoder.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/org/traccar/protocol/T55ProtocolDecoder.java') diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java index bfddf74ac..dbc467993 100644 --- a/src/org/traccar/protocol/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/T55ProtocolDecoder.java @@ -110,8 +110,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { return null; } - Position position = new Position(); - position.setProtocol(getProtocolName()); + Position position = new Position(getProtocolName()); if (deviceSession != null) { position.setDeviceId(deviceSession.getDeviceId()); @@ -165,8 +164,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { return null; } - Position position = new Position(); - position.setProtocol(getProtocolName()); + Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); DateBuilder dateBuilder = new DateBuilder() @@ -188,8 +186,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { return null; } - Position position = new Position(); - position.setProtocol(getProtocolName()); + Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); position.setTime(new Date()); @@ -209,8 +206,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { return null; } - Position position = new Position(); - position.setProtocol(getProtocolName()); + Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); position.setTime(parser.nextDateTime()); -- cgit v1.2.3 From 8874b4bf69f38ef94d70bef2a8e4d52e0845fa77 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 12 Mar 2018 00:51:46 +1300 Subject: Support STEPP 3 FALCOM messages --- src/org/traccar/protocol/T55ProtocolDecoder.java | 8 +++++--- test/org/traccar/protocol/T55ProtocolDecoderTest.java | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/org/traccar/protocol/T55ProtocolDecoder.java') diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java index dbc467993..be3cb5f67 100644 --- a/src/org/traccar/protocol/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/T55ProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2017 Anton Tananaev (anton@traccar.org) + * Copyright 2012 - 2018 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -250,9 +250,11 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { } else if (sentence.startsWith("$PCPTI")) { getDeviceSession(channel, remoteAddress, sentence.substring(7, sentence.indexOf(",", 7))); } else if (sentence.startsWith("IMEI")) { - getDeviceSession(channel, remoteAddress, sentence.substring(5, sentence.length())); + getDeviceSession(channel, remoteAddress, sentence.substring(5)); + } else if (sentence.startsWith("$IMEI")) { + getDeviceSession(channel, remoteAddress, sentence.substring(6)); } else if (sentence.startsWith("$GPFID")) { - deviceSession = getDeviceSession(channel, remoteAddress, sentence.substring(7, sentence.length())); + deviceSession = getDeviceSession(channel, remoteAddress, sentence.substring(7)); if (deviceSession != null && position != null) { Position position = this.position; position.setDeviceId(deviceSession.getDeviceId()); diff --git a/test/org/traccar/protocol/T55ProtocolDecoderTest.java b/test/org/traccar/protocol/T55ProtocolDecoderTest.java index 7f60a1807..ec699f111 100644 --- a/test/org/traccar/protocol/T55ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/T55ProtocolDecoderTest.java @@ -10,12 +10,18 @@ public class T55ProtocolDecoderTest extends ProtocolTest { T55ProtocolDecoder decoder = new T55ProtocolDecoder(new T55Protocol()); + verifyNull(decoder, text( + "$IMEI=355797031609284")); + verifyNull(decoder, text( "086415031C20")); verifyNull(decoder, text( "358244017671308")); + verifyPosition(decoder, text( + "$GPRMC,192350.000,V,0000.0000,N,00000.0000,E,,,110318,,*12")); + verifyPosition(decoder, text( "$GPRMC,073446.000,A,1255.5125,N,07738.2948,E,0.00,0.53,080316,D*71,11,865733027593268,1,090,086,123,456,789,987,12345")); -- cgit v1.2.3