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
The following commit(s) were added to refs/heads/develop by this push:
new 44f06b3 feat(protocol/c-bus): added more base types
44f06b3 is described below
commit 44f06b3b42474439704cd19f248b880a1fa01876
Author: Sebastian Rühl <[email protected]>
AuthorDate: Mon Feb 28 11:54:49 2022 +0100
feat(protocol/c-bus): added more base types
---
.../src/main/resources/protocols/cbus/c-bus.mspec | 136 ++++++++++++++++++---
1 file changed, 117 insertions(+), 19 deletions(-)
diff --git a/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
b/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
index 2170288..57ea926 100644
--- a/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
+++ b/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
@@ -18,8 +18,8 @@
*/
[discriminatedType CBusCommand
- [const uint 8 initiator '0x5C'] // 0x5C = "/"
- [simple CBusHeader header ]
+ [const byte initiator '0x5C' ] // 0x5C == "/"
+ [simple CBusHeader header ]
[typeSwitch 'header.destinationAddressType'
['PointToPointToMultiPoint' CBusCommandPointToPointToMultiPoint
[simple CBusPointToPointToMultipointCommand command]
@@ -40,23 +40,6 @@
[simple DestinationAddressType destinationAddressType]
]
-[discriminatedType CBusPointToPointCommand
- [peek uint 16 bridgeAddressCountPeek]
- [virtual UnitAddress unitAddress ]
- [typeSwitch 'bridgeAddressCountPeek && 0x00FF'
- ['0x0000' CBusPointToPointCommandDirect
- [simple UnitAddress unitAddress
]
- ]
- [ CBusPointToPointCommandIndirect
- [simple BridgeAddress firstBridgeAddress
]
- [simple RouteType routeType
]
- [array BridgeAddress additionalBridgeAddresses count
'routeType.additionalBridges']
- [simple UnitAddress unitAddress
]
- ]
- ]
-
-]
-
[enum uint 2 PriorityClass
['0x00' Class4] // lowest
['0x01' Class3] // medium low
@@ -70,6 +53,19 @@
['0x06' PointToPoint ] // P-P
]
+[type UnitAddress
+ [simple byte address]
+]
+
+[type BridgeAddress
+ [simple byte address]
+]
+
+[type NetworkRoute
+ [simple RouteType routeType
]
+ [array BridgeAddress additionalBridgeAddresses count
'routeType.additionalBridges']
+]
+
[enum uint 8 RouteType(uint 3 additionalBridges)
['0x00' NoBridgeAtAll ['0']]
['0x09' NoAdditionalBridge ['1']]
@@ -78,3 +74,105 @@
['0x24' ThreeAdditionalBridge ['4']]
['0x2D' FourAdditionalBridge ['4']]
['0x36' FiveAdditionalBridge ['4']]
+]
+
+[discriminatedType CBusPointToPointCommand
+ [peek uint 16 bridgeAddressCountPeek ]
+ [typeSwitch 'bridgeAddressCountPeek && 0x00FF'
+ ['0x0000' CBusPointToPointCommandDirect
+ [simple UnitAddress unitAddress
]
+ ]
+ ['*' CBusPointToPointCommandIndirect
+ [simple BridgeAddress bridgeAddress
]
+ [simple NetworkRoute networkRoute
]
+ [simple UnitAddress unitAddress
]
+ ]
+ ]
+ [simple CALData calData
]
+ [optional Checksum checksum
] // TODO: checksum is optional but mspec checksum isn't
+ [optional byte alpha
]
+ [const uint 8 cr '0xD'
] // 0xD == "<cr>"
+]
+
+[discriminatedType CBusPointToMultiPointCommand
+ [peek uint 8 application ]
+ [typeSwitch 'application'
+ ['0xFF' CBusPointToMultiPointCommandStatus
+ [reserved byte '0xFF'
]
+ [reserved byte '0x00'
]
+ [simple StatusRequest statusRequest
]
+ [optional Checksum checksum
] // TODO: checksum is optional but mspec checksum isn't
+ [optional byte alpha
]
+ [const uint 8 cr '0xD'
] // 0xD == "<cr>"
+ ]
+ ['*' CBusPointToMultiPointCommandNormal
+ [simple Application application
]
+ [reserved byte '0x00'
]
+ [simple SALData salData
]
+ [optional Checksum checksum
] // TODO: checksum is optional but mspec checksum isn't
+ [optional byte alpha
]
+ [const uint 8 cr '0xD'
] // 0xD == "<cr>"
+ ]
+ ]
+]
+
+[discriminatedType CBusCommandPointToPointToMultiPoint
+ [simple BridgeAddress bridgeAddress
]
+ [simple NetworkRoute networkRoute
]
+ [peek uint 8 application ]
+ [typeSwitch 'application'
+ ['0xFF' CBusCommandPointToPointToMultiPointStatus
+ [reserved byte '0xFF'
]
+ [reserved byte '0x00'
]
+ [simple StatusRequest statusRequest
]
+ [optional Checksum checksum
] // TODO: checksum is optional but mspec checksum isn't
+ [optional byte alpha
]
+ [const uint 8 cr '0xD'
] // 0xD == "<cr>"
+ ]
+ ['*' CBusCommandPointToPointToMultiPointNormal
+ [simple Application application
]
+ [reserved byte '0x00'
]
+ [simple SALData salData
]
+ [optional Checksum checksum
] // TODO: checksum is optional but mspec checksum isn't
+ [optional byte alpha
]
+ [const uint 8 cr '0xD'
] // 0xD == "<cr>"
+ ]
+ ]
+]
+
+[type Application
+ [simple byte id]
+]
+
+[type CALData
+ // TODO: implement me
+]
+
+[type StatusRequest
+ [peek uint 8 type ]
+ [typeSwitch 'type'
+ ['0x7A' StatusRequestBinaryState
+ [reserved byte '0x7A'
]
+ [simple byte application
]
+ [reserved byte '0x00'
]
+ ]
+ ['0x73' StatusRequestLevel
+ [reserved byte '0x73'
]
+ [reserved byte '0x07'
]
+ [simple byte application
]
+ [simple byte startingGroupAddressLabel
]
+ [validation 'startingGroupAddressLabel == 0x00
+ || startingGroupAddressLabel == 0x20
+ || startingGroupAddressLabel == 0x40
+ || startingGroupAddressLabel == 0x60
+ || startingGroupAddressLabel == 0x80
+ || startingGroupAddressLabel == 0xA0
+ || startingGroupAddressLabel == 0xC0
+ || startingGroupAddressLabel == 0xE0'
]
+ ]
+ ]
+]
+
+[type SALData
+ // TODO: implement me
+]
\ No newline at end of file