aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-11-17 07:32:33 -0800
committerAnton Tananaev <anton@traccar.org>2023-11-17 07:32:33 -0800
commite62f2e19b8f07af2a37f5e2cfe4c380c31b5c7db (patch)
tree43bfd002e2675414b2284a527b67aebde3002da8
parent962371fe50c9f2189ee5452def16c6fbd09a63f5 (diff)
downloadtrackermap-server-e62f2e19b8f07af2a37f5e2cfe4c380c31b5c7db.tar.gz
trackermap-server-e62f2e19b8f07af2a37f5e2cfe4c380c31b5c7db.tar.bz2
trackermap-server-e62f2e19b8f07af2a37f5e2cfe4c380c31b5c7db.zip
Support Rinho Telematics protocol
-rw-r--r--src/main/java/org/traccar/protocol/TaipProtocolDecoder.java13
-rw-r--r--src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java3
2 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java b/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java
index 787ed1599..831910ab6 100644
--- a/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2021 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2023 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.
@@ -83,7 +83,7 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
.or()
.groupBegin()
.number("(xx)") // input
- .number("(xx)") // satellites
+ .number("xx") // satellites / outputs
.number("(ddd)") // battery
.number("(x{8})") // odometer
.number("[01]") // gps power
@@ -95,12 +95,14 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
.number("[01]") // modem power
.number("[0-5]") // gsm status
.number("(dd)") // rssi
+ .groupBegin()
.number("([-+]dddd)") // temperature 1
.number("xx") // seconds from last
.number("([-+]dddd)") // temperature 2
.number("xx") // seconds from last
.groupEnd("?")
.groupEnd("?")
+ .groupEnd("?")
.groupEnd()
.any()
.compile();
@@ -216,17 +218,18 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_HDOP, parser.nextInt());
}
- if (parser.hasNext(4)) {
+ if (parser.hasNext(3)) {
position.set(Position.KEY_INPUT, parser.nextHexInt(0));
- position.set(Position.KEY_SATELLITES, parser.nextHexInt(0));
position.set(Position.KEY_BATTERY, parser.nextInt(0));
position.set(Position.KEY_ODOMETER, parser.nextLong(16, 0));
}
- if (parser.hasNext(4)) {
+ if (parser.hasNext(3)) {
valid = parser.nextInt() > 0;
position.set(Position.KEY_PDOP, parser.nextInt());
position.set(Position.KEY_RSSI, parser.nextInt());
+ }
+ if (parser.hasNext(2)) {
position.set(Position.PREFIX_TEMP + 1, parser.nextInt() * 0.01);
position.set(Position.PREFIX_TEMP + 2, parser.nextInt() * 0.01);
}
diff --git a/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java
index 2858248bd..3ad234b19 100644
--- a/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class TaipProtocolDecoderTest extends ProtocolTest {
var decoder = inject(new TaipProtocolDecoder(null));
+ verifyPosition(decoder, text(
+ ">RCQ00151123235718-2782354-06407582055121FF0013501CDCC6313011100001514;#0805;ID=SIA056;*15<"));
+
verifyNull(decoder, text(
">RTT151123153149-4330468-06503640000009300DF2101 04101203 000 00000000130000040414;ID=8803;#1ABD;*2B<"));