aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-01-09 18:19:52 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-01-09 18:19:52 -0800
commit315eb05733799c3d6471a3461aec606342df6d13 (patch)
treecb330f1e5702f234bf7e6204e3fdc185e9b4c05d /src/main/java
parent92f02e0accbffad409761bfe962c94cf4fca2288 (diff)
downloadtraccar-server-315eb05733799c3d6471a3461aec606342df6d13.tar.gz
traccar-server-315eb05733799c3d6471a3461aec606342df6d13.tar.bz2
traccar-server-315eb05733799c3d6471a3461aec606342df6d13.zip
Improve ITS support now
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/ItsProtocolDecoder.java35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java b/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java
index 4746f7dd5..e8d77f1a8 100644
--- a/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 - 2020 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.
@@ -81,8 +81,8 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
.number("([01]{2}),") // outputs
.groupBegin()
.number("d+,") // index
- .number("(d+.d+),") // adc1
- .number("(d+.d+),") // adc2
+ .number("(d+.?d*),") // adc1
+ .number("(d+.?d*),") // adc2
.groupEnd("?")
.groupEnd("?")
.or()
@@ -195,22 +195,25 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
position.set("emergency", parser.nextInt() > 0);
- String[] cells = parser.next().split(",");
- int mcc = Integer.parseInt(cells[1]);
- int mnc = Integer.parseInt(cells[2]);
- int lac = Integer.parseInt(cells[3], 16);
- int cid = Integer.parseInt(cells[4], 16);
- Network network = new Network(CellTower.from(mcc, mnc, lac, cid, Integer.parseInt(cells[0])));
- if (!cells[5].startsWith("(")) {
- for (int i = 0; i < 4; i++) {
- lac = Integer.parseInt(cells[5 + 3 * i + 1], 16);
- cid = Integer.parseInt(cells[5 + 3 * i + 2], 16);
- if (lac > 0 && cid > 0) {
- network.addCellTower(CellTower.from(mcc, mnc, lac, cid));
+ String cellsString = parser.next();
+ if (!cellsString.contains("x")) {
+ String[] cells = cellsString.split(",");
+ int mcc = Integer.parseInt(cells[1]);
+ int mnc = Integer.parseInt(cells[2]);
+ int lac = Integer.parseInt(cells[3], 16);
+ int cid = Integer.parseInt(cells[4], 16);
+ Network network = new Network(CellTower.from(mcc, mnc, lac, cid, Integer.parseInt(cells[0])));
+ if (!cells[5].startsWith("(")) {
+ for (int i = 0; i < 4; i++) {
+ lac = Integer.parseInt(cells[5 + 3 * i + 1], 16);
+ cid = Integer.parseInt(cells[5 + 3 * i + 2], 16);
+ if (lac > 0 && cid > 0) {
+ network.addCellTower(CellTower.from(mcc, mnc, lac, cid));
+ }
}
}
+ position.setNetwork(network);
}
- position.setNetwork(network);
String input = parser.next();
if (input.charAt(input.length() - 1) == '2') {