aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorChristoph Krey <c@ckrey.de>2018-11-12 11:35:35 +0100
committerChristoph Krey <c@ckrey.de>2018-11-12 11:35:35 +0100
commitb499a5c5632bdb5f7f730f4763f77605d0073fb8 (patch)
treea50065b863cfa47b9b693eee9e1b9d189bb3574c /src/org
parente8f0c569e2aec2ad44a532a8bc366556e1f374c5 (diff)
downloadtraccar-server-b499a5c5632bdb5f7f730f4763f77605d0073fb8.tar.gz
traccar-server-b499a5c5632bdb5f7f730f4763f77605d0073fb8.tar.bz2
traccar-server-b499a5c5632bdb5f7f730f4763f77605d0073fb8.zip
[FIX] don't set KEY_EVENT in decoder
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/OwnTracksProtocolDecoder.java21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/org/traccar/protocol/OwnTracksProtocolDecoder.java b/src/org/traccar/protocol/OwnTracksProtocolDecoder.java
index b0a40e4fc..9dead6344 100644
--- a/src/org/traccar/protocol/OwnTracksProtocolDecoder.java
+++ b/src/org/traccar/protocol/OwnTracksProtocolDecoder.java
@@ -115,11 +115,11 @@ public class OwnTracksProtocolDecoder extends BaseHttpProtocolDecoder {
if (root.containsKey("t")) {
String trigger = root.getString("t");
position.set("t", trigger);
- Integer rty = -1;
+ Integer reportType = -1;
if (root.containsKey("rty")) {
- rty = root.getInt("rty");
+ reportType = root.getInt("rty");
}
- setEventOrAlarm(position, trigger, rty);
+ setEventOrAlarm(position, trigger, reportType);
}
if (root.containsKey("batt")) {
position.set(Position.KEY_BATTERY_LEVEL, root.getInt("batt"));
@@ -153,8 +153,8 @@ public class OwnTracksProtocolDecoder extends BaseHttpProtocolDecoder {
}
if (root.containsKey("anum")) {
- Integer anum = root.getInt("anum");
- for (Integer i = 0; i < anum; i++) {
+ Integer numberOfAnalogueInputs = root.getInt("anum");
+ for (Integer i = 0; i < numberOfAnalogueInputs; i++) {
String indexString = String.format("%02d", i);
if (root.containsKey("adda-" + indexString)) {
position.set(Position.PREFIX_ADC + (i + 1), root.getString("adda-" + indexString));
@@ -170,32 +170,25 @@ public class OwnTracksProtocolDecoder extends BaseHttpProtocolDecoder {
return position;
}
- private void setEventOrAlarm(Position position, String trigger, Integer rty) {
+ private void setEventOrAlarm(Position position, String trigger, Integer reportType) {
if (trigger.equals("9")) {
- position.set(Position.KEY_EVENT, Event.TYPE_ALARM);
position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY);
} else if (trigger.equals("1")) {
- position.set(Position.KEY_EVENT, Event.TYPE_ALARM);
position.set(Position.KEY_ALARM, Position.ALARM_POWER_ON);
} else if (trigger.equals("i")) {
position.set(Position.KEY_IGNITION, true);
} else if (trigger.equals("I")) {
position.set(Position.KEY_IGNITION, false);
} else if (trigger.equals("E")) {
- position.set(Position.KEY_EVENT, Event.TYPE_ALARM);
position.set(Position.KEY_ALARM, Position.ALARM_POWER_RESTORED);
} else if (trigger.equals("e")) {
- position.set(Position.KEY_EVENT, Event.TYPE_ALARM);
position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT);
} else if (trigger.equals("!")) {
- position.set(Position.KEY_EVENT, Event.TYPE_ALARM);
position.set(Position.KEY_ALARM, Position.ALARM_TOW);
} else if (trigger.equals("s")) {
- position.set(Position.KEY_EVENT, Event.TYPE_ALARM);
position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED);
} else if (trigger.equals("h")) {
- position.set(Position.KEY_EVENT, Event.TYPE_ALARM);
- switch (rty) {
+ switch (reportType) {
case 0:
case 3:
position.set(Position.KEY_ALARM, Position.ALARM_BRAKING);