aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Prangenberg <philipp.prangenberg@derkurier.de>2016-12-06 12:03:32 +0100
committerPhilipp Prangenberg <philipp.prangenberg@derkurier.de>2016-12-06 12:03:32 +0100
commit3c9af23be923b8cf4bc40f6f964b5b3e719e4c8e (patch)
tree0c0254bcd5d1479d2e37051c1fa7c9f4129d1d37 /src
parent7546048a58c16ad083d732aacd2af2d4a200b47c (diff)
parentae2612e060e390773cc49955ddc422a889abd2f5 (diff)
downloadtraccar-server-3c9af23be923b8cf4bc40f6f964b5b3e719e4c8e.tar.gz
traccar-server-3c9af23be923b8cf4bc40f6f964b5b3e719e4c8e.tar.bz2
traccar-server-3c9af23be923b8cf4bc40f6f964b5b3e719e4c8e.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/Pt502ProtocolDecoder.java7
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));