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

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

commit ef74a156bc34be4f216bfd71a79821d63eb2f505
Author: Ben Hutcheson <[email protected]>
AuthorDate: Mon Feb 6 15:07:23 2023 +0100

    fix(plc4j/profinet): Fixed issue with subslot and ident numbers.
---
 .../plc4x/java/profinet/device/ProfinetModuleImpl.java   |  6 ++++--
 .../src/main/resources/protocols/profinet/profinet.mspec | 16 ++++++++--------
 2 files changed, 12 insertions(+), 10 deletions(-)

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 9c6a7f2fe6..5063a2fc23 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
@@ -84,6 +84,7 @@ public class ProfinetModuleImpl implements ProfinetModule {
         if (module.getSystemDefinedSubmoduleList() != null) {
             for (ProfinetInterfaceSubmoduleItem interfaceItem : 
module.getSystemDefinedSubmoduleList().getInterfaceSubmodules()) {
                 Integer identNumber = 
Integer.decode(interfaceItem.getSubmoduleIdentNumber());
+                Integer subSlotNumber = interfaceItem.getSubslotNumber();
                 inputIoPsApiBlocks.add(new PnIoCm_IoDataObject(
                     slot,
                     interfaceItem.getSubslotNumber(),
@@ -93,7 +94,7 @@ public class ProfinetModuleImpl implements ProfinetModule {
                     interfaceItem.getSubslotNumber(),
                     outputIoCsOffset));
                 expectedSubModuleApiBlocks.add(new 
PnIoCm_Submodule_NoInputNoOutputData(
-                    identNumber,
+                    subSlotNumber,
                     identNumber,
                     false,
                     false,
@@ -105,6 +106,7 @@ public class ProfinetModuleImpl implements ProfinetModule {
             for (
                 ProfinetPortSubmoduleItem portItem : 
module.getSystemDefinedSubmoduleList().getPortSubmodules()) {
                 Integer identNumber = 
Integer.decode(portItem.getSubmoduleIdentNumber());
+                Integer subSlotNumber = portItem.getSubslotNumber();
                 inputIoPsApiBlocks.add(new PnIoCm_IoDataObject(
                     0,
                     portItem.getSubslotNumber(),
@@ -114,7 +116,7 @@ public class ProfinetModuleImpl implements ProfinetModule {
                     portItem.getSubslotNumber(),
                     outputIoCsOffset));
                 expectedSubModuleApiBlocks.add(new 
PnIoCm_Submodule_NoInputNoOutputData(
-                    identNumber,
+                    subSlotNumber,
                     identNumber,
                     false,
                     false,
diff --git 
a/protocols/profinet/src/main/resources/protocols/profinet/profinet.mspec 
b/protocols/profinet/src/main/resources/protocols/profinet/profinet.mspec
index d4b9c74814..6cd2a87f18 100644
--- a/protocols/profinet/src/main/resources/protocols/profinet/profinet.mspec
+++ b/protocols/profinet/src/main/resources/protocols/profinet/profinet.mspec
@@ -101,24 +101,24 @@
         ['END_OF_LLDP'  EndOfLldp
         ]
         ['CHASSIS_ID'   TlvChassisId(uint 9 tlvIdLength)
-            [simple     uint 8                        chassisIdSubType         
      ]
-            [simple     vstring     '(tlvIdLength - 1) * 8' chassisId          
            ]
+            [simple     uint 8                        chassisIdSubType         
     ]
+            [simple     vstring     '(tlvIdLength - 1) * 8' chassisId          
     ]
         ]
         ['PORT_ID'   TlvPortId(uint 9 tlvIdLength)
-            [simple     uint 8          portIdSubType                          
    ]
-            [simple     vstring     '(tlvIdLength - 1) * 8' portId             
              ]
+            [simple     uint 8          portIdSubType                          
     ]
+            [simple     vstring     '(tlvIdLength - 1) * 8' portId             
     ]
         ]
         ['TIME_TO_LIVE'   TlvTimeToLive
-            [simple     uint 16         tlvTimeToLiveUnit                      
    ]
+            [simple     uint 16         tlvTimeToLiveUnit                      
     ]
         ]
         ['PORT_DESCRIPTION'   TlvPortDescription(uint 9 tlvIdLength)
-            [simple     vstring     '(tlvIdLength) * 8' chassisId              
        ]
+            [simple     vstring     '(tlvIdLength) * 8' chassisId              
     ]
         ]
         ['SYSTEM_NAME'   TlvSystemName(uint 9 tlvIdLength)
-            [simple     vstring     '(tlvIdLength) * 8' chassisId              
        ]
+            [simple     vstring     '(tlvIdLength) * 8' chassisId              
     ]
         ]
         ['SYSTEM_DESCRIPTION'   TlvSystemDescription(uint 9 tlvIdLength)
-            [simple     vstring     '(tlvIdLength) * 8' chassisId              
        ]
+            [simple     vstring     '(tlvIdLength) * 8' chassisId              
     ]
         ]
         ['SYSTEM_CAPABILITIES'   TlvSystemCapabilities
             [reserved   uint 8                          '0x00'                 
     ]

Reply via email to