aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-04-14 14:11:24 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2019-04-14 14:11:24 -0700
commit9a404bd07c221912fff3b8e498caab0645fa4d2b (patch)
treefdaeb2120bc4eb2bc8c0b23eeb71eba77ca85114 /src/main/java/org/traccar/protocol
parent142fe572e6cb3c44b79844464b9efdaf501755a9 (diff)
downloadtrackermap-server-9a404bd07c221912fff3b8e498caab0645fa4d2b.tar.gz
trackermap-server-9a404bd07c221912fff3b8e498caab0645fa4d2b.tar.bz2
trackermap-server-9a404bd07c221912fff3b8e498caab0645fa4d2b.zip
Support ITS EMR messages
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/ItsProtocolDecoder.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java b/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java
index 482f34e65..17833dda9 100644
--- a/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java
@@ -45,7 +45,7 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
.number("d+,")
.expression("[LH],") // history
.or()
- .expression("[^,]+,") // type
+ .expression("([^,]+),") // type
.groupEnd()
.number("(d{15}),") // imei
.groupBegin()
@@ -121,6 +121,8 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
return null;
}
+ String type = parser.next();
+
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
if (deviceSession == null) {
return null;
@@ -129,6 +131,10 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
+ if (type != null && type.equals("EMR")) {
+ position.set(Position.KEY_ALARM, Position.ALARM_SOS);
+ }
+
if (parser.hasNext()) {
position.set(Position.KEY_ALARM, decodeAlarm(parser.next()));
}