From 9379a48aee811cf6fe467581778c07ee253c195f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 4 Sep 2017 03:55:55 +1200 Subject: Implement proper TRV response --- src/org/traccar/protocol/TrvProtocolDecoder.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/TrvProtocolDecoder.java b/src/org/traccar/protocol/TrvProtocolDecoder.java index 88ac76134..1783bce73 100644 --- a/src/org/traccar/protocol/TrvProtocolDecoder.java +++ b/src/org/traccar/protocol/TrvProtocolDecoder.java @@ -84,11 +84,14 @@ public class TrvProtocolDecoder extends BaseProtocolDecoder { String type = sentence.substring(id.length(), id.length() + 4); if (channel != null) { + String responseHeader = id + (char) (type.charAt(0) + 1) + type.substring(1); if (type.equals("AP00") && id.equals("IW")) { String time = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); - channel.write(id + (char) (type.charAt(0) + 1) + type.substring(1) + "," + time + ",0#"); + channel.write(responseHeader + "," + time + ",0#"); + } else if (type.equals("AP14")) { + channel.write(responseHeader + ",0.000,0.000#"); } else { - channel.write(id + (char) (type.charAt(0) + 1) + type.substring(1) + "#"); + channel.write(responseHeader + "#"); } } -- cgit v1.2.3