aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-06-26 15:45:04 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-06-26 15:45:04 +1200
commit71a9d9f6df3bc0ef17bcb834487838b94d989a74 (patch)
tree44ba620fefadfc748e3957d458d2d98a9ca53057 /src/org/traccar/protocol
parent4e084ebd790286392225e44ce462f987a2c3046a (diff)
downloadtrackermap-server-71a9d9f6df3bc0ef17bcb834487838b94d989a74.tar.gz
trackermap-server-71a9d9f6df3bc0ef17bcb834487838b94d989a74.tar.bz2
trackermap-server-71a9d9f6df3bc0ef17bcb834487838b94d989a74.zip
Support watch audio file
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/WatchProtocolDecoder.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/WatchProtocolDecoder.java b/src/org/traccar/protocol/WatchProtocolDecoder.java
index d0c066954..57f5d7e78 100644
--- a/src/org/traccar/protocol/WatchProtocolDecoder.java
+++ b/src/org/traccar/protocol/WatchProtocolDecoder.java
@@ -222,15 +222,20 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
} else if (type.equals("PULSE") || type.equals("heart")) {
if (buf.readable()) {
+
Position position = new Position();
position.setProtocol(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
+
getLastLocation(position, new Date());
+
position.setValid(false);
String pulse = buf.toString(StandardCharsets.US_ASCII);
position.set("pulse", pulse);
position.set(Position.KEY_RESULT, pulse);
+
return position;
+
}
} else if (type.equals("img")) {
@@ -247,6 +252,18 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
return position;
+ } else if (type.equals("TK")) {
+
+ Position position = new Position();
+ position.setProtocol(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ getLastLocation(position, null);
+
+ position.set(Position.KEY_AUDIO, Context.getMediaManager().writeFile(id, buf, "amr"));
+
+ return position;
+
}
return null;