aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-09-18 09:26:22 -0700
committerAnton Tananaev <anton@traccar.org>2022-09-18 09:26:22 -0700
commit43e04167d35c9f68eb5850f6e7e9f2723400957f (patch)
tree1aec07b6cc97fb9b2e7ddf3ddbfcedf4f5c1aec6 /src/main/java/org
parent6864e0a0a067f432bead08331404d4b141959a64 (diff)
downloadtrackermap-server-43e04167d35c9f68eb5850f6e7e9f2723400957f.tar.gz
trackermap-server-43e04167d35c9f68eb5850f6e7e9f2723400957f.tar.bz2
trackermap-server-43e04167d35c9f68eb5850f6e7e9f2723400957f.zip
Decode TAT100 cell info
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java44
1 files changed, 34 insertions, 10 deletions
diff --git a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
index ff1f52eb1..4671a1088 100644
--- a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -342,16 +342,40 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
}
}
- private void decodeNetwork(Position position) {
- Integer cid = (Integer) position.getAttributes().remove("cid");
- Integer lac = (Integer) position.getAttributes().remove("lac");
- if (cid != null && lac != null) {
- CellTower cellTower = CellTower.fromLacCid(getConfig(), lac, cid);
- long operator = position.getInteger(Position.KEY_OPERATOR);
- if (operator >= 1000) {
- cellTower.setOperator(operator);
+ private void decodeCell(
+ Position position, Network network, String mncKey, String lacKey, String cidKey, String rssiKey) {
+ if (position.hasAttribute(mncKey) && position.hasAttribute(lacKey) && position.hasAttribute(cidKey)) {
+ CellTower cellTower = CellTower.from(
+ getConfig().getInteger(Keys.GEOLOCATION_MCC),
+ (Integer) position.getAttributes().remove(mncKey),
+ (Integer) position.getAttributes().remove(lacKey),
+ (Integer) position.getAttributes().remove(cidKey));
+ cellTower.setSignalStrength((Integer) position.getAttributes().remove(rssiKey));
+ network.addCellTower(cellTower);
+ }
+ }
+
+ private void decodeNetwork(Position position, String model) {
+ if ("TAT100".equals(model)) {
+ Network network = new Network();
+ decodeCell(position, network, "io1200", "io287", "io288", "io289");
+ decodeCell(position, network, "io1201", "io290", "io291", "io292");
+ decodeCell(position, network, "io1202", "io293", "io294", "io295");
+ decodeCell(position, network, "io1203", "io296", "io297", "io298");
+ if (network.getCellTowers() != null) {
+ position.setNetwork(network);
+ }
+ } else {
+ Integer cid = (Integer) position.getAttributes().remove("cid");
+ Integer lac = (Integer) position.getAttributes().remove("lac");
+ if (cid != null && lac != null) {
+ CellTower cellTower = CellTower.fromLacCid(getConfig(), lac, cid);
+ long operator = position.getInteger(Position.KEY_OPERATOR);
+ if (operator >= 1000) {
+ cellTower.setOperator(operator);
+ }
+ position.setNetwork(new Network(cellTower));
}
- position.setNetwork(new Network(cellTower));
}
}
@@ -545,7 +569,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
}
}
- decodeNetwork(position);
+ decodeNetwork(position, model);
}