aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Pt502ProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-08 11:25:44 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-07-08 11:25:44 +1200
commit09e0d8de59fd662efd210be521e772ba59170c37 (patch)
treebcd1f44f25d4513c5016dfe077ec1ca48ea93603 /src/org/traccar/protocol/Pt502ProtocolDecoder.java
parenta413abaf255fdb70ed8c77c801d277fbfc558bbb (diff)
downloadtrackermap-server-09e0d8de59fd662efd210be521e772ba59170c37.tar.gz
trackermap-server-09e0d8de59fd662efd210be521e772ba59170c37.tar.bz2
trackermap-server-09e0d8de59fd662efd210be521e772ba59170c37.zip
Implement PT502 photo request
Diffstat (limited to 'src/org/traccar/protocol/Pt502ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Pt502ProtocolDecoder.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
index 850e9fcff..424d491ae 100644
--- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
@@ -60,7 +60,16 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
- Parser parser = new Parser(PATTERN, (String) msg);
+ String sentence = (String) msg;
+
+ if (sentence.startsWith("$PHO")) {
+ if (channel != null) {
+ channel.write("#PHD0," + sentence.substring(4));
+ }
+ return null;
+ }
+
+ Parser parser = new Parser(PATTERN, sentence);
if (!parser.matches()) {
return null;
}