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 2019/10/14 16:08:38 UTC
[plc4x] 02/03: - Tried to clean up in the S7 mspec regarding the
TransportSize (It turned out that multiple values resulted in the same
transport sizes, I therefore split up everything into ParameterSize,
PayloadSize and a Types type that maps the other two)
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/plc-simulator
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 30821ccfdebe8c34016fc73884b0807416f2e873
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Oct 14 17:59:55 2019 +0200
- Tried to clean up in the S7 mspec regarding the TransportSize (It turned out that multiple values resulted in the same transport sizes, I therefore split up everything into ParameterSize, PayloadSize and a Types type that maps the other two)
---
.../s7/src/main/resources/protocols/s7/s7.mspec | 87 +++++++++++++---------
1 file changed, 50 insertions(+), 37 deletions(-)
diff --git a/protocols/s7/src/main/resources/protocols/s7/s7.mspec b/protocols/s7/src/main/resources/protocols/s7/s7.mspec
index 31b588c..21f2db8 100644
--- a/protocols/s7/src/main/resources/protocols/s7/s7.mspec
+++ b/protocols/s7/src/main/resources/protocols/s7/s7.mspec
@@ -162,7 +162,7 @@
[discriminator uint 8 'addressType']
[typeSwitch 'addressType'
['0x10' S7AddressAny
- [enum TransportSize 'transportSize']
+ [enum ParameterSize 'transportSize']
[simple uint 16 'numberOfElements']
[simple uint 16 'dbNumber']
[enum MemoryArea 'area']
@@ -228,11 +228,11 @@
// This is actually not quite correct as depending pon the transportSize the length is either defined in bits or bytes.
[type 'S7VarPayloadDataItem'
- [simple uint 8 'returnCode']
- [enum DataTransportSize 'transportSize']
- [simple uint 16 'dataLength']
- [array uint 8 'data' count 'dataLength / 8']
- [padding uint 8 'pad' '0x00' '(dataLength / 8) % 2 == 1']
+ [simple uint 8 'returnCode']
+ [enum PayloadSize 'transportSize']
+ [simple uint 16 'dataLength']
+ [array uint 8 'data' count 'dataLength / 8']
+ [padding uint 8 'pad' '0x00' '(dataLength / 8) % 2 == 1']
]
[type 'S7VarPayloadStatusItem'
@@ -240,11 +240,11 @@
]
[discriminatedType 'S7PayloadUserDataItem' [uint 4 'cpuFunctionType']
- [simple uint 8 'returnCode']
- [enum DataTransportSize 'transportSize']
- [implicit uint 16 'dataLength' 'lengthInBytes - 4']
- [simple SzlId 'szlId']
- [simple uint 16 'szlIndex']
+ [simple uint 8 'returnCode']
+ [enum PayloadSize 'transportSize']
+ [implicit uint 16 'dataLength' 'lengthInBytes - 4']
+ [simple SzlId 'szlId']
+ [simple uint 16 'szlIndex']
[typeSwitch 'cpuFunctionType'
['0x04' S7PayloadUserDataItemCpuFunctionReadSzlRequest
]
@@ -275,7 +275,20 @@
['0x40' CLASS_4]
]
-[enum int 8 'DataTransportSize' [bit 'sizeInBits']
+[enum int 8 'ParameterSize' [uint 8 'sizeInBytes']
+ ['0x01' BOOL ['1']]
+ ['0x02' BYTE ['1']]
+ ['0x03' CHAR ['1']]
+ ['0x04' WORD ['2']]
+ ['0x05' INT ['2']]
+ ['0x06' DWORD ['4']]
+ ['0x07' DINT ['4']]
+ ['0x08' REAL ['4']]
+ ['0x0B' TIME ['4']]
+ ['0x13' WCHAR ['2']]
+]
+
+[enum int 8 'PayloadSize' [bit 'sizeInBits']
['0x00' NULL ['false']]
['0x03' BIT ['true']]
['0x04' BYTE_WORD_DWORD ['true']]
@@ -285,31 +298,31 @@
['0x09' OCTET_STRING ['false']]
]
-[enum int 8 'TransportSize' [uint 8 'sizeCode', uint 8 'sizeInBytes', TransportSize 'baseType', DataTransportSize 'dataTransportSize']
- ['0x01' BOOL ['X' , '1' , 'null' , 'DataTransportSize.BIT']]
- ['0x02' BYTE ['B' , '1' , 'null' , 'DataTransportSize.BYTE_WORD_DWORD']]
- ['0x04' WORD ['W' , '2' , 'null' , 'DataTransportSize.BYTE_WORD_DWORD']]
- ['0x06' DWORD ['D' , '4' , 'WORD' , 'DataTransportSize.BYTE_WORD_DWORD']]
- ['0x00' LWORD ['X' , '8' , 'null' , 'null']]
- ['0x05' INT ['W' , '2' , 'null' , 'DataTransportSize.BYTE_WORD_DWORD']]
- ['0x05' UINT ['W' , '2' , 'INT' , 'DataTransportSize.BYTE_WORD_DWORD']]
- ['0x02' SINT ['B' , '1' , 'INT' , 'DataTransportSize.BYTE_WORD_DWORD']]
- ['0x02' USINT ['B' , '1' , 'INT' , 'DataTransportSize.BYTE_WORD_DWORD']]
- ['0x07' DINT ['D' , '4' , 'INT' , 'DataTransportSize.BYTE_WORD_DWORD']]
- ['0x07' UDINT ['D' , '4' , 'INT' , 'DataTransportSize.BYTE_WORD_DWORD']]
- ['0x00' LINT ['X' , '8' , 'INT' , 'null']]
- ['0x00' ULINT ['X' , '16' , 'INT' , 'null']]
- ['0x08' REAL ['D' , '4' , 'null' , 'DataTransportSize.BYTE_WORD_DWORD']]
- ['0x00' LREAL ['X' , '8' , 'REAL' , 'null']]
- ['0x0B' TIME ['X' , '4' , 'null' , 'null']]
- ['0x00' LTIME ['X' , '8' , 'TIME' , 'null']]
- ['0x02' DATE ['X' , '2' , 'null' , 'DataTransportSize.BYTE_WORD_DWORD']]
- ['0x02' TIME_OF_DAY ['X' , '4' , 'null' , 'DataTransportSize.BYTE_WORD_DWORD']]
- ['0x02' DATE_AND_TIME ['X' , '8' , 'null' , 'null']]
- ['0x03' CHAR ['B' , '1' , 'null' , 'DataTransportSize.BYTE_WORD_DWORD']]
- ['0x13' WCHAR ['X' , '2' , 'null' , 'null']]
- ['0x03' STRING ['X' , '1' , 'null' , 'DataTransportSize.BYTE_WORD_DWORD']]
- ['0x00' WSTRING ['X' , '1' , 'null' , 'null']]
+[enum 'Types' [uint 8 'sizeCode', Types 'baseType', ParameterSize 'sizeInBytes', PayloadSize 'dataTransportSize']
+ [BOOL ['X' , 'null' , 'ParameterSize.BOOL' , 'PayloadSize.BIT']]
+ [BYTE ['B' , 'null' , 'ParameterSize.BYTE' , 'PayloadSize.BYTE_WORD_DWORD']]
+ [WORD ['W' , 'null' , 'ParameterSize.WORD' , 'PayloadSize.BYTE_WORD_DWORD']]
+ [DWORD ['D' , 'WORD' , 'ParameterSize.DWORD' , 'PayloadSize.BYTE_WORD_DWORD']]
+ [LWORD ['X' , 'null' , 'null' , 'null']]
+ [INT ['W' , 'null' , 'ParameterSize.INT' , 'PayloadSize.BYTE_WORD_DWORD']]
+ [UINT ['W' , 'INT' , 'ParameterSize.INT' , 'PayloadSize.BYTE_WORD_DWORD']]
+ [SINT ['B' , 'INT' , 'ParameterSize.BYTE' , 'PayloadSize.BYTE_WORD_DWORD']]
+ [USINT ['B' , 'INT' , 'ParameterSize.BYTE' , 'PayloadSize.BYTE_WORD_DWORD']]
+ [DINT ['D' , 'INT' , 'ParameterSize.DINT' , 'PayloadSize.BYTE_WORD_DWORD']]
+ [UDINT ['D' , 'INT' , 'ParameterSize.DINT' , 'PayloadSize.BYTE_WORD_DWORD']]
+ [LINT ['X' , 'INT' , 'null' , 'null']]
+ [ULINT ['X' , 'INT' , 'null' , 'null']]
+ [REAL ['D' , 'null' , 'ParameterSize.REAL' , 'PayloadSize.BYTE_WORD_DWORD']]
+ [LREAL ['X' , 'REAL' , 'null' , 'null']]
+ [TIME ['X' , 'null' , 'ParameterSize.TIME' , 'null']]
+ [LTIME ['X' , 'TIME' , 'null' , 'null']]
+ [DATE ['X' , 'null' , 'null' , 'PayloadSize.BYTE_WORD_DWORD']]
+ [TIME_OF_DAY ['X' , 'null' , 'null' , 'PayloadSize.BYTE_WORD_DWORD']]
+ [DATE_AND_TIME ['X' , 'null' , 'null' , 'null']]
+ [CHAR ['B' , 'null' , 'null' , 'PayloadSize.BYTE_WORD_DWORD']]
+ [WCHAR ['X' , 'null' , 'ParameterSize.WCHAR' , 'null']]
+ [STRING ['X' , 'null' , 'ParameterSize.CHAR' , 'PayloadSize.BYTE_WORD_DWORD']]
+ [WSTRING ['X' , 'null' , 'null' , 'null']]
]
[enum int 8 'MemoryArea' [string 'shortName']