diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-06 05:58:14 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-06 14:00:08 +1300 |
commit | ae2612e060e390773cc49955ddc422a889abd2f5 (patch) | |
tree | 2394fd6494cac85222dd82fd1c3d1a37fb7e4855 /src | |
parent | 40607036c5aa6385a7ae3f3a283bf107238a5944 (diff) | |
download | trackermap-server-ae2612e060e390773cc49955ddc422a889abd2f5.tar.gz trackermap-server-ae2612e060e390773cc49955ddc422a889abd2f5.tar.bz2 trackermap-server-ae2612e060e390773cc49955ddc422a889abd2f5.zip |
Request smaller photo chunk
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/Pt502ProtocolDecoder.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java index 2d3cb9101..f3d9e8380 100644 --- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java +++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java @@ -29,6 +29,10 @@ import java.util.regex.Pattern; public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
+ private static final int MAX_CHUNK_SIZE = 960;
+
+ private byte[] photo;
+
public Pt502ProtocolDecoder(Pt502Protocol protocol) {
super(protocol);
}
@@ -92,7 +96,8 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder { String type = parser.next();
if (type.startsWith("PHO") && channel != null) {
- channel.write("#PHD0," + type.substring(3) + "\r\n");
+ photo = new byte[Integer.parseInt(type.substring(3))];
+ channel.write("#PHD0," + Math.min(photo.length, MAX_CHUNK_SIZE) + "\r\n");
}
position.set(Position.KEY_ALARM, decodeAlarm(type));
|