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/08/04 14:49:20 UTC

[plc4x] branch develop updated (ed60521db -> a7c38fb6f)

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

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


    from ed60521db feat(codegen/plc4j): fixed issue with name collision
     new 2aa5fb0d1 fix(plc-simulator/cbus): simulator should now use the right types for responses
     new a7c38fb6f feat: added new bacnet vendor ids

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../bacnetip/readwrite/model/BACnetVendorId.go     | 16 ++++++++
 .../simulator/server/cbus/CBusServerModule.java    |  2 +-
 .../server/cbus/protocol/CBusServerAdapter.java    | 44 +++++++++++-----------
 3 files changed, 38 insertions(+), 24 deletions(-)


[plc4x] 01/02: fix(plc-simulator/cbus): simulator should now use the right types for responses

Posted by sr...@apache.org.
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

commit 2aa5fb0d1c5f6719c693a8c45cc50c0ab6fdd9ea
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Aug 4 16:48:43 2022 +0200

    fix(plc-simulator/cbus): simulator should now use the right types for responses
---
 .../simulator/server/cbus/CBusServerModule.java    |  2 +-
 .../server/cbus/protocol/CBusServerAdapter.java    | 44 +++++++++++-----------
 2 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java
index 605d129cb..088ab4d41 100644
--- a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java
+++ b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/CBusServerModule.java
@@ -81,7 +81,7 @@ public class CBusServerModule implements ServerModule {
                         ChannelPipeline pipeline = channel.pipeline();
                         pipeline.addLast(new GeneratedProtocolMessageCodec<>(CBusMessage.class,
                             CBusMessage::staticParse, ByteOrder.BIG_ENDIAN,
-                            new Object[]{false, new RequestContext(false, false, false), new CBusOptions(false, false, false, false, false, false, false, false, false)},
+                            new Object[]{false, new RequestContext(false), new CBusOptions(false, false, false, false, false, false, false, false, false)},
                             new CBusDriver.ByteLengthEstimator(),
                             new CBusDriver.CorruptPackageCleaner()));
                         pipeline.addLast(new CBusServerAdapter(context));
diff --git a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java
index 9e277b357..3e4f766f3 100644
--- a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java
+++ b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java
@@ -25,6 +25,7 @@ import org.apache.plc4x.simulator.model.Context;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
@@ -37,7 +38,7 @@ public class CBusServerAdapter extends ChannelInboundHandlerAdapter {
 
     private Context context;
 
-    private static final RequestContext requestContext = new RequestContext(false, false, false);
+    private static final RequestContext requestContext = new RequestContext(false);
 
     private static boolean connect;
     private static boolean smart;
@@ -221,22 +222,21 @@ public class CBusServerAdapter extends ChannelInboundHandlerAdapter {
                         StatusRequest statusRequest = cBusPointToMultiPointCommandStatus.getStatusRequest();
                         if (statusRequest instanceof StatusRequestBinaryState) {
                             StatusRequestBinaryState statusRequestBinaryState = (StatusRequestBinaryState) statusRequest;
-                            EncodedReply encodedReply;
+                            CALReply calReply;
                             if (exstat) {
-                                ExtendedStatusHeader extendedStatusHeader = new ExtendedStatusHeader((short) (3 + 1));
                                 // TODO: map actuall values from simulator
                                 byte blockStart = 0x0;
                                 List<StatusByte> statusBytes = List.of(new StatusByte(GAVState.ON, GAVState.ERROR, GAVState.OFF, GAVState.DOES_NOT_EXIST));
-                                ExtendedFormatStatusReply extendedFormatStatusReply = new ExtendedFormatStatusReply(extendedStatusHeader, StatusCoding.BINARY_BY_THIS_SERIAL_INTERFACE, statusRequestBinaryState.getApplication(), blockStart, statusBytes, null);// 3 we have always + 1 as we got one status byte
-                                encodedReply = new EncodedReplyExtendedFormatStatusReply((byte) 0xE0, extendedFormatStatusReply, cBusOptions, requestContext);
+                                CALData calData = new CALDataStatusExtended(CALCommandTypeContainer.CALCommandReply_4Bytes, null, StatusCoding.BINARY_BY_THIS_SERIAL_INTERFACE, statusRequestBinaryState.getApplication(), blockStart, statusBytes, null, requestContext);
+                                calReply = new CALReplyLong((byte) 0x0, calData, (byte) 0x0, new UnitAddress((byte) 0x0), null, null, (byte) 0x0, null, cBusOptions, requestContext);
                             } else {
-                                StatusHeader statusHeader = new StatusHeader((short) (2 + 1)); // 2 we have always + 1 as we got one status byte
                                 // TODO: map actuall values from simulator
                                 byte blockStart = 0x0;
                                 List<StatusByte> statusBytes = List.of(new StatusByte(GAVState.ON, GAVState.ERROR, GAVState.OFF, GAVState.DOES_NOT_EXIST));
-                                StandardFormatStatusReply standardFormatStatusReply = new StandardFormatStatusReply(statusHeader, statusRequestBinaryState.getApplication(), blockStart, statusBytes);
-                                encodedReply = new EncodedReplyStandardFormatStatusReply((byte) 0xC0, standardFormatStatusReply, cBusOptions, requestContext);
+                                CALData calData = new CALDataStatus(CALCommandTypeContainer.CALCommandReply_3Bytes, null, statusRequestBinaryState.getApplication(), blockStart, statusBytes, requestContext);
+                                calReply = new CALReplyShort((byte) 0x0, calData, cBusOptions, requestContext);
                             }
+                            EncodedReply encodedReply = new EncodedReplyCALReply((byte) 0x0, calReply, cBusOptions, requestContext);
                             ReplyEncodedReply replyEncodedReply = new ReplyEncodedReply((byte) 0xC0, encodedReply, null, cBusOptions, requestContext);
                             ReplyOrConfirmation replyOrConfirmation = new ReplyOrConfirmationReply((byte) 0xFF, replyEncodedReply, new ResponseTermination(), cBusOptions, requestContext);
                             Alpha alpha = requestCommand.getAlpha();
@@ -257,13 +257,13 @@ public class CBusServerAdapter extends ChannelInboundHandlerAdapter {
                         }
                         if (statusRequest instanceof StatusRequestLevel) {
                             StatusRequestLevel statusRequestLevel = (StatusRequestLevel) statusRequest;
-                            ExtendedStatusHeader statusHeader = new ExtendedStatusHeader((short) (3 + 2)); // 3 we have always (coding is extra opposed to the standard) + 2 as we got one level information
                             StatusCoding coding = StatusCoding.LEVEL_BY_THIS_SERIAL_INTERFACE;
                             // TODO: map actuall values from simulator
                             byte blockStart = statusRequestLevel.getStartingGroupAddressLabel();
                             List<LevelInformation> levelInformations = List.of(new LevelInformationNormal(0x5555, LevelInformationNibblePair.Value_F, LevelInformationNibblePair.Value_F));
-                            ExtendedFormatStatusReply extendedFormatStatusReply = new ExtendedFormatStatusReply(statusHeader, coding, statusRequestLevel.getApplication(), blockStart, null, levelInformations);
-                            EncodedReply encodedReply = new EncodedReplyExtendedFormatStatusReply((byte) 0xC0, extendedFormatStatusReply, cBusOptions, requestContext);
+                            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) 0x0), null, null, (byte) 0x0, null, cBusOptions, requestContext);
+                            EncodedReply encodedReply = new EncodedReplyCALReply((byte) 0x0, calReply, cBusOptions, requestContext);
                             ReplyEncodedReply replyEncodedReply = new ReplyEncodedReply((byte) 0xC0, encodedReply, null, cBusOptions, requestContext);
                             ReplyOrConfirmation replyOrConfirmation = new ReplyOrConfirmationReply((byte) 0xFF, replyEncodedReply, new ResponseTermination(), cBusOptions, requestContext);
                             Alpha alpha = requestCommand.getAlpha();
@@ -416,20 +416,18 @@ public class CBusServerAdapter extends ChannelInboundHandlerAdapter {
                 writeLock.lock();
                 CALReply calReply;
                 if (cBusOptions.getExstat()) {
-                    byte[] data = {
-                        /*00|*/0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, //'..........'
-                        /*10|*/0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //'..........'
-                        /*20|*/0x00, 0x00, (byte) 0xFA,                                    //'...       '
-                    };
-                    CALData calData = new CALDataStatusExtended(CALCommandTypeContainer.CALCommandStatusExtended_25Bytes, null, (short) 0x40, ApplicationIdContainer.LIGHTING_38, (byte) 0x00, data, requestContext);
+                    List<StatusByte> statusBytes = new LinkedList<>();
+                    for (int i = 0; i < 21; i++) {
+                        statusBytes.add(new StatusByte(GAVState.ON, GAVState.ERROR, GAVState.OFF, GAVState.DOES_NOT_EXIST));
+                    }
+                    CALData calData = new CALDataStatusExtended(CALCommandTypeContainer.CALCommandStatusExtended_25Bytes, null, StatusCoding.BINARY_BY_ELSEWHERE, ApplicationIdContainer.LIGHTING_38, (byte) 0x00, statusBytes, null, requestContext);
                     calReply = new CALReplyLong((byte) 0x86, calData, 0x00, new UnitAddress((byte) 0x04), null, new SerialInterfaceAddress((byte) 0x02), (byte) 0x00, null, cBusOptions, requestContext);
                 } else {
-                    byte[] data = {
-                        /*00|*/0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, //'..........'
-                        /*10|*/0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //'..........'
-                        /*20|*/0x00, 0x00, (byte) 0xFA,                                    //'...       '
-                    };
-                    CALData calData = new CALDataStatus(CALCommandTypeContainer.CALCommandStatus_25Bytes, null, ApplicationIdContainer.LIGHTING_38, (byte) 0x00, data, requestContext);
+                    List<StatusByte> statusBytes = new LinkedList<>();
+                    for (int i = 0; i < 22; i++) {
+                        statusBytes.add(new StatusByte(GAVState.ON, GAVState.ERROR, GAVState.OFF, GAVState.DOES_NOT_EXIST));
+                    }
+                    CALData calData = new CALDataStatus(CALCommandTypeContainer.CALCommandStatus_25Bytes, null, ApplicationIdContainer.LIGHTING_38, (byte) 0x00, statusBytes, requestContext);
                     calReply = new CALReplyShort((byte) 0x0, calData, cBusOptions, requestContext);
                 }
                 EncodedReply encodedReply = new EncodedReplyCALReply((byte) 0x0, calReply, cBusOptions, requestContext);


[plc4x] 02/02: feat: added new bacnet vendor ids

Posted by sr...@apache.org.
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

commit a7c38fb6f604a542fa060af60cd92de654be9d2e
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Aug 4 16:49:12 2022 +0200

    feat: added new bacnet vendor ids
---
 .../protocols/bacnetip/readwrite/model/BACnetVendorId.go | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorId.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorId.go
index 6a43bb37a..0ac5c3e71 100644
--- a/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorId.go
+++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorId.go
@@ -1404,6 +1404,7 @@ const (
 	BACnetVendorId_ARENDARIT_SECURITY_GMBH                                                      BACnetVendorId = 1371
 	BACnetVendorId_ZED_BEE_TECHNOLOGIES_PVT_LTD                                                 BACnetVendorId = 1372
 	BACnetVendorId_WINMATE_TECHNOLOGY_SOLUTIONS_PVT_LTD                                         BACnetVendorId = 1373
+	BACnetVendorId_SENTICON_LTD                                                                 BACnetVendorId = 1374
 	BACnetVendorId_UNKNOWN_VENDOR                                                               BACnetVendorId = 0xFFFF
 )
 
@@ -2779,6 +2780,7 @@ func init() {
 		BACnetVendorId_ARENDARIT_SECURITY_GMBH,
 		BACnetVendorId_ZED_BEE_TECHNOLOGIES_PVT_LTD,
 		BACnetVendorId_WINMATE_TECHNOLOGY_SOLUTIONS_PVT_LTD,
+		BACnetVendorId_SENTICON_LTD,
 		BACnetVendorId_UNKNOWN_VENDOR,
 	}
 }
@@ -4457,6 +4459,10 @@ func (e BACnetVendorId) VendorId() uint16 {
 		{ /* '1373' */
 			return 1373
 		}
+	case 1374:
+		{ /* '1374' */
+			return 1374
+		}
 	case 138:
 		{ /* '138' */
 			return 138
@@ -9947,6 +9953,10 @@ func (e BACnetVendorId) VendorName() string {
 		{ /* '1373' */
 			return "Winmate Technology Solutions Pvt. Ltd."
 		}
+	case 1374:
+		{ /* '1374' */
+			return "Senticon Ltd."
+		}
 	case 138:
 		{ /* '138' */
 			return "PowerCold Comfort Air Solutions, Inc."
@@ -14600,6 +14610,8 @@ func BACnetVendorIdByValue(value uint16) (enum BACnetVendorId, ok bool) {
 		return BACnetVendorId_ZED_BEE_TECHNOLOGIES_PVT_LTD, true
 	case 1373:
 		return BACnetVendorId_WINMATE_TECHNOLOGY_SOLUTIONS_PVT_LTD, true
+	case 1374:
+		return BACnetVendorId_SENTICON_LTD, true
 	case 138:
 		return BACnetVendorId_POWER_COLD_COMFORT_AIR_SOLUTIONS_INC, true
 	case 139:
@@ -17342,6 +17354,8 @@ func BACnetVendorIdByName(value string) (enum BACnetVendorId, ok bool) {
 		return BACnetVendorId_ZED_BEE_TECHNOLOGIES_PVT_LTD, true
 	case "WINMATE_TECHNOLOGY_SOLUTIONS_PVT_LTD":
 		return BACnetVendorId_WINMATE_TECHNOLOGY_SOLUTIONS_PVT_LTD, true
+	case "SENTICON_LTD":
+		return BACnetVendorId_SENTICON_LTD, true
 	case "POWER_COLD_COMFORT_AIR_SOLUTIONS_INC":
 		return BACnetVendorId_POWER_COLD_COMFORT_AIR_SOLUTIONS_INC, true
 	case "I_CONTROLS":
@@ -20129,6 +20143,8 @@ func (e BACnetVendorId) PLC4XEnumName() string {
 		return "ZED_BEE_TECHNOLOGIES_PVT_LTD"
 	case BACnetVendorId_WINMATE_TECHNOLOGY_SOLUTIONS_PVT_LTD:
 		return "WINMATE_TECHNOLOGY_SOLUTIONS_PVT_LTD"
+	case BACnetVendorId_SENTICON_LTD:
+		return "SENTICON_LTD"
 	case BACnetVendorId_POWER_COLD_COMFORT_AIR_SOLUTIONS_INC:
 		return "POWER_COLD_COMFORT_AIR_SOLUTIONS_INC"
 	case BACnetVendorId_I_CONTROLS: