aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/protocol/BceProtocolDecoder.java8
-rw-r--r--src/main/java/org/traccar/protocol/OmnicommProtocolDecoder.java31
-rw-r--r--src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java18
-rw-r--r--src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/T800xProtocolDecoder.java11
-rw-r--r--src/main/java/org/traccar/protocol/TelicProtocolDecoder.java6
6 files changed, 57 insertions, 24 deletions
diff --git a/src/main/java/org/traccar/protocol/BceProtocolDecoder.java b/src/main/java/org/traccar/protocol/BceProtocolDecoder.java
index 54136382c..a259e027a 100644
--- a/src/main/java/org/traccar/protocol/BceProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/BceProtocolDecoder.java
@@ -113,7 +113,7 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte());
}
if (BitUtil.check(mask, 4)) {
- position.set(Position.KEY_RPM, buf.readUnsignedShortLE() * 0.0125);
+ position.set(Position.KEY_RPM, buf.readUnsignedShortLE() * 0.125);
}
if (BitUtil.check(mask, 5)) {
position.set(Position.KEY_HOURS, buf.readUnsignedIntLE());
@@ -217,9 +217,9 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShortLE();
}
if (BitUtil.check(mask, 6)) {
- position.set("maxAcceleration", buf.readUnsignedByte());
- position.set("maxBraking", buf.readUnsignedByte());
- position.set("maxCornering", buf.readUnsignedByte());
+ position.set("maxAcceleration", buf.readUnsignedByte() * 0.02);
+ position.set("maxBraking", buf.readUnsignedByte() * 0.02);
+ position.set("maxCornering", buf.readUnsignedByte() * 0.02);
}
if (BitUtil.check(mask, 7)) {
buf.skipBytes(16);
diff --git a/src/main/java/org/traccar/protocol/OmnicommProtocolDecoder.java b/src/main/java/org/traccar/protocol/OmnicommProtocolDecoder.java
index cd8b74c9a..6e9cf52a5 100644
--- a/src/main/java/org/traccar/protocol/OmnicommProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/OmnicommProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2019 - 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.
@@ -111,16 +111,29 @@ public class OmnicommProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
+ if (message.hasGeneral()) {
+ OmnicommMessageOuterClass.OmnicommMessage.General data = message.getGeneral();
+ position.set(Position.KEY_POWER, data.getUboard() * 0.1);
+ position.set(Position.KEY_BATTERY_LEVEL, data.getBatLife());
+ }
+
if (message.hasNAV()) {
- OmnicommMessageOuterClass.OmnicommMessage.NAV nav = message.getNAV();
+ OmnicommMessageOuterClass.OmnicommMessage.NAV data = message.getNAV();
position.setValid(true);
- position.setTime(new Date((nav.getGPSTime() + 1230768000) * 1000L)); // from 2009-01-01 12:00
- position.setLatitude(nav.getLAT() * 0.0000001);
- position.setLongitude(nav.getLON() * 0.0000001);
- position.setSpeed(UnitsConverter.knotsFromKph(nav.getGPSVel() * 0.1));
- position.setCourse(nav.getGPSDir());
- position.setAltitude(nav.getGPSAlt() * 0.1);
- position.set(Position.KEY_SATELLITES, nav.getGPSNSat());
+ position.setTime(new Date((data.getGPSTime() + 1230768000) * 1000L)); // from 2009-01-01 12:00
+ position.setLatitude(data.getLAT() * 0.0000001);
+ position.setLongitude(data.getLON() * 0.0000001);
+ position.setSpeed(UnitsConverter.knotsFromKph(data.getGPSVel() * 0.1));
+ position.setCourse(data.getGPSDir());
+ position.setAltitude(data.getGPSAlt() * 0.1);
+ position.set(Position.KEY_SATELLITES, data.getGPSNSat());
+ }
+
+ if (message.hasLLSDt()) {
+ OmnicommMessageOuterClass.OmnicommMessage.LLSDt data = message.getLLSDt();
+ position.set("fuel1Temp", data.getTLLS1());
+ position.set("fuel1", data.getCLLS1());
+ position.set("fuel1State", data.getFLLS1());
}
if (position.getFixTime() != null) {
diff --git a/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java b/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java
index eae37386a..6fe54b0b0 100644
--- a/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2019 - 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.
@@ -77,10 +77,24 @@ public class SolarPoweredProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(-position.getLongitude());
}
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
- position.set(Position.KEY_DEVICE_TEMP, (int) buf.readByte());
+ int temperature = buf.readUnsignedByte();
+ if (BitUtil.check(temperature, 7)) {
+ position.set(Position.KEY_DEVICE_TEMP, -BitUtil.to(temperature, 7));
+ } else {
+ position.set(Position.KEY_DEVICE_TEMP, BitUtil.to(temperature, 7));
+ }
position.set(Position.KEY_BATTERY, buf.readUnsignedByte() * 0.02);
position.setCourse(buf.readUnsignedByte());
break;
+ case 0x83:
+ buf.readUnsignedInt(); // uptime
+ buf.readUnsignedInt(); // gps count
+ buf.readUnsignedInt(); // gsm count
+ buf.readUnsignedByte(); // positioning time
+ buf.readUnsignedByte(); // registration time
+ buf.readUnsignedByte(); // connection time
+ position.set(Position.KEY_RSSI, buf.readUnsignedByte());
+ break;
default:
buf.skipBytes(length);
break;
diff --git a/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java b/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java
index bad6f03a9..2d1613e03 100644
--- a/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 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.
@@ -140,6 +140,11 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
event = Integer.parseInt(data[i]);
position.set(Position.KEY_ALARM, decodeAlarm(event));
position.set(Position.KEY_EVENT, event);
+ if (event == 24) {
+ position.set(Position.KEY_IGNITION, true);
+ } else if (event == 25) {
+ position.set(Position.KEY_IGNITION, false);
+ }
break;
case "#PDT#":
position.setFixTime(dateFormat.parse(data[i]));
diff --git a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
index 9b146ec90..3331ebb71 100644
--- a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 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.
@@ -177,8 +177,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
}
private Position decodePosition(
- Channel channel, DeviceSession deviceSession,
- ByteBuf buf, int type, int index, ByteBuf imei) {
+ Channel channel, DeviceSession deviceSession, ByteBuf buf, int type, int index, ByteBuf imei) {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
@@ -214,8 +213,10 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.PREFIX_OUT + (i + 1), BitUtil.check(io, 7 + i));
}
- position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
- position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort());
+ if (header != 0x2626) {
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort());
+ }
}
diff --git a/src/main/java/org/traccar/protocol/TelicProtocolDecoder.java b/src/main/java/org/traccar/protocol/TelicProtocolDecoder.java
index 457687b2e..a4f9e2989 100644
--- a/src/main/java/org/traccar/protocol/TelicProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TelicProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2014 - 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.
@@ -42,8 +42,8 @@ public class TelicProtocolDecoder extends BaseProtocolDecoder {
.number("(dd)(dd)(dd)") // date (ddmmyy)
.number("(dd)(dd)(dd),") // time (hhmmss)
.groupBegin()
- .number("(-?d{9}),") // longitude
- .number("(-?d{8}),") // latitude
+ .number("(-?d{8,}),") // longitude
+ .number("(-?d{7,}),") // latitude
.or()
.number("(-?d+),") // longitude
.number("(-?d+),") // latitude