aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/CastelProtocolEncoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/protocol/CastelProtocolEncoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/CastelProtocolEncoder.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/protocol/CastelProtocolEncoder.java b/src/main/java/org/traccar/protocol/CastelProtocolEncoder.java
index 61dde3e80..867db7a09 100644
--- a/src/main/java/org/traccar/protocol/CastelProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/CastelProtocolEncoder.java
@@ -59,16 +59,17 @@ public class CastelProtocolEncoder extends BaseProtocolEncoder {
@Override
protected Object encodeCommand(Command command) {
ByteBuf content = Unpooled.buffer(0);
- switch (command.getType()) {
- case Command.TYPE_ENGINE_STOP:
+ return switch (command.getType()) {
+ case Command.TYPE_ENGINE_STOP -> {
content.writeByte(1);
- return encodeContent(command.getDeviceId(), CastelProtocolDecoder.MSG_CC_PETROL_CONTROL, content);
- case Command.TYPE_ENGINE_RESUME:
+ yield encodeContent(command.getDeviceId(), CastelProtocolDecoder.MSG_CC_PETROL_CONTROL, content);
+ }
+ case Command.TYPE_ENGINE_RESUME -> {
content.writeByte(0);
- return encodeContent(command.getDeviceId(), CastelProtocolDecoder.MSG_CC_PETROL_CONTROL, content);
- default:
- return null;
- }
+ yield encodeContent(command.getDeviceId(), CastelProtocolDecoder.MSG_CC_PETROL_CONTROL, content);
+ }
+ default -> null;
+ };
}
}