aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-08-31 06:27:07 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-08-31 06:27:07 +1200
commita418adedfc17642dda161dc373b8fc57ab1dbbdf (patch)
treeea6155b70a1d566cc831ed268cea48c0645d37df /src/org/traccar/protocol
parentb372786bc73aa3f3f89b3a321585bd95c81d0031 (diff)
downloadtraccar-server-a418adedfc17642dda161dc373b8fc57ab1dbbdf.tar.gz
traccar-server-a418adedfc17642dda161dc373b8fc57ab1dbbdf.tar.bz2
traccar-server-a418adedfc17642dda161dc373b8fc57ab1dbbdf.zip
Handle Bofan photo response
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/Pt502ProtocolDecoder.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
index 3edada78a..7dc4fbe5e 100644
--- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
@@ -81,13 +81,6 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
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;
@@ -96,7 +89,15 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- position.set(Position.KEY_ALARM, decodeAlarm(parser.next()));
+ String type = parser.next();
+
+ if (type.startsWith("PHO")) {
+ if (channel != null) {
+ channel.write("#PHD0," + type.substring(3) + "\r\n");
+ }
+ }
+
+ position.set(Position.KEY_ALARM, decodeAlarm(type));
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
if (deviceSession == null) {