diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-26 15:45:04 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-26 15:45:04 +1200 |
commit | 71a9d9f6df3bc0ef17bcb834487838b94d989a74 (patch) | |
tree | 44ba620fefadfc748e3957d458d2d98a9ca53057 /src/org/traccar | |
parent | 4e084ebd790286392225e44ce462f987a2c3046a (diff) | |
download | traccar-server-71a9d9f6df3bc0ef17bcb834487838b94d989a74.tar.gz traccar-server-71a9d9f6df3bc0ef17bcb834487838b94d989a74.tar.bz2 traccar-server-71a9d9f6df3bc0ef17bcb834487838b94d989a74.zip |
Support watch audio file
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/model/Position.java | 2 | ||||
-rw-r--r-- | src/org/traccar/protocol/WatchProtocolDecoder.java | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index bf2518c3c..2198d3b24 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -39,7 +39,7 @@ public class Position extends Message { public static final String KEY_OUTPUT = "output"; public static final String KEY_IMAGE = "image"; public static final String KEY_VIDEO = "video"; - public static final String KEY_SOUND = "sound"; + public static final String KEY_AUDIO = "audio"; // The units for the below four KEYs currently vary. // The preferred units of measure are specified in the comment for each. 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; |