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/incubator-plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 1699d4b  - Fixed the handling of empty elements in the S7 protocol 
(Setup-Communication Request Payload and Read Var Request Payload)
1699d4b is described below

commit 1699d4bbeec133a353923e9b5647e27b6611492e
Author: Christofer Dutz <christofer.d...@c-ware.de>
AuthorDate: Wed Jan 23 18:14:38 2019 +0100

    - Fixed the handling of empty elements in the S7 protocol 
(Setup-Communication Request Payload and Read Var Request Payload)
---
 .../protocols/s7-full-stack-protocol.dfdl.xsd      | 16 ++++++-
 .../apache/plc4x/protocols/s7-protocol.dfdl.xsd    | 16 ++++++-
 .../plc4x/protocols/s7-full-stack-protocol.tdml    | 51 +++++++++++++++++++---
 3 files changed, 73 insertions(+), 10 deletions(-)

diff --git 
a/protocols/src/main/dfdl/org/apache/plc4x/protocols/s7-full-stack-protocol.dfdl.xsd
 
b/protocols/src/main/dfdl/org/apache/plc4x/protocols/s7-full-stack-protocol.dfdl.xsd
index f220055..d9066c1 100644
--- 
a/protocols/src/main/dfdl/org/apache/plc4x/protocols/s7-full-stack-protocol.dfdl.xsd
+++ 
b/protocols/src/main/dfdl/org/apache/plc4x/protocols/s7-full-stack-protocol.dfdl.xsd
@@ -689,7 +689,13 @@
 
     -->
 
-    <xs:element name="S7GeneralPayloadSetupCommunication" type="xs:byte" 
dfdl:lengthKind="explicit" dfdl:length="0"/>
+    <xs:element name="S7GeneralPayloadSetupCommunication">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="payload" type="s7f:byte" minOccurs="0"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
     <xs:element name="S7RequestPayloadCpuServices">
         <xs:complexType>
@@ -749,7 +755,13 @@
         </xs:complexType>
     </xs:element>
 
-    <xs:element name="S7RequestPayloadReadVar" type="xs:byte" 
dfdl:lengthKind="explicit" dfdl:length="0"/>
+    <xs:element name="S7RequestPayloadReadVar">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="payload" type="s7f:byte" minOccurs="0"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
     <xs:element name="S7ResponsePayloadReadVar">
         <xs:complexType>
diff --git 
a/protocols/src/main/dfdl/org/apache/plc4x/protocols/s7-protocol.dfdl.xsd 
b/protocols/src/main/dfdl/org/apache/plc4x/protocols/s7-protocol.dfdl.xsd
index 6e90a81..fb584ed 100644
--- a/protocols/src/main/dfdl/org/apache/plc4x/protocols/s7-protocol.dfdl.xsd
+++ b/protocols/src/main/dfdl/org/apache/plc4x/protocols/s7-protocol.dfdl.xsd
@@ -415,7 +415,13 @@
 
     -->
 
-    <xs:element name="S7GeneralPayloadSetupCommunication" type="xs:byte" 
dfdl:lengthKind="explicit" dfdl:length="0"/>
+    <xs:element name="S7GeneralPayloadSetupCommunication">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="payload" type="s7f:byte" minOccurs="0"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
     <xs:element name="S7RequestPayloadCpuServices">
         <xs:complexType>
@@ -473,7 +479,13 @@
         </xs:complexType>
     </xs:element>
 
-    <xs:element name="S7RequestPayloadReadVar" type="xs:byte" 
dfdl:lengthKind="explicit" dfdl:length="0"/>
+    <xs:element name="S7RequestPayloadReadVar">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="payload" type="s7f:byte" minOccurs="0"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
     <xs:element name="S7ResponsePayloadReadVar">
         <xs:complexType>
diff --git 
a/protocols/src/test/resources/org/apache/plc4x/protocols/s7-full-stack-protocol.tdml
 
b/protocols/src/test/resources/org/apache/plc4x/protocols/s7-full-stack-protocol.tdml
index 752d57c..73c38c0 100644
--- 
a/protocols/src/test/resources/org/apache/plc4x/protocols/s7-full-stack-protocol.tdml
+++ 
b/protocols/src/test/resources/org/apache/plc4x/protocols/s7-full-stack-protocol.tdml
@@ -670,22 +670,23 @@
         </tdml:infoset>
     </tdml:parserTestCase>
 
-    <!--tdml:parserTestCase name="COTP: scenarioDataTpdu"
+    <tdml:parserTestCase name="COTP: scenarioDataTpdu"
                          root="tpktMessage"
                          model="s7Schema"
                          description="Typical Data TPDU used for transferring 
S7 packets.">
-        <!- Define the input ->
+        <!-- Define the input -->
         <tdml:document>
-            <tdml:documentPart 
type="byte">0300001f02f080320100000001000e00000401120a10010001000082000004</tdml:documentPart>
+            <tdml:documentPart 
type="byte">0300001f02f080320100000001000e00000401120a10010001000082000004
+            </tdml:documentPart>
         </tdml:document>
 
-        <!- Define the expected output ->
+        <!-- Define the expected output -->
         <tdml:infoset>
             <tdml:dfdlInfoset>
                 <test:tpktMessage>
                     <magicByte>3</magicByte>
                     <reserved>0</reserved>
-                    <length>29</length>
+                    <length>31</length>
                     <userData>
                         <headerLength>2</headerLength>
                         <type>240</type>
@@ -693,11 +694,49 @@
                             <endOfTransmission>1</endOfTransmission>
                             <tpduRef>0</tpduRef>
                         </CotpTpduData>
+                        <userData>
+                            <magicByte>50</magicByte>
+                            <type>1</type>
+                            <S7RequestMessage>
+                                <reserved>0</reserved>
+                                <tpduReference>1</tpduReference>
+                                <parametersLength>14</parametersLength>
+                                <payloadsLength>0</payloadsLength>
+                                <parameters>
+                                    <parameter>
+                                        <type>4</type>
+                                        <S7RequestParameterReadVar>
+                                            <numItems>1</numItems>
+                                            <items>
+                                                <item>
+                                                    <type>18</type>
+                                                    
<S7RequestParameterReadVarAnyItem>
+                                                        
<paramLength>10</paramLength>
+                                                        
<addressingMode>16</addressingMode>
+                                                        <dataType>1</dataType>
+                                                        
<numElements>1</numElements>
+                                                        
<dataBlockNumber>0</dataBlockNumber>
+                                                        
<memoryArea>130</memoryArea>
+                                                        
<byteOffset>0</byteOffset>
+                                                        
<bitOffset>4</bitOffset>
+                                                    
</S7RequestParameterReadVarAnyItem>
+                                                </item>
+                                            </items>
+                                        </S7RequestParameterReadVar>
+                                    </parameter>
+                                </parameters>
+                                <payloads>
+                                    <payload>
+                                        <S7RequestPayloadReadVar/>
+                                    </payload>
+                                </payloads>
+                            </S7RequestMessage>
+                        </userData>
                     </userData>
                 </test:tpktMessage>
             </tdml:dfdlInfoset>
         </tdml:infoset>
-    </tdml:parserTestCase-->
+    </tdml:parserTestCase>
 
 </testSuite>
 

Reply via email to