You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2024/10/20 11:50:27 UTC
(plc4x) branch develop updated (112261adf5 -> 49af0805ea)
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
from 112261adf5 fix(plc4j): Disable opcua tests on Jenkins.
new b2ac656955 chore: Update knx manufacturer ids.
new ccf6ebebab refactor: Cleaned up the array handling in browse-items.
new 49af0805ea chore: Added a testcase (however commmented out) for testing handling of large arrays.
The 3 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:
.../knxnetip/readwrite/model/KnxManufacturer.go | 2 +-
.../plc4x/java/api/messages/PlcBrowseItem.java | 3 +-
.../plc4x/java/ads/protocol/AdsProtocolLogic.java | 20 ++--
.../readwrite/connection/CtrlXConnection.java | 4 +-
.../java/knxnetip/readwrite/KnxManufacturer.java | 2 +-
.../profinet/protocol/ProfinetProtocolLogic.java | 4 +-
.../java/profinet/device/ProfinetModuleImpl.java | 10 +-
.../java/s7/readwrite/ManualS71200DriverTest.java | 13 +++
.../java/spi/messages/DefaultPlcBrowseItem.java | 12 ++-
.../messages/DefaultPlcBrowseItemArrayInfo.java | 44 --------
.../spi/messages/DefaultPlcBrowseItemList.java | 117 ---------------------
.../knxnetip/readwrite/model/KnxManufacturer.cs | 2 +-
.../protocols/knxnetip/knx-master-data.mspec | 2 +-
13 files changed, 45 insertions(+), 190 deletions(-)
delete mode 100644 plc4j/spi/src/main/java/org/apache/plc4x/java/spi/messages/DefaultPlcBrowseItemArrayInfo.java
delete mode 100644 plc4j/spi/src/main/java/org/apache/plc4x/java/spi/messages/DefaultPlcBrowseItemList.java
(plc4x) 01/03: chore: Update knx manufacturer ids.
Posted by cd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit b2ac6569556fac7ad2906b322df02bbee92f5c44
Author: Christofer Dutz <cd...@apache.org>
AuthorDate: Sun Oct 20 13:48:49 2024 +0200
chore: Update knx manufacturer ids.
---
plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go | 2 +-
.../org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java | 2 +-
.../knxnetip/src/drivers/knxnetip/readwrite/model/KnxManufacturer.cs | 2 +-
.../src/main/generated/protocols/knxnetip/knx-master-data.mspec | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go b/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go
index 5968d0b9fb..e7e0e82b44 100644
--- a/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go
+++ b/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go
@@ -5957,7 +5957,7 @@ func (e KnxManufacturer) Name() string {
}
case 487:
{ /* '487' */
- return "dovit"
+ return "DOVIT"
}
case 488:
{ /* '488' */
diff --git a/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java b/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java
index 36b64647e0..7df49b8722 100644
--- a/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java
+++ b/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java
@@ -559,7 +559,7 @@ public enum KnxManufacturer {
M_BERGHOF_AUTOMATION_GMBH((int) 485, (int) 540, (String) "Berghof Automation GmbH"),
M_TOTAL_AUTOMATION_AND_CONTROLS_GMBH(
(int) 486, (int) 541, (String) "Total Automation and controls GmbH"),
- M_DOVIT((int) 487, (int) 542, (String) "dovit"),
+ M_DOVIT((int) 487, (int) 542, (String) "DOVIT"),
M_INSTALIGHTING_GMBH((int) 488, (int) 543, (String) "Instalighting GmbH"),
M_UNI_TEC((int) 489, (int) 544, (String) "UNI-TEC"),
M_CASATUNES((int) 490, (int) 545, (String) "CasaTunes"),
diff --git a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxManufacturer.cs b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxManufacturer.cs
index 5779e2a485..a3d6dbfd91 100644
--- a/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxManufacturer.cs
+++ b/plc4net/drivers/knxnetip/src/drivers/knxnetip/readwrite/model/KnxManufacturer.cs
@@ -4109,7 +4109,7 @@ namespace org.apache.plc4net.drivers.knxnetip.readwrite.model
return "Total Automation and controls GmbH";
}
case KnxManufacturer.M_DOVIT: { /* '487' */
- return "dovit";
+ return "DOVIT";
}
case KnxManufacturer.M_INSTALIGHTING_GMBH: { /* '488' */
return "Instalighting GmbH";
diff --git a/protocols/knxnetip/src/main/generated/protocols/knxnetip/knx-master-data.mspec b/protocols/knxnetip/src/main/generated/protocols/knxnetip/knx-master-data.mspec
index 76462760eb..1af52d8eb5 100644
--- a/protocols/knxnetip/src/main/generated/protocols/knxnetip/knx-master-data.mspec
+++ b/protocols/knxnetip/src/main/generated/protocols/knxnetip/knx-master-data.mspec
@@ -1236,7 +1236,7 @@
['484' M_STILIGER ['539', '"Stiliger"']]
['485' M_BERGHOF_AUTOMATION_GMBH ['540', '"Berghof Automation GmbH"']]
['486' M_TOTAL_AUTOMATION_AND_CONTROLS_GMBH ['541', '"Total Automation and controls GmbH"']]
- ['487' M_DOVIT ['542', '"dovit"']]
+ ['487' M_DOVIT ['542', '"DOVIT"']]
['488' M_INSTALIGHTING_GMBH ['543', '"Instalighting GmbH"']]
['489' M_UNI_TEC ['544', '"UNI-TEC"']]
['490' M_CASATUNES ['545', '"CasaTunes"']]
(plc4x) 03/03: chore: Added a testcase (however commmented out) for testing handling of large arrays.
Posted by cd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 49af0805ea1ce652e082129e1789dc5c2b181da4
Author: Christofer Dutz <cd...@apache.org>
AuthorDate: Sun Oct 20 13:50:18 2024 +0200
chore: Added a testcase (however commmented out) for testing handling of large arrays.
---
.../plc4x/java/s7/readwrite/ManualS71200DriverTest.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/readwrite/ManualS71200DriverTest.java b/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/readwrite/ManualS71200DriverTest.java
index c02494d9be..1c5a7e3211 100644
--- a/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/readwrite/ManualS71200DriverTest.java
+++ b/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/readwrite/ManualS71200DriverTest.java
@@ -96,6 +96,19 @@ public class ManualS71200DriverTest extends ManualTest {
test.addTestCase("%DB4:72:TIME_OF_DAY", new PlcTIME_OF_DAY(LocalTime.parse("15:36:30.123")));
test.addTestCase("%DB4:908:CHAR[5]", new PlcList(Arrays.asList(new PlcCHAR("w"), new PlcCHAR("i"), new PlcCHAR("e"), new PlcCHAR("s"), new PlcCHAR("e"))));
test.addTestCase("%DB4:914:RAW_BYTE_ARRAY[11]", new PlcRawByteArray(new byte[] {(byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9, (byte) 10, (byte) 11}));
+ // Disabled, as we currently only have the large-array-splitting for read requests.
+ /*test.addTestCase("%DB4:926:DINT[100]", new PlcList(Arrays.asList(new PlcDINT(1), new PlcDINT(2), new PlcDINT(3), new PlcDINT(4), new PlcDINT(5), new PlcDINT(6), new PlcDINT(7), new PlcDINT(8), new PlcDINT(9),
+ new PlcDINT(0), new PlcDINT(1), new PlcDINT(2), new PlcDINT(3), new PlcDINT(4), new PlcDINT(5), new PlcDINT(6), new PlcDINT(7), new PlcDINT(8), new PlcDINT(9),
+ new PlcDINT(0), new PlcDINT(1), new PlcDINT(2), new PlcDINT(3), new PlcDINT(4), new PlcDINT(5), new PlcDINT(6), new PlcDINT(7), new PlcDINT(8), new PlcDINT(9),
+ new PlcDINT(0), new PlcDINT(1), new PlcDINT(2), new PlcDINT(3), new PlcDINT(4), new PlcDINT(5), new PlcDINT(6), new PlcDINT(7), new PlcDINT(8), new PlcDINT(9),
+ new PlcDINT(0), new PlcDINT(1), new PlcDINT(2), new PlcDINT(3), new PlcDINT(4), new PlcDINT(5), new PlcDINT(6), new PlcDINT(7), new PlcDINT(8), new PlcDINT(9),
+ new PlcDINT(0), new PlcDINT(1), new PlcDINT(2), new PlcDINT(3), new PlcDINT(4), new PlcDINT(5), new PlcDINT(6), new PlcDINT(7), new PlcDINT(8), new PlcDINT(9),
+ new PlcDINT(0), new PlcDINT(1), new PlcDINT(2), new PlcDINT(3), new PlcDINT(4), new PlcDINT(5), new PlcDINT(6), new PlcDINT(7), new PlcDINT(8), new PlcDINT(9),
+ new PlcDINT(0), new PlcDINT(1), new PlcDINT(2), new PlcDINT(3), new PlcDINT(4), new PlcDINT(5), new PlcDINT(6), new PlcDINT(7), new PlcDINT(8), new PlcDINT(9),
+ new PlcDINT(0), new PlcDINT(1), new PlcDINT(2), new PlcDINT(3), new PlcDINT(4), new PlcDINT(5), new PlcDINT(6), new PlcDINT(7), new PlcDINT(8), new PlcDINT(9),
+ new PlcDINT(0), new PlcDINT(1), new PlcDINT(2), new PlcDINT(3), new PlcDINT(4), new PlcDINT(5), new PlcDINT(6), new PlcDINT(7), new PlcDINT(8), new PlcDINT(9),
+ new PlcDINT(0))));
+ */
long start = System.currentTimeMillis();
test.run();
(plc4x) 02/03: refactor: Cleaned up the array handling in browse-items.
Posted by cd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit ccf6ebebab36e1bf8d0bd568aa26ffab33a1546b
Author: Christofer Dutz <cd...@apache.org>
AuthorDate: Sun Oct 20 13:49:50 2024 +0200
refactor: Cleaned up the array handling in browse-items.
---
.../plc4x/java/api/messages/PlcBrowseItem.java | 3 +-
.../plc4x/java/ads/protocol/AdsProtocolLogic.java | 20 ++--
.../readwrite/connection/CtrlXConnection.java | 4 +-
.../profinet/protocol/ProfinetProtocolLogic.java | 4 +-
.../java/profinet/device/ProfinetModuleImpl.java | 10 +-
.../java/spi/messages/DefaultPlcBrowseItem.java | 12 ++-
.../messages/DefaultPlcBrowseItemArrayInfo.java | 44 --------
.../spi/messages/DefaultPlcBrowseItemList.java | 117 ---------------------
8 files changed, 28 insertions(+), 186 deletions(-)
diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/messages/PlcBrowseItem.java b/plc4j/api/src/main/java/org/apache/plc4x/java/api/messages/PlcBrowseItem.java
index fdc147332a..2de156b74b 100644
--- a/plc4j/api/src/main/java/org/apache/plc4x/java/api/messages/PlcBrowseItem.java
+++ b/plc4j/api/src/main/java/org/apache/plc4x/java/api/messages/PlcBrowseItem.java
@@ -18,6 +18,7 @@
*/
package org.apache.plc4x.java.api.messages;
+import org.apache.plc4x.java.api.model.ArrayInfo;
import org.apache.plc4x.java.api.model.PlcTag;
import org.apache.plc4x.java.api.value.PlcValue;
@@ -61,7 +62,7 @@ public interface PlcBrowseItem {
/**
* @return list of elements providing information about the array dimensions of this item.
*/
- List<PlcBrowseItemArrayInfo> getArrayInformation();
+ List<ArrayInfo> getArrayInformation();
/**
* @return returns any children this item might have
diff --git a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java
index e4edbe1ccc..08eaa141d0 100644
--- a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java
+++ b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java
@@ -523,15 +523,15 @@ public class AdsProtocolLogic extends Plc4xProtocolBase<AmsTCPPacket> implements
options.put("size-in-bytes", new PlcUDINT(symbol.getSize()));
List<ArrayInfo> arrayInfo = new ArrayList<>(dataType.getArrayInfo().size());
- List<PlcBrowseItemArrayInfo> itemArrayInfo = new ArrayList<>(dataType.getArrayInfo().size());
+ List<ArrayInfo> itemArrayInfo = new ArrayList<>(dataType.getArrayInfo().size());
for (AdsDataTypeArrayInfo adsDataTypeArrayInfo : dataType.getArrayInfo()) {
arrayInfo.add(new DefaultArrayInfo(
(int) adsDataTypeArrayInfo.getLowerBound(), (int) adsDataTypeArrayInfo.getUpperBound()));
- itemArrayInfo.add(new DefaultPlcBrowseItemArrayInfo(
- adsDataTypeArrayInfo.getLowerBound(), adsDataTypeArrayInfo.getUpperBound()));
+ itemArrayInfo.add(new DefaultArrayInfo(
+ (int) adsDataTypeArrayInfo.getLowerBound(), (int) adsDataTypeArrayInfo.getUpperBound()));
}
- DefaultPlcBrowseItemList item = new DefaultPlcBrowseItemList(new SymbolicAdsTag(symbol.getName(), plcValueType, arrayInfo), symbol.getName(),
- true, !symbol.getFlagReadOnly(), true, false, childMap, options, itemArrayInfo);
+ DefaultPlcBrowseItem item = new DefaultPlcBrowseItem(new SymbolicAdsTag(symbol.getName(), plcValueType, arrayInfo), symbol.getName(),
+ true, !symbol.getFlagReadOnly(), true, false, itemArrayInfo, childMap, options);
// Check if this item should be added to the result
if (interceptor.intercept(item)) {
@@ -585,17 +585,17 @@ public class AdsProtocolLogic extends Plc4xProtocolBase<AmsTCPPacket> implements
options.put("size-in-bytes", new PlcUDINT(childDataType.getSize()));
List<ArrayInfo> arrayInfo = new ArrayList<>(childDataType.getArrayInfo().size());
- List<PlcBrowseItemArrayInfo> itemArrayInfo = new ArrayList<>(childDataType.getArrayInfo().size());
+ List<ArrayInfo> itemArrayInfo = new ArrayList<>(childDataType.getArrayInfo().size());
for (AdsDataTypeArrayInfo adsDataTypeArrayInfo : childDataType.getArrayInfo()) {
arrayInfo.add(new DefaultArrayInfo(
(int) adsDataTypeArrayInfo.getLowerBound(), (int) adsDataTypeArrayInfo.getUpperBound()));
- itemArrayInfo.add(new DefaultPlcBrowseItemArrayInfo(
- adsDataTypeArrayInfo.getLowerBound(), adsDataTypeArrayInfo.getUpperBound()));
+ itemArrayInfo.add(new DefaultArrayInfo(
+ (int) adsDataTypeArrayInfo.getLowerBound(), (int) adsDataTypeArrayInfo.getUpperBound()));
}
// Add the type itself.
- values.add(new DefaultPlcBrowseItemList(new SymbolicAdsTag(
+ values.add(new DefaultPlcBrowseItem(new SymbolicAdsTag(
basePath + "." + child.getPropertyName(), plc4xPlcValueType, arrayInfo), child.getPropertyName(),
- true, parentWritable, true, false, childMap, options, itemArrayInfo));
+ true, parentWritable, true, false, itemArrayInfo, childMap, options));
}
return values;
}
diff --git a/plc4j/drivers/ctrlx/src/main/java/org/apache/plc4x/java/ctrlx/readwrite/connection/CtrlXConnection.java b/plc4j/drivers/ctrlx/src/main/java/org/apache/plc4x/java/ctrlx/readwrite/connection/CtrlXConnection.java
index dfff73c39b..454fdb2f72 100644
--- a/plc4j/drivers/ctrlx/src/main/java/org/apache/plc4x/java/ctrlx/readwrite/connection/CtrlXConnection.java
+++ b/plc4j/drivers/ctrlx/src/main/java/org/apache/plc4x/java/ctrlx/readwrite/connection/CtrlXConnection.java
@@ -274,10 +274,10 @@ public class CtrlXConnection implements PlcConnection, PlcPinger, PlcBrowser {
e.printStackTrace();
}*/
matchingQueryNames.forEach(queryName -> responseItems.get(queryName).add(
- new DefaultPlcBrowseItemList(
+ new DefaultPlcBrowseItem(
new CtrlXTag(curNode, PlcValueType.BOOL, Collections.emptyList()),
curNode, true, true, true, false,
- Collections.emptyMap(), Collections.emptyMap(), Collections.emptyList())));
+ Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap())));
}
}
// If this node has children, then it's branch, and we need to add its children to the queue.
diff --git a/plc4j/drivers/profinet-ng/src/main/java/org/apache/plc4x/java/profinet/protocol/ProfinetProtocolLogic.java b/plc4j/drivers/profinet-ng/src/main/java/org/apache/plc4x/java/profinet/protocol/ProfinetProtocolLogic.java
index 68f1c39353..2999014978 100644
--- a/plc4j/drivers/profinet-ng/src/main/java/org/apache/plc4x/java/profinet/protocol/ProfinetProtocolLogic.java
+++ b/plc4j/drivers/profinet-ng/src/main/java/org/apache/plc4x/java/profinet/protocol/ProfinetProtocolLogic.java
@@ -364,7 +364,7 @@ public class ProfinetProtocolLogic extends Plc4xProtocolBase<Ethernet_Frame> imp
slot, subslot, ProfinetTag.Direction.INPUT,
i, dataTypeInformation.getPlcValueType(), dataTypeInformation.getNumElements()),
name, false, true, true, false,
- Collections.emptyMap(), Collections.emptyMap()));
+ Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap()));
}
}
}
@@ -382,7 +382,7 @@ public class ProfinetProtocolLogic extends Plc4xProtocolBase<Ethernet_Frame> imp
slot, subslot, ProfinetTag.Direction.OUTPUT,
i, dataTypeInformation.getPlcValueType(), dataTypeInformation.getNumElements()),
name, false, true, true, false,
- Collections.emptyMap(), Collections.emptyMap()));
+ Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap()));
}
}
}
diff --git a/plc4j/drivers/profinet/src/main/java/org/apache/plc4x/java/profinet/device/ProfinetModuleImpl.java b/plc4j/drivers/profinet/src/main/java/org/apache/plc4x/java/profinet/device/ProfinetModuleImpl.java
index 63a6f8d431..808117c479 100644
--- a/plc4j/drivers/profinet/src/main/java/org/apache/plc4x/java/profinet/device/ProfinetModuleImpl.java
+++ b/plc4j/drivers/profinet/src/main/java/org/apache/plc4x/java/profinet/device/ProfinetModuleImpl.java
@@ -264,19 +264,19 @@ public class ProfinetModuleImpl implements ProfinetModule {
}
String statusName = addressSpace + "." + this.slot + "." + block.getSubSlotNumber() + "." + virtual.getId() + ".Status";
- browseItems.add(new DefaultPlcBrowseItem(ProfinetTag.of(statusName + ":INT"), statusName, false, false, true, false, new HashMap<>(), options));
+ browseItems.add(new DefaultPlcBrowseItem(ProfinetTag.of(statusName + ":INT"), statusName, false, false, true, false, Collections.emptyList(), new HashMap<>(), options));
if (virtual.getIoData() != null && virtual.getIoData().getInput() != null) {
for (ProfinetIoDataInput input : virtual.getIoData().getInput()) {
for (ProfinetDataItem item : input.getDataItemList()) {
if (item.isUseAsBits()) {
for (int i = 0; i < ProfinetDataType.firstEnumForFieldConversion(item.getDataType().toUpperCase()).getDataTypeSize() * 8; i++) {
String tagName = addressSpace + "." + this.slot + "." + block.getSubSlotNumber() + "." + item.getTextId() + "." + i;
- browseItems.add(new DefaultPlcBrowseItem(ProfinetTag.of(tagName + ":BOOL"), tagName, false, false, true, false, new HashMap<>(), options));
+ browseItems.add(new DefaultPlcBrowseItem(ProfinetTag.of(tagName + ":BOOL"), tagName, false, false, true, false, Collections.emptyList(), new HashMap<>(), options));
}
} else {
String tagName = addressSpace + "." + this.slot + "." + block.getSubSlotNumber() + "." + item.getTextId();
String datatype = ProfinetDataType.firstEnumForFieldConversion(item.getDataType().toUpperCase()).toString();
- browseItems.add(new DefaultPlcBrowseItem(ProfinetTag.of(tagName + ":" + datatype), tagName, false, false, true, false, new HashMap<>(), options));
+ browseItems.add(new DefaultPlcBrowseItem(ProfinetTag.of(tagName + ":" + datatype), tagName, false, false, true, false, Collections.emptyList(), new HashMap<>(), options));
}
}
}
@@ -287,13 +287,13 @@ public class ProfinetModuleImpl implements ProfinetModule {
for (ProfinetInterfaceSubmoduleItem systemInterface : module.getSystemDefinedSubmoduleList().getInterfaceSubmodules()) {
if (identNumber == systemInterface.getSubslotNumber()) {
String statusName = addressSpace + "." + this.slot + "." + block.getSubSlotNumber() + "." + systemInterface.getId() + ".Status";
- browseItems.add(new DefaultPlcBrowseItem(ProfinetTag.of(statusName + ":INT"), statusName, false, false, true, false, new HashMap<>(), options));
+ browseItems.add(new DefaultPlcBrowseItem(ProfinetTag.of(statusName + ":INT"), statusName, false, false, true, false, Collections.emptyList(), new HashMap<>(), options));
}
}
for (ProfinetPortSubmoduleItem systemPort : module.getSystemDefinedSubmoduleList().getPortSubmodules()) {
if (identNumber == systemPort.getSubslotNumber()) {
String statusName = addressSpace + "." + this.slot + "." + block.getSubSlotNumber() + "." + systemPort.getId() + ".Status";
- browseItems.add(new DefaultPlcBrowseItem(ProfinetTag.of(statusName + ":INT"), statusName, false, false, true, false, new HashMap<>(), options));
+ browseItems.add(new DefaultPlcBrowseItem(ProfinetTag.of(statusName + ":INT"), statusName, false, false, true, false, Collections.emptyList(), new HashMap<>(), options));
}
}
}
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/messages/DefaultPlcBrowseItem.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/messages/DefaultPlcBrowseItem.java
index 304737b5aa..57df37bd3c 100644
--- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/messages/DefaultPlcBrowseItem.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/messages/DefaultPlcBrowseItem.java
@@ -19,7 +19,7 @@
package org.apache.plc4x.java.spi.messages;
import org.apache.plc4x.java.api.messages.PlcBrowseItem;
-import org.apache.plc4x.java.api.messages.PlcBrowseItemArrayInfo;
+import org.apache.plc4x.java.api.model.ArrayInfo;
import org.apache.plc4x.java.api.model.PlcTag;
import org.apache.plc4x.java.api.value.PlcValue;
import org.apache.plc4x.java.spi.codegen.WithOption;
@@ -28,7 +28,6 @@ import org.apache.plc4x.java.spi.generation.WriteBuffer;
import org.apache.plc4x.java.spi.utils.Serializable;
import java.nio.charset.StandardCharsets;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -43,8 +42,8 @@ public class DefaultPlcBrowseItem implements PlcBrowseItem, Serializable {
private final boolean subscribable;
private final boolean publishable;
+ private final List<ArrayInfo> arrayInformation;
private final Map<String, PlcBrowseItem> children;
-
private final Map<String, PlcValue> options;
public DefaultPlcBrowseItem(PlcTag tag,
@@ -53,6 +52,7 @@ public class DefaultPlcBrowseItem implements PlcBrowseItem, Serializable {
boolean writable,
boolean subscribable,
boolean publishable,
+ List<ArrayInfo> arrayInformation,
Map<String, PlcBrowseItem> children,
Map<String, PlcValue> options) {
this.tag = tag;
@@ -61,6 +61,7 @@ public class DefaultPlcBrowseItem implements PlcBrowseItem, Serializable {
this.writable = writable;
this.subscribable = subscribable;
this.publishable = publishable;
+ this.arrayInformation = arrayInformation;
this.children = children;
this.options = options;
}
@@ -72,6 +73,7 @@ public class DefaultPlcBrowseItem implements PlcBrowseItem, Serializable {
this.writable = original.isWritable();
this.subscribable = original.isSubscribable();
this.publishable = original.isPublishable();
+ this.arrayInformation = original.getArrayInformation();
this.options = original.getOptions();
this.children = children;
}
@@ -112,8 +114,8 @@ public class DefaultPlcBrowseItem implements PlcBrowseItem, Serializable {
}
@Override
- public List<PlcBrowseItemArrayInfo> getArrayInformation() {
- return Collections.emptyList();
+ public List<ArrayInfo> getArrayInformation() {
+ return arrayInformation;
}
@Override
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/messages/DefaultPlcBrowseItemArrayInfo.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/messages/DefaultPlcBrowseItemArrayInfo.java
deleted file mode 100644
index 5be3aae609..0000000000
--- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/messages/DefaultPlcBrowseItemArrayInfo.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.plc4x.java.spi.messages;
-
-import org.apache.plc4x.java.api.messages.PlcBrowseItemArrayInfo;
-
-public class DefaultPlcBrowseItemArrayInfo implements PlcBrowseItemArrayInfo {
-
- private final long lowerBound;
- private final long upperBound;
-
- public DefaultPlcBrowseItemArrayInfo(long lowerBound, long upperBound) {
- this.lowerBound = lowerBound;
- this.upperBound = upperBound;
- }
-
- @Override
- public long getLowerBound() {
- return lowerBound;
- }
-
- @Override
- public long getUpperBound() {
- return upperBound;
- }
-
-}
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/messages/DefaultPlcBrowseItemList.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/messages/DefaultPlcBrowseItemList.java
deleted file mode 100644
index 50ad9363a4..0000000000
--- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/messages/DefaultPlcBrowseItemList.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.plc4x.java.spi.messages;
-
-import org.apache.plc4x.java.api.messages.PlcBrowseItem;
-import org.apache.plc4x.java.api.messages.PlcBrowseItemArrayInfo;
-import org.apache.plc4x.java.api.model.PlcTag;
-import org.apache.plc4x.java.api.value.PlcValue;
-import org.apache.plc4x.java.spi.codegen.WithOption;
-import org.apache.plc4x.java.spi.generation.SerializationException;
-import org.apache.plc4x.java.spi.generation.WriteBuffer;
-
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-import java.util.Map;
-
-public class DefaultPlcBrowseItemList extends DefaultPlcBrowseItem {
-
- private final List<PlcBrowseItemArrayInfo> arrayInformation;
-
- public DefaultPlcBrowseItemList(PlcTag tag,
- String name,
- boolean readable,
- boolean writable,
- boolean subscribable,
- boolean publishable,
- Map<String, PlcBrowseItem> children,
- Map<String, PlcValue> options,
- List<PlcBrowseItemArrayInfo> arrayInformation) {
- super(tag, name, readable, writable, subscribable, publishable, children, options);
- this.arrayInformation = arrayInformation;
- }
-
- @Override
- public boolean isArray() {
- return (arrayInformation != null) && !arrayInformation.isEmpty();
- }
-
- @Override
- public List<PlcBrowseItemArrayInfo> getArrayInformation() {
- return arrayInformation;
- }
-
- /*@Override
- public PlcBrowseItem resolveArrayItems() {
- if((arrayInformation == null) || (arrayInformation.isEmpty())) {
- return super.resolveArrayItems();
- }
- return resolveInternal(getTag() ,arrayInformation);
- }
-
- protected PlcBrowseItem resolveInternal(PlcTag tag, List<PlcBrowseItemArrayInfo> arrayInformation) {
- if(arrayInformation.isEmpty()) {
-
- }
- for (PlcBrowseItemArrayInfo arrayInfo : arrayInformation) {
- for(long i = arrayInfo.getLowerBound(); i <= arrayInfo.getUpperBound(); i++) {
-
- }
- }
- return this;
- }*/
-
- @Override
- public void serialize(WriteBuffer writeBuffer) throws SerializationException {
- writeBuffer.pushContext("PlcBrowseItemList");
- writeBuffer.writeString("address",
- getTag().getAddressString().getBytes(StandardCharsets.UTF_8).length * 8,
- getTag().getAddressString(), WithOption.WithEncoding(StandardCharsets.UTF_8.name()));
- writeBuffer.writeString("name",
- getName().getBytes(StandardCharsets.UTF_8).length * 8,
- getName(), WithOption.WithEncoding(StandardCharsets.UTF_8.name()));
- // TODO: Find out how to serialize an enum.
- //writeBuffer.writeString("dataType", dataType.getBytes(StandardCharsets.UTF_8).length * 8, StandardCharsets.UTF_8.name(), dataType);
- if(getChildren() != null && !getChildren().isEmpty()) {
- writeBuffer.pushContext("children");
- for (PlcBrowseItem child : getChildren().values()) {
- writeBuffer.pushContext("child");
- ((DefaultPlcBrowseItemList) child).serialize(writeBuffer);
- writeBuffer.popContext("child");
- }
- writeBuffer.popContext("children");
- }
- if(getOptions() != null && !getOptions().isEmpty()) {
- writeBuffer.pushContext("options");
- for (Map.Entry<String, PlcValue> optionEntry : getOptions().entrySet()) {
- writeBuffer.pushContext("option");
- writeBuffer.writeString("name",
- optionEntry.getKey().getBytes(StandardCharsets.UTF_8).length * 8,
- optionEntry.getKey(), WithOption.WithEncoding(StandardCharsets.UTF_8.name()));
- // TODO: Find out how to serialize a PlcValue
- //writeBuffer.writeString("value", optionEntry.getValue().getBytes(StandardCharsets.UTF_8).length * 8, StandardCharsets.UTF_8.name(), optionEntry.getValue());
- ((DefaultPlcBrowseItemList) optionEntry).serialize(writeBuffer);
- writeBuffer.popContext("option");
- }
- writeBuffer.popContext("options");
- }
- writeBuffer.popContext("PlcBrowseItemList");
- }
-
-}