aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-03-08 20:36:34 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-03-08 20:36:34 +1300
commit1cf3134cd4212462aec79419a7eac9fe053ac966 (patch)
treeb42dc56dfd42b7840244b86ec0b0157953b286ba
parent2ac31b5ba9de43474aca125260d143283afa9e91 (diff)
downloadtraccar-server-1cf3134cd4212462aec79419a7eac9fe053ac966.tar.gz
traccar-server-1cf3134cd4212462aec79419a7eac9fe053ac966.tar.bz2
traccar-server-1cf3134cd4212462aec79419a7eac9fe053ac966.zip
Fix Laipac protocol acknowledgement
-rw-r--r--src/org/traccar/protocol/LaipacProtocolDecoder.java32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/org/traccar/protocol/LaipacProtocolDecoder.java b/src/org/traccar/protocol/LaipacProtocolDecoder.java
index a0e394d2c..62bc8fa37 100644
--- a/src/org/traccar/protocol/LaipacProtocolDecoder.java
+++ b/src/org/traccar/protocol/LaipacProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2017 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.
@@ -91,21 +91,23 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder {
String type = parser.next();
String checksum = parser.next();
- String response = null;
-
- if (type.equals("0") && Character.isLowerCase(status.charAt(0))) {
- response = "$EAVACK,0," + checksum;
- response += Checksum.nmea(response);
- } else if (type.equals("S") || type.equals("T")) {
- response = "$AVCFG,00000000,t*21";
- } else if (type.equals("3")) {
- response = "$AVCFG,00000000,d*31";
- } else if (type.equals("X") || type.equals("4")) {
- response = "$AVCFG,00000000,x*2D";
- }
- if (response != null && channel != null) {
- channel.write(response + "\r\n");
+ if (channel != null) {
+
+ if (Character.isLowerCase(status.charAt(0))) {
+ String response = "$EAVACK," + type + "," + checksum;
+ response += Checksum.nmea(response);
+ channel.write(response);
+ }
+
+ if (type.equals("S") || type.equals("T")) {
+ channel.write("$AVCFG,00000000,t*21");
+ } else if (type.equals("3")) {
+ channel.write("$AVCFG,00000000,d*31");
+ } else if (type.equals("X") || type.equals("4")) {
+ channel.write("$AVCFG,00000000,x*2D");
+ }
+
}
return position;