aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/MeitrackProtocolEncoder.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/MeitrackProtocolEncoder.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/MeitrackProtocolEncoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/MeitrackProtocolEncoder.java32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/main/java/org/traccar/protocol/MeitrackProtocolEncoder.java b/src/main/java/org/traccar/protocol/MeitrackProtocolEncoder.java
index 365dbb35a..b66fc3241 100644
--- a/src/main/java/org/traccar/protocol/MeitrackProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/MeitrackProtocolEncoder.java
@@ -46,26 +46,20 @@ public class MeitrackProtocolEncoder extends StringProtocolEncoder {
boolean alternative = AttributeUtil.lookup(
getCacheManager(), Keys.PROTOCOL_ALTERNATIVE.withPrefix(getProtocolName()), command.getDeviceId());
- switch (command.getType()) {
- case Command.TYPE_POSITION_SINGLE:
- return formatCommand(command, 'Q', "A10");
- case Command.TYPE_ENGINE_STOP:
- return formatCommand(command, 'M', "C01,0,12222");
- case Command.TYPE_ENGINE_RESUME:
- return formatCommand(command, 'M', "C01,0,02222");
- case Command.TYPE_ALARM_ARM:
- return formatCommand(command, 'M', alternative ? "B21,1" : "C01,0,22122");
- case Command.TYPE_ALARM_DISARM:
- return formatCommand(command, 'M', alternative ? "B21,0" : "C01,0,22022");
- case Command.TYPE_REQUEST_PHOTO:
+ return switch (command.getType()) {
+ case Command.TYPE_POSITION_SINGLE -> formatCommand(command, 'Q', "A10");
+ case Command.TYPE_ENGINE_STOP -> formatCommand(command, 'M', "C01,0,12222");
+ case Command.TYPE_ENGINE_RESUME -> formatCommand(command, 'M', "C01,0,02222");
+ case Command.TYPE_ALARM_ARM -> formatCommand(command, 'M', alternative ? "B21,1" : "C01,0,22122");
+ case Command.TYPE_ALARM_DISARM -> formatCommand(command, 'M', alternative ? "B21,0" : "C01,0,22022");
+ case Command.TYPE_REQUEST_PHOTO -> {
int index = command.getInteger(Command.KEY_INDEX);
- return formatCommand(command, 'D', "D03," + (index > 0 ? index : 1) + ",camera_picture.jpg");
- case Command.TYPE_SEND_SMS:
- return formatCommand(command, 'f', "C02,0,"
- + attributes.get(Command.KEY_PHONE) + "," + attributes.get(Command.KEY_MESSAGE));
- default:
- return null;
- }
+ yield formatCommand(command, 'D', "D03," + (index > 0 ? index : 1) + ",camera_picture.jpg");
+ }
+ case Command.TYPE_SEND_SMS -> formatCommand(command, 'f', "C02,0,"
+ + attributes.get(Command.KEY_PHONE) + "," + attributes.get(Command.KEY_MESSAGE));
+ default -> null;
+ };
}
}