aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/StbProtocolDecoder.java
diff options
context:
space:
mode:
authorcasswarry0 <33078062+casswarry0@users.noreply.github.com>2021-11-23 15:35:10 +0000
committerGitHub <noreply@github.com>2021-11-23 15:35:10 +0000
commit26e3d8eb0c40822e5f39d144ecb053916c463e8f (patch)
treeb28e4b09f4e2aea9179d482dd4a2b153b1db63c5 /src/main/java/org/traccar/protocol/StbProtocolDecoder.java
parenta425ea42de76ba81890fb52b1f06eff82bba1ded (diff)
parentfd47e69b388b1e0af8aa5ead940773f6b2da3e81 (diff)
downloadtrackermap-server-26e3d8eb0c40822e5f39d144ecb053916c463e8f.tar.gz
trackermap-server-26e3d8eb0c40822e5f39d144ecb053916c463e8f.tar.bz2
trackermap-server-26e3d8eb0c40822e5f39d144ecb053916c463e8f.zip
Merge branch 'traccar:master' into master
Diffstat (limited to 'src/main/java/org/traccar/protocol/StbProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/StbProtocolDecoder.java31
1 files changed, 12 insertions, 19 deletions
diff --git a/src/main/java/org/traccar/protocol/StbProtocolDecoder.java b/src/main/java/org/traccar/protocol/StbProtocolDecoder.java
index bd151c604..cc985d605 100644
--- a/src/main/java/org/traccar/protocol/StbProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/StbProtocolDecoder.java
@@ -26,9 +26,7 @@ import org.traccar.Protocol;
import org.traccar.model.Position;
import javax.json.Json;
-import javax.json.JsonNumber;
import javax.json.JsonObject;
-import javax.json.JsonString;
import javax.json.JsonValue;
import java.io.StringReader;
import java.net.SocketAddress;
@@ -97,39 +95,34 @@ public class StbProtocolDecoder extends BaseProtocolDecoder {
String id = propertyObject.getString("id");
switch (id) {
case "01101001":
- locationType = propertyObject.getInt("value");
+ locationType = Integer.parseInt(propertyObject.getString("value"));
break;
case "01102001":
- position.setLongitude(propertyObject.getJsonNumber("value").doubleValue());
+ position.setLongitude(
+ Double.parseDouble(propertyObject.getString("value")));
break;
case "01103001":
- position.setLatitude(propertyObject.getJsonNumber("value").doubleValue());
+ position.setLatitude(
+ Double.parseDouble(propertyObject.getString("value")));
break;
case "01118001":
- position.set(Position.KEY_DEVICE_TEMP, propertyObject.getJsonNumber("value").doubleValue());
+ position.set(
+ Position.KEY_DEVICE_TEMP, Double.parseDouble(propertyObject.getString("value")));
break;
case "01122001":
- position.set("batteryControl", propertyObject.getInt("value"));
+ position.set(
+ "batteryControl", Integer.parseInt(propertyObject.getString("value")));
break;
case "02301001":
- position.set("switchCabinetCommand", propertyObject.getInt("value"));
+ position.set(
+ "switchCabinetCommand", Integer.parseInt(propertyObject.getString("value")));
break;
default:
String key = "id" + id;
if (propertyObject.containsKey("doorId")) {
key += "Door" + propertyObject.getString("doorId");
}
- JsonValue value = propertyObject.get("value");
- switch (value.getValueType()) {
- case STRING:
- position.set(key, ((JsonString) value).getString());
- break;
- case NUMBER:
- position.set(key, ((JsonNumber) value).doubleValue());
- break;
- default:
- break;
- }
+ position.set(key, propertyObject.getString("value"));
break;
}
}