aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/StbProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-07-07 07:33:16 -0700
committerAnton Tananaev <anton@traccar.org>2024-07-07 07:33:16 -0700
commitd0536ccbc1b7234784c5e48288bbac00a60ef821 (patch)
tree29ba8e1349eb9a5990f564edad7ddc7b5e24d7f7 /src/main/java/org/traccar/protocol/StbProtocolDecoder.java
parent864872b2df3e26c94d3a5826f4df504de3cf6c62 (diff)
downloadtrackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.tar.gz
trackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.tar.bz2
trackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.zip
Update switch statements
Diffstat (limited to 'src/main/java/org/traccar/protocol/StbProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/StbProtocolDecoder.java38
1 files changed, 13 insertions, 25 deletions
diff --git a/src/main/java/org/traccar/protocol/StbProtocolDecoder.java b/src/main/java/org/traccar/protocol/StbProtocolDecoder.java
index c52ab485f..18f529712 100644
--- a/src/main/java/org/traccar/protocol/StbProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/StbProtocolDecoder.java
@@ -75,36 +75,24 @@ public class StbProtocolDecoder extends BaseProtocolDecoder {
JsonObject propertyObject = property.asJsonObject();
String id = propertyObject.getString("id");
switch (id) {
- case "01101001":
- locationType = Integer.parseInt(propertyObject.getString("value"));
- break;
- case "01102001":
- position.setLongitude(
- Double.parseDouble(propertyObject.getString("value")));
- break;
- case "01103001":
- position.setLatitude(
- Double.parseDouble(propertyObject.getString("value")));
- break;
- case "01118001":
- position.set(
- Position.KEY_DEVICE_TEMP, Double.parseDouble(propertyObject.getString("value")));
- break;
- case "01122001":
- position.set(
- "batteryControl", Integer.parseInt(propertyObject.getString("value")));
- break;
- case "02301001":
- position.set(
- "switchCabinetCommand", Integer.parseInt(propertyObject.getString("value")));
- break;
- default:
+ case "01101001" -> locationType = Integer.parseInt(propertyObject.getString("value"));
+ case "01102001" -> position.setLongitude(
+ Double.parseDouble(propertyObject.getString("value")));
+ case "01103001" -> position.setLatitude(
+ Double.parseDouble(propertyObject.getString("value")));
+ case "01118001" -> position.set(
+ Position.KEY_DEVICE_TEMP, Double.parseDouble(propertyObject.getString("value")));
+ case "01122001" -> position.set(
+ "batteryControl", Integer.parseInt(propertyObject.getString("value")));
+ case "02301001" -> position.set(
+ "switchCabinetCommand", Integer.parseInt(propertyObject.getString("value")));
+ default -> {
String key = "id" + id;
if (propertyObject.containsKey("doorId")) {
key += "Door" + propertyObject.getString("doorId");
}
position.set(key, propertyObject.getString("value"));
- break;
+ }
}
}
if (locationType > 0) {