diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-04-10 21:36:33 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-04-10 21:36:33 -0700 |
commit | c6aabdaba867ba2ad408b78a2fe0ec5979b6e1af (patch) | |
tree | cac7667bba1041b335b9d9cf86f852e106e87ef1 /src/main/java/org/traccar/protocol | |
parent | a21526cfa9e204715cfc41966dc95584d6e30168 (diff) | |
download | traccar-server-c6aabdaba867ba2ad408b78a2fe0ec5979b6e1af.tar.gz traccar-server-c6aabdaba867ba2ad408b78a2fe0ec5979b6e1af.tar.bz2 traccar-server-c6aabdaba867ba2ad408b78a2fe0ec5979b6e1af.zip |
Implement Ruptela photo request
Diffstat (limited to 'src/main/java/org/traccar/protocol')
3 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/RuptelaProtocol.java b/src/main/java/org/traccar/protocol/RuptelaProtocol.java index 1ac62570a..a574293cd 100644 --- a/src/main/java/org/traccar/protocol/RuptelaProtocol.java +++ b/src/main/java/org/traccar/protocol/RuptelaProtocol.java @@ -26,6 +26,7 @@ public class RuptelaProtocol extends BaseProtocol { public RuptelaProtocol() { setSupportedDataCommands( Command.TYPE_CUSTOM, + Command.TYPE_REQUEST_PHOTO, Command.TYPE_CONFIGURATION, Command.TYPE_GET_VERSION, Command.TYPE_FIRMWARE_UPDATE, diff --git a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java index a9ab5f5fe..2d476427d 100644 --- a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 - 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2013 - 2019 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,6 +48,7 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_SMS_VIA_GPRS = 8; public static final int MSG_DTCS = 9; public static final int MSG_SET_IO = 17; + public static final int MSG_FILES = 37; public static final int MSG_EXTENDED_RECORDS = 68; private Position decodeCommandResponse(DeviceSession deviceSession, int type, ByteBuf buf) { diff --git a/src/main/java/org/traccar/protocol/RuptelaProtocolEncoder.java b/src/main/java/org/traccar/protocol/RuptelaProtocolEncoder.java index 4242584c9..96d0da5a7 100644 --- a/src/main/java/org/traccar/protocol/RuptelaProtocolEncoder.java +++ b/src/main/java/org/traccar/protocol/RuptelaProtocolEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,12 @@ public class RuptelaProtocolEncoder extends BaseProtocolEncoder { case Command.TYPE_CUSTOM: content.writeBytes(command.getString(Command.KEY_DATA).getBytes(StandardCharsets.US_ASCII)); return encodeContent(RuptelaProtocolDecoder.MSG_SMS_VIA_GPRS, content); + case Command.TYPE_REQUEST_PHOTO: + content.writeByte(1); // sub-command + content.writeByte(0); // source + content.writeInt(0); // start timestamp + content.writeInt(Integer.MAX_VALUE); // end timestamp + return encodeContent(RuptelaProtocolDecoder.MSG_FILES, content); case Command.TYPE_CONFIGURATION: content.writeBytes((command.getString(Command.KEY_DATA) + "\r\n").getBytes(StandardCharsets.US_ASCII)); return encodeContent(RuptelaProtocolDecoder.MSG_DEVICE_CONFIGURATION, content); |