aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-04-14 21:58:23 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2019-04-14 21:58:23 -0700
commitf7ca64ef3e5828a6ff6302721499da62381539ec (patch)
tree986bda2f1a26b787c462d8b5a69225c022c79e96 /src/main/java/org
parentd25d3810621cda6bb7df2c060e8a7856784e789f (diff)
downloadtraccar-server-f7ca64ef3e5828a6ff6302721499da62381539ec.tar.gz
traccar-server-f7ca64ef3e5828a6ff6302721499da62381539ec.tar.bz2
traccar-server-f7ca64ef3e5828a6ff6302721499da62381539ec.zip
Implement missing ITS attributes
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/ItsProtocolDecoder.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java b/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java
index 17833dda9..e452ce01b 100644
--- a/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java
@@ -41,8 +41,8 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
.groupBegin()
.expression("[^,]+,") // vendor
.expression("[^,]+,") // firmware version
- .expression("[^,]+,") // type
- .number("d+,")
+ .expression("(..),") // status
+ .number("(d+),") // event
.expression("[LH],") // history
.or()
.expression("([^,]+),") // type
@@ -78,6 +78,11 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
.number("(?:-?x+,){12}") // other cells
.number("([01]{4}),") // inputs
.number("([01]{2}),") // outputs
+ .groupBegin()
+ .number("d+,") // index
+ .number("(d+.d+),") // adc1
+ .number("(d+.d+),") // adc2
+ .groupEnd("?")
.groupEnd("?")
.or()
.number("(-?d+.d+),") // altitude
@@ -101,6 +106,8 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
return Position.ALARM_CORNERING;
case "OS":
return Position.ALARM_OVERSPEED;
+ case "TA":
+ return Position.ALARM_TAMPERING;
default:
return null;
}
@@ -121,6 +128,8 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
return null;
}
+ String status = parser.next();
+ Integer event = parser.nextInt();
String type = parser.next();
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
@@ -135,8 +144,15 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ALARM, Position.ALARM_SOS);
}
+ if (event != null) {
+ position.set(Position.KEY_EVENT, event);
+ }
+
if (parser.hasNext()) {
- position.set(Position.KEY_ALARM, decodeAlarm(parser.next()));
+ status = parser.next();
+ }
+ if (status != null) {
+ position.set(Position.KEY_ALARM, decodeAlarm(status));
}
if (parser.hasNext()) {
@@ -166,6 +182,11 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
}
if (parser.hasNext(2)) {
+ position.set(Position.PREFIX_ADC + 1, parser.nextDouble());
+ position.set(Position.PREFIX_ADC + 2, parser.nextDouble());
+ }
+
+ if (parser.hasNext(2)) {
position.setAltitude(parser.nextDouble());
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
}