aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-06-06 23:12:52 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2017-06-06 23:25:51 -0700
commit05ad09e2aa9c16fff17476a61d24cd953db82197 (patch)
tree4e90d2226b6340360ba66792bd53496e6cb8c8d7 /src/org/traccar/protocol
parenta02f40019c45d7c90b1e8e3de1358352ef58f6c3 (diff)
downloadtrackermap-server-05ad09e2aa9c16fff17476a61d24cd953db82197.tar.gz
trackermap-server-05ad09e2aa9c16fff17476a61d24cd953db82197.tar.bz2
trackermap-server-05ad09e2aa9c16fff17476a61d24cd953db82197.zip
Add ignition support for Xexun
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index fb8107d3a..20804bbb4 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2017 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.
@@ -66,16 +66,25 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
.any()
.compile();
- private String decodeAlarm(String value) {
+ private String decodeStatus(Position position, String value) {
if (value != null) {
- switch (value) {
+ switch (value.toLowerCase()) {
+ case "acc on":
+ position.set(Position.KEY_IGNITION, true);
+ break;
+ case "acc off":
+ position.set(Position.KEY_IGNITION, false);
+ break;
case "help me!":
- return Position.ALARM_SOS;
+ position.set(Position.KEY_ALARM, Position.ALARM_SOS);
+ break;
case "low battery":
- return Position.ALARM_LOW_BATTERY;
+ position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY);
+ break;
case "move!":
case "moved!":
- return Position.ALARM_MOVEMENT;
+ position.set(Position.KEY_ALARM, Position.ALARM_MOVEMENT);
+ break;
default:
break;
}
@@ -127,7 +136,8 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
position.setTime(dateBuilder.getDate());
position.set("signal", parser.next());
- position.set(Position.KEY_ALARM, decodeAlarm(parser.next()));
+
+ decodeStatus(position, parser.next());
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
if (deviceSession == null) {