From d0536ccbc1b7234784c5e48288bbac00a60ef821 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 7 Jul 2024 07:33:16 -0700 Subject: Update switch statements --- .../traccar/protocol/WristbandProtocolDecoder.java | 27 ++++++++-------------- 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'src/main/java/org/traccar/protocol/WristbandProtocolDecoder.java') diff --git a/src/main/java/org/traccar/protocol/WristbandProtocolDecoder.java b/src/main/java/org/traccar/protocol/WristbandProtocolDecoder.java index 323992ddd..f8cfe2b5e 100644 --- a/src/main/java/org/traccar/protocol/WristbandProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/WristbandProtocolDecoder.java @@ -155,31 +155,22 @@ public class WristbandProtocolDecoder extends BaseProtocolDecoder { String data = parser.next(); switch (type) { - case 90: - sendResponse(channel, imei, version, type, getServer(channel, ',')); - break; - case 91: + case 90 -> sendResponse(channel, imei, version, type, getServer(channel, ',')); + case 91 -> { String time = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date()); sendResponse(channel, imei, version, type, time + "|" + getServer(channel, ',')); - break; - case 1: + } + case 1 -> { positions.add(decodeStatus(deviceSession, data)); sendResponse(channel, imei, version, type, data.split(",")[1]); - break; - case 2: + } + case 2 -> { for (String fragment : data.split("\\|")) { positions.add(decodePosition(deviceSession, fragment)); } - break; - case 3: - case 4: - positions.add(decodeNetwork(deviceSession, data, type == 3)); - break; - case 64: - sendResponse(channel, imei, version, type, data); - break; - default: - break; + } + case 3, 4 -> positions.add(decodeNetwork(deviceSession, data, type == 3)); + case 64 -> sendResponse(channel, imei, version, type, data); } return positions.isEmpty() ? null : positions; -- cgit v1.2.3