aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/WebDataHandler.java13
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java10
2 files changed, 19 insertions, 4 deletions
diff --git a/src/org/traccar/WebDataHandler.java b/src/org/traccar/WebDataHandler.java
index 3e47ada70..a8e20c698 100644
--- a/src/org/traccar/WebDataHandler.java
+++ b/src/org/traccar/WebDataHandler.java
@@ -24,6 +24,7 @@ import org.traccar.database.IdentityManager;
import org.traccar.helper.Checksum;
import org.traccar.model.Device;
import org.traccar.model.Position;
+import org.traccar.model.Group;
import javax.inject.Inject;
import javax.ws.rs.client.Client;
@@ -139,6 +140,18 @@ public class WebDataHandler extends BaseDataHandler {
request = request.replace("{gprmc}", formatSentence(position));
}
+ if (request.contains("{group}")) {
+ String deviceGroupName = "";
+ if (device.getGroupId() != 0) {
+ Group group = Context.getGroupsManager().getById(device.getGroupId());
+ if (group != null) {
+ deviceGroupName = group.getName();
+ }
+ }
+
+ request = request.replace("{group}", URLEncoder.encode(deviceGroupName, StandardCharsets.UTF_8.name()));
+ }
+
return request;
}
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index c0f485349..1fbae15ce 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -73,9 +73,11 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
.number(",(d+.?d*)?").optional() // altitude
.number(",([01])?").optional() // ignition
.number(",([01])?").optional() // door
- .number(",(?:(d+.d+)%)?").optional() // fuel 1
- .number(",(?:(d+.d+)%)?").optional() // fuel 2
- .number("(-?d+)?") // temperature
+ .groupBegin()
+ .number(",(?:(d+.d+)%)?") // fuel 1
+ .number(",(?:(d+.d+)%|d+)?") // fuel 2
+ .groupEnd("?")
+ .number(",([-+]?d+)?") // temperature
.groupEnd()
.any()
.compile();
@@ -193,7 +195,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
} else if (alarm.equals("acc off")) {
position.set(Position.KEY_IGNITION, false);
} else if (alarm.startsWith("T:")) {
- position.set(Position.PREFIX_TEMP + 1, alarm.substring(2));
+ position.set(Position.PREFIX_TEMP + 1, Double.parseDouble(alarm.substring(2)));
} else if (alarm.startsWith("oil ")) {
position.set(Position.KEY_FUEL_LEVEL, Double.parseDouble(alarm.substring(4)));
} else if (!position.getAttributes().containsKey(Position.KEY_ALARM) && !alarm.equals("tracker")) {