You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/09/09 10:34:40 UTC

[plc4x] branch develop updated: fix(plc-simulator/cbus): fix status level responses with exstat off

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 91a9d2caf fix(plc-simulator/cbus): fix status level responses with exstat off
91a9d2caf is described below

commit 91a9d2caf135afb656b073faad16f89eb537ea6e
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Sep 9 12:34:32 2022 +0200

    fix(plc-simulator/cbus): fix status level responses with exstat off
---
 .../plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java b/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java
index 1629116fe..493decf9b 100644
--- a/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java
+++ b/plc4j/utils/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java
@@ -346,7 +346,12 @@ public class CBusServerAdapter extends ChannelInboundHandlerAdapter {
         byte blockStart = statusRequestLevel.getStartingGroupAddressLabel();
         List<LevelInformation> levelInformations = Collections.singletonList(new LevelInformationNormal(0x5555, LevelInformationNibblePair.Value_F, LevelInformationNibblePair.Value_F));
         CALData calData = new CALDataStatusExtended(CALCommandTypeContainer.CALCommandReply_4Bytes, null, coding, statusRequestLevel.getApplication(), blockStart, null, levelInformations, requestContext);
-        CALReply calReply = new CALReplyLong((byte) 0x0, calData, (byte) 0x0, new UnitAddress((byte) 0x04), null, new SerialInterfaceAddress((byte) 0x02), (byte) 0x0, null, cBusOptions, requestContext);
+        CALReply calReply;
+        if (exstat) {
+            calReply = new CALReplyLong((byte) 0x0, calData, (byte) 0x0, new UnitAddress((byte) 0x04), null, new SerialInterfaceAddress((byte) 0x02), (byte) 0x0, null, cBusOptions, requestContext);
+        } else {
+            calReply = new CALReplyShort((byte) 0x0, calData, cBusOptions, requestContext);
+        }
         CBusMessage response = createCBusMessageForReply(requestCommand.getAlpha(), calReply, cBusOptions);
         LOGGER.info("Send level status response\n{}", response);
         ctx.writeAndFlush(response);