aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-04-15 07:37:52 -0700
committerAnton Tananaev <anton@traccar.org>2023-04-15 07:37:52 -0700
commitc024d09744dea2db2d60f51bc6c1532284ffca4e (patch)
tree7d7267bcb13eb6d9d50852c4d3e12c7294525c58
parent9a427527da45e599a1082f1f2836d195ea26acb5 (diff)
downloadtrackermap-server-c024d09744dea2db2d60f51bc6c1532284ffca4e.tar.gz
trackermap-server-c024d09744dea2db2d60f51bc6c1532284ffca4e.tar.bz2
trackermap-server-c024d09744dea2db2d60f51bc6c1532284ffca4e.zip
Fix Nano firmware update
-rw-r--r--src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java2
-rw-r--r--src/main/java/org/traccar/protocol/Minifinder2ProtocolEncoder.java1
-rw-r--r--src/test/java/org/traccar/protocol/Minifinder2ProtocolEncoderTest.java2
3 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java
index 37e86e243..f660f2e92 100644
--- a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java
@@ -48,6 +48,8 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_DATA = 0x01;
public static final int MSG_CONFIGURATION = 0x02;
public static final int MSG_SERVICES = 0x03;
+ public static final int MSG_SYSTEM_CONTROL = 0x04;
+ public static final int MSG_FIRMWARE = 0x7E;
public static final int MSG_RESPONSE = 0x7F;
private String decodeAlarm(long code) {
diff --git a/src/main/java/org/traccar/protocol/Minifinder2ProtocolEncoder.java b/src/main/java/org/traccar/protocol/Minifinder2ProtocolEncoder.java
index ce7de6dfc..fab3c3a6d 100644
--- a/src/main/java/org/traccar/protocol/Minifinder2ProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/Minifinder2ProtocolEncoder.java
@@ -53,6 +53,7 @@ public class Minifinder2ProtocolEncoder extends BaseProtocolEncoder {
ByteBuf content = Unpooled.buffer();
if (command.getType().equals(Command.TYPE_FIRMWARE_UPDATE)) {
String url = command.getString(Command.KEY_DATA);
+ content.writeByte(Minifinder2ProtocolDecoder.MSG_SYSTEM_CONTROL);
content.writeByte(1 + url.length());
content.writeByte(0x30); // type
content.writeCharSequence(url, StandardCharsets.US_ASCII);
diff --git a/src/test/java/org/traccar/protocol/Minifinder2ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Minifinder2ProtocolEncoderTest.java
index a3477bfe8..ef6ff6dd9 100644
--- a/src/test/java/org/traccar/protocol/Minifinder2ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Minifinder2ProtocolEncoderTest.java
@@ -22,7 +22,7 @@ public class Minifinder2ProtocolEncoderTest extends ProtocolTest {
command.setType(Command.TYPE_FIRMWARE_UPDATE);
command.set(Command.KEY_DATA, "https://example.com");
- verifyCommand(encoder, command, binary("ab00150018750100143068747470733a2f2f6578616d706c652e636f6d"));
+ verifyCommand(encoder, command, binary("ab00160059d2010004143068747470733a2f2f6578616d706c652e636f6d"));
}