diff options
Diffstat (limited to 'src/main/java/org/traccar/protocol/NoranProtocolEncoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/NoranProtocolEncoder.java | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/main/java/org/traccar/protocol/NoranProtocolEncoder.java b/src/main/java/org/traccar/protocol/NoranProtocolEncoder.java index e02a1313c..c8043224d 100644 --- a/src/main/java/org/traccar/protocol/NoranProtocolEncoder.java +++ b/src/main/java/org/traccar/protocol/NoranProtocolEncoder.java @@ -49,21 +49,17 @@ public class NoranProtocolEncoder extends BaseProtocolEncoder { @Override protected Object encodeCommand(Command command) { - switch (command.getType()) { - case Command.TYPE_POSITION_SINGLE: - return encodeContent("*KW,000,000,000000#"); - case Command.TYPE_POSITION_PERIODIC: + return switch (command.getType()) { + case Command.TYPE_POSITION_SINGLE -> encodeContent("*KW,000,000,000000#"); + case Command.TYPE_POSITION_PERIODIC -> { int interval = command.getInteger(Command.KEY_FREQUENCY); - return encodeContent("*KW,000,002,000000," + interval + "#"); - case Command.TYPE_POSITION_STOP: - return encodeContent("*KW,000,002,000000,0#"); - case Command.TYPE_ENGINE_STOP: - return encodeContent("*KW,000,007,000000,0#"); - case Command.TYPE_ENGINE_RESUME: - return encodeContent("*KW,000,007,000000,1#"); - default: - return null; - } + yield encodeContent("*KW,000,002,000000," + interval + "#"); + } + case Command.TYPE_POSITION_STOP -> encodeContent("*KW,000,002,000000,0#"); + case Command.TYPE_ENGINE_STOP -> encodeContent("*KW,000,007,000000,0#"); + case Command.TYPE_ENGINE_RESUME -> encodeContent("*KW,000,007,000000,1#"); + default -> null; + }; } } |