aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java39
1 files changed, 27 insertions, 12 deletions
diff --git a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java
index 5c2885a8b..77df0deb7 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 - 2021 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2022 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.
@@ -19,8 +19,7 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.Context;
-import org.traccar.DeviceSession;
+import org.traccar.session.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
import org.traccar.helper.DataConverter;
@@ -50,6 +49,7 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_SMS_VIA_GPRS_RESPONSE = 7;
public static final int MSG_SMS_VIA_GPRS = 8;
public static final int MSG_DTCS = 9;
+ public static final int MSG_IDENTIFICATION = 15;
public static final int MSG_SET_IO = 17;
public static final int MSG_FILES = 37;
public static final int MSG_EXTENDED_RECORDS = 68;
@@ -102,6 +102,12 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
case 5:
position.set(Position.KEY_IGNITION, readValue(buf, length, false) == 1);
break;
+ case 29:
+ position.set(Position.KEY_POWER, readValue(buf, length, false));
+ break;
+ case 30:
+ position.set(Position.KEY_BATTERY, readValue(buf, length, false) * 0.001);
+ break;
case 74:
position.set(Position.PREFIX_TEMP + 3, readValue(buf, length, true) * 0.1);
break;
@@ -110,22 +116,19 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
case 80:
position.set(Position.PREFIX_TEMP + (id - 78), readValue(buf, length, true) * 0.1);
break;
- case 198:
- if (readValue(buf, length, false) > 0) {
- position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED);
- }
- break;
- case 199:
- case 200:
+ case 134:
if (readValue(buf, length, false) > 0) {
position.set(Position.KEY_ALARM, Position.ALARM_BRAKING);
}
break;
- case 201:
+ case 136:
if (readValue(buf, length, false) > 0) {
position.set(Position.KEY_ALARM, Position.ALARM_ACCELERATION);
}
break;
+ case 197:
+ position.set(Position.KEY_RPM, readValue(buf, length, false) * 0.125);
+ break;
default:
position.set(Position.PREFIX_IO + id, readValue(buf, length, false));
break;
@@ -294,7 +297,7 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
getLastLocation(position, null);
- position.set(Position.KEY_IMAGE, Context.getMediaManager().writeFile(imei, photo, "jpg"));
+ position.set(Position.KEY_IMAGE, writeMediaFile(imei, photo, "jpg"));
photo.release();
photo = null;
return position;
@@ -303,6 +306,18 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
return null;
+ } else if (type == MSG_IDENTIFICATION) {
+
+ ByteBuf content = Unpooled.buffer();
+ content.writeByte(1);
+ ByteBuf response = RuptelaProtocolEncoder.encodeContent(type, content);
+ content.release();
+ if (channel != null) {
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
+ }
+
+ return null;
+
} else {
return decodeCommandResponse(deviceSession, type, buf);