diff options
author | Iván Ávalos <avalos@disroot.org> | 2024-08-03 20:52:00 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2024-08-03 20:52:00 -0600 |
commit | 55f6d92c09a5b1d8566b53633d07be3d31010d3b (patch) | |
tree | b86bed801b0bbadb72c7e839296dae1d28b12bbb /src/main/java/org/traccar/protocol/StbProtocolDecoder.java | |
parent | c04ad7d48331253c095fc123ded1b00f6ff871d3 (diff) | |
parent | 2788174193def918a3a1a5be3bbed24c9613323f (diff) | |
download | trackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.tar.gz trackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.tar.bz2 trackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.zip |
Merge tag 'tags/v6.3'
Diffstat (limited to 'src/main/java/org/traccar/protocol/StbProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/StbProtocolDecoder.java | 38 |
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) { |