SenderReceiverInterface
XML tag |
<SENDER-RECEIVER-INTERFACE> |
Module |
autosar.portinterface |
Inherits |
A sender receiver interface is the most common type of port interface. It contains a set of data elements that can be used to send and receive data
Usage
import autosar
def create_workspace_and_datatypes():
ws = autosar.workspace(version="4.2.2")
package = ws.createPackage('DataTypes', role='DataType')
package.createSubPackage('CompuMethods', role='CompuMethod')
package.createSubPackage('DataConstrs', role='DataConstraint')
baseTypes = package.createSubPackage('BaseTypes')
baseTypes.createSwBaseType('uint8', 8, nativeDeclaration='uint8')
implTypes = package.createSubPackage('ImplementationTypes')
implTypes.createImplementationDataType('uint8', lowerLimit=0, upperLimit=255,
baseTypeRef='/DataTypes/BaseTypes/uint8', typeEmitter='Platform_Type')
implTypes.createImplementationDataTypeRef('OffOn_T', implementationTypeRef = '/DataTypes/ImplementationTypes/uint8',
valueTable = ['OffOn_Off',
'OffOn_On',
'OffOn_Error',
'OffOn_NotAvailable'
])
package = ws.createPackage('PortInterfaces', role='PortInterface')
return ws
#Create SenderReceiver interface with single data element
ws = create_workspace_and_datatypes()
package = ws.find('PortInterfaces')
package.createSenderReceiverInterface('HeaterPwrStat_I', autosar.element.DataElement('HeaterPwrStat', '/DataTypes/ImplementationTypes/OffOn_T'))
#Save only the port interfaces portion to XML
ws.saveXML('PortInterfaces.arxml', filters=['/PortInterfaces'])
Factory Methods
Attributes
For inherited attributes see autosar.portinterface.PortInteface.
Name |
Type |
Description |
---|---|---|
dataElements |
list(DataElement) |
List of data elements |
invalidationPolicies |
list(InvalidationPolicy) |
List of invalidation policies |
Public Methods
Method Description
append
- SenderReceiverInterface.append(elem)
Appends a child element to this port interface.
If the type of elem is DataElement it will be appended to dataElements
If the type of elem is InvalidationPolicy it will be appended to invalidationPolicies
- 参数
elem (DataElement or InvalidationPolicy) – child element to be appended