aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/model/Position.java3
-rw-r--r--src/org/traccar/protocol/CarTrackProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java16
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java24
-rw-r--r--src/org/traccar/protocol/NavisProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/NoranProtocolDecoder.java15
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java22
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java18
8 files changed, 67 insertions, 39 deletions
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java
index a62839702..d2409a75d 100644
--- a/src/org/traccar/model/Position.java
+++ b/src/org/traccar/model/Position.java
@@ -54,7 +54,7 @@ public class Position extends Message {
public static final String KEY_APPROXIMATE = "approximate";
public static final String KEY_THROTTLE = "throttle";
public static final String KEY_MOTION = "motion";
- public static final String KEY_GUARD = "guard";
+ public static final String KEY_ARMED = "armed";
public static final String KEY_OBD_SPEED = "obd-speed";
public static final String KEY_OBD_ODOMETER = "obd-odometer";
@@ -83,7 +83,6 @@ public class Position extends Message {
public static final String ALARM_GEOFENCE_ENTER = "geofenceEnter";
public static final String ALARM_GEOFENCE_EXIT = "geofenceExit";
public static final String ALARM_GPS_ANTENNA_CUT = "gpsAntennaCut";
- public static final String ALARM_OIL_CUT = "oilCut";
public static final String ALARM_ACCIDENT = "accident";
diff --git a/src/org/traccar/protocol/CarTrackProtocolDecoder.java b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
index 45f1b0812..0d21e77e6 100644
--- a/src/org/traccar/protocol/CarTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
@@ -99,7 +99,7 @@ public class CarTrackProtocolDecoder extends BaseProtocolDecoder {
odometer = odometer.replace("?", "F");
position.set(Position.KEY_ODOMETER, Integer.parseInt(odometer, 16));
- parser.next(); //there is no meaningful alarms
+ parser.next(); // there is no meaningful alarms
position.set(Position.PREFIX_ADC + 1, parser.next());
return position;
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 9d3fda345..b153984cb 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -103,20 +103,22 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
.compile();
private String decodeAlarm(String value) {
- if (value == "tracker") {
+ switch (value) {
+ case "tracker":
return null;
- } else if (value == "help me") {
+ case "help me":
return Position.ALARM_SOS;
- } else if (value == "low battery") {
+ case "low battery":
return Position.ALARM_LOW_BATTERY;
- } else if (value == "stockade") {
+ case "stockade":
return Position.ALARM_GEOFENCE;
- } else if (value == "move") {
+ case "move":
return Position.ALARM_MOVEMENT;
- } else if (value == "speed") {
+ case "speed":
return Position.ALARM_OVERSPEED;
+ default:
+ return null;
}
- return null;
}
@Override
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index c6c984dda..41e248791 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -153,14 +153,22 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
private String decodeAlarm(short value) {
switch (value) {
- case 0x01: return Position.ALARM_SOS;
- case 0x10: return Position.ALARM_LOW_BATTERY;
- case 0x11: return Position.ALARM_OVERSPEED;
- case 0x12: return Position.ALARM_MOVEMENT;
- case 0x13: return Position.ALARM_GEOFENCE_ENTER;
- case 0x50: return Position.ALARM_POWER_OFF;
- case 0x53: return Position.ALARM_GPS_ANTENNA_CUT;
- default: return null;
+ case 0x01:
+ return Position.ALARM_SOS;
+ case 0x10:
+ return Position.ALARM_LOW_BATTERY;
+ case 0x11:
+ return Position.ALARM_OVERSPEED;
+ case 0x12:
+ return Position.ALARM_MOVEMENT;
+ case 0x13:
+ return Position.ALARM_GEOFENCE_ENTER;
+ case 0x50:
+ return Position.ALARM_POWER_OFF;
+ case 0x53:
+ return Position.ALARM_GPS_ANTENNA_CUT;
+ default:
+ return null;
}
}
diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java
index 046068c5d..72c5f53c3 100644
--- a/src/org/traccar/protocol/NavisProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavisProtocolDecoder.java
@@ -95,9 +95,9 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
buf.skipBytes(6); // event time
- short guardStatus = buf.readUnsignedByte();
- position.set(Position.KEY_GUARD, guardStatus & 0x7F);
- if (BitUtil.check(guardStatus, 7)) {
+ short armedStatus = buf.readUnsignedByte();
+ position.set(Position.KEY_ARMED, armedStatus & 0x7F);
+ if (BitUtil.check(armedStatus, 7)) {
position.set(Position.KEY_ALARM, Position.ALARM_GENERAL);
}
position.set(Position.KEY_STATUS, buf.readUnsignedByte());
diff --git a/src/org/traccar/protocol/NoranProtocolDecoder.java b/src/org/traccar/protocol/NoranProtocolDecoder.java
index 5b4533422..aaecfc1db 100644
--- a/src/org/traccar/protocol/NoranProtocolDecoder.java
+++ b/src/org/traccar/protocol/NoranProtocolDecoder.java
@@ -91,14 +91,21 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder {
position.setValid(BitUtil.check(buf.readUnsignedByte(), 0));
short alarm = buf.readUnsignedByte();
- if (alarm == 1) {
+ switch (alarm) {
+ case 1:
position.set(Position.KEY_ALARM, Position.ALARM_SOS);
- } else if (alarm == 2) {
+ break;
+ case 2:
position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED);
- } else if (alarm == 3) {
+ break;
+ case 3:
position.set(Position.KEY_ALARM, Position.ALARM_GEOFENCE_EXIT);
- } else if (alarm == 9) {
+ break;
+ case 9:
position.set(Position.KEY_ALARM, Position.ALARM_POWER_OFF);
+ break;
+ default:
+ break;
}
if (newFormat) {
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 72ecdc2de..55a41f5a2 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -77,14 +77,20 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
private String decodeAlarm(int value) {
switch (value) {
- case 0: return Position.ALARM_OIL_CUT;
- case 1: return Position.ALARM_ACCIDENT;
- case 2: return Position.ALARM_SOS;
- case 3: return Position.ALARM_VIBRATION;
- case 4: return Position.ALARM_LOW_SPEED;
- case 5: return Position.ALARM_OVERSPEED;
- case 6: return Position.ALARM_GEOFENCE_EXIT;
- default: return null;
+ case 1:
+ return Position.ALARM_ACCIDENT;
+ case 2:
+ return Position.ALARM_SOS;
+ case 3:
+ return Position.ALARM_VIBRATION;
+ case 4:
+ return Position.ALARM_LOW_SPEED;
+ case 5:
+ return Position.ALARM_OVERSPEED;
+ case 6:
+ return Position.ALARM_GEOFENCE_EXIT;
+ default:
+ return null;
}
}
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java
index fed1c3bd8..72c0f6306 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -161,12 +161,18 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
private String decodeAlarm(Short value) {
switch (value) {
- case 0x01: return Position.ALARM_SOS;
- case 0x10: return Position.ALARM_LOW_BATTERY;
- case 0x11: return Position.ALARM_OVERSPEED;
- case 0x42: return Position.ALARM_GEOFENCE_EXIT;
- case 0x43: return Position.ALARM_GEOFENCE_ENTER;
- default: return null;
+ case 0x01:
+ return Position.ALARM_SOS;
+ case 0x10:
+ return Position.ALARM_LOW_BATTERY;
+ case 0x11:
+ return Position.ALARM_OVERSPEED;
+ case 0x42:
+ return Position.ALARM_GEOFENCE_EXIT;
+ case 0x43:
+ return Position.ALARM_GEOFENCE_ENTER;
+ default:
+ return null;
}
}