aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-08-05 10:07:35 +0500
committerAbyss777 <abyss@fox5.ru>2016-08-05 10:07:35 +0500
commit791a010e5a449a27e8243b9bc98c918ffa054eac (patch)
tree7883f58150598323fdae0f8578f607a18958f843 /src/org/traccar/protocol
parent4ebce65e3d6db55d427f504bd62972370fab2eec (diff)
downloadtrackermap-server-791a010e5a449a27e8243b9bc98c918ffa054eac.tar.gz
trackermap-server-791a010e5a449a27e8243b9bc98c918ffa054eac.tar.bz2
trackermap-server-791a010e5a449a27e8243b9bc98c918ffa054eac.zip
- Removed OIL_CUT
- Renamed guard to armed - Style fixes and optimizations
Diffstat (limited to 'src/org/traccar/protocol')
-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
7 files changed, 66 insertions, 37 deletions
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;
}
}