aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/XexunProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-08-17 16:37:31 +0300
committerGitHub <noreply@github.com>2016-08-17 16:37:31 +0300
commitbfacd794c443f0f54a27d5d52b33de4628a36009 (patch)
tree65a57a0d8f173493ef13cd9cd7736b22808d218c /src/org/traccar/protocol/XexunProtocolDecoder.java
parent376bd7a7342ed46f20b7c0c94d7c9b0074ae99f3 (diff)
parent54a64d8c0186e71ce557b5e9764d478084e9443c (diff)
downloadtrackermap-server-bfacd794c443f0f54a27d5d52b33de4628a36009.tar.gz
trackermap-server-bfacd794c443f0f54a27d5d52b33de4628a36009.tar.bz2
trackermap-server-bfacd794c443f0f54a27d5d52b33de4628a36009.zip
Merge pull request #2222 from Abyss777/alarms_3
Alarm decoding for few more protocols
Diffstat (limited to 'src/org/traccar/protocol/XexunProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index 7b6a84f1f..69100f54b 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -64,6 +64,23 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
.any()
.compile();
+ private String decodeAlarm(String value) {
+ if (value != null) {
+ switch (value) {
+ case "help me!":
+ return Position.ALARM_SOS;
+ case "low battery":
+ return Position.ALARM_LOW_BATTERY;
+ case "move!":
+ case "moved!":
+ return Position.ALARM_MOVEMENT;
+ default:
+ break;
+ }
+ }
+ return null;
+ }
+
@Override
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
@@ -99,7 +116,7 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
position.setTime(dateBuilder.getDate());
position.set("signal", parser.next());
- position.set(Position.KEY_ALARM, parser.next());
+ position.set(Position.KEY_ALARM, decodeAlarm(parser.next()));
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
if (deviceSession == null) {