From c6aabdaba867ba2ad408b78a2fe0ec5979b6e1af Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 10 Apr 2019 21:36:33 -0700 Subject: Implement Ruptela photo request --- src/main/java/org/traccar/protocol/RuptelaProtocol.java | 1 + src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java | 3 ++- src/main/java/org/traccar/protocol/RuptelaProtocolEncoder.java | 8 +++++++- 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/main/java/org') 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); -- cgit v1.2.3