Skip to content

Commit ba0d945

Browse files
committed
Implement remaining event classes
- AsynchronousServerCallReturnsEvent - BackgroundEvent - ExternalTriggerOccurredEvent - InternalTriggerOccurredEvent - SwcModeManagerErrorEvent - TransformerHardErrorEvent
1 parent edab4bc commit ba0d945

File tree

8 files changed

+1098
-116
lines changed

8 files changed

+1098
-116
lines changed

CHANGELOG.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,33 @@ Non-collectable elements are various sub-elements to collectable elements.
1111

1212
#### XML - Software component elements
1313

14+
* PModeGroupInAtomicSwcInstanceRef | P-MODE-GROUP-IN-ATOMIC-SWC-INSTANCE-REF
15+
* POperationInAtomicSwcInstanceRef | P-OPERATION-IN-ATOMIC-SWC-INSTANCE-REF
16+
* PTriggerInAtomicSwcTypeInstanceRef | P-TRIGGER-IN-ATOMIC-SWC-TYPE-INSTANCE-REF
1417
* RModeInAtomicSwcInstanceRef | R-MODE-IN-ATOMIC-SWC-INSTANCE-REF
18+
* RTriggerInAtomicSwcInstanceRef | R-TRIGGER-IN-ATOMIC-SWC-INSTANCE-REF
1519
* RVariableInAtomicSwcInstanceRef | R-VARIABLE-IN-ATOMIC-SWC-INSTANCE-REF
1620

1721
#### XML - SWC internal behavior elements
1822

19-
* DataReceiveErrorEvent | DATA-RECEIVE-ERROR-EVENT
23+
* AsynchronousServerCallReturnsEvent | ASYNCHRONOUS-SERVER-CALL-RETURNS-EVENT
24+
* BackgroundEvent | BACKGROUND-EVENT
2025
* DataReceivedEvent | DATA-RECEIVED-EVENT
26+
* DataReceiveErrorEvent | DATA-RECEIVE-ERROR-EVENT
2127
* DataSendCompletedEvent | DATA-SEND-COMPLETED-EVENT
2228
* DataWriteCompletedEvent | DATA-WRITE-COMPLETED-EVENT
29+
* ExternalTriggerOccurredEvent | EXTERNAL-TRIGGER-OCCURRED-EVENT
2330
* InitEvent | INIT-EVENT
31+
* InternalBehavior | SWC-INTERNAL-BEHAVIOR (Partly implemented)
32+
* runnables
33+
* InternalTriggerOccurredEvent | INTERNAL-TRIGGER-OCCURRED-EVENT
2434
* ModeSwitchedAckEvent | MODE-SWITCHED-ACK-EVENT
2535
* OperationInvokedEvent | OPERATION-INVOKED-EVENT
36+
* RunnableEntity | RUNNABLE-ENTITY
37+
* SwcModeManagerErrorEvent | SWC-MODE-MANAGER-ERROR-EVENT
2638
* SwcModeSwitchEvent | SWC-MODE-SWITCH-EVENT
2739
* TimingEvent | TIMING-EVENT
28-
* InternalBehavior | SWC-INTERNAL-BEHAVIOR (Partly implemented)
29-
* RunnableEntity | RUNNABLE-ENTITY
40+
* TransformerHardErrorEvent | TRANSFORMER-HARD-ERROR-EVENT
3041

3142
### Fixed
3243

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,14 @@ Below is a rough roadmap of planned releases.
254254
* Port-access
255255
* Port-API options
256256

257-
**v0.5.6** Add some missing elements and functions that wasn't prioritized before.
257+
**v0.5.6** Fixes and refactoring
258+
259+
* Fix some early design mistakes
260+
* Harmonize some member names to better match "qualified name" from XSD (BREAKING CHANGE)
261+
* This mostly means that lot of class member names ending with "_ref" will have its suffix removed
262+
* Attempt to break apart large Python files into smaller ones.
263+
264+
**v0.5.7** Add some missing elements and functions that wasn't prioritized before.
258265

259266
**v0.6.0:** Stable version, publish to PyPI.
260267

src/autosar/xml/element.py

+204-12
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
RunnableEntityRef,
5050
VariableAccessRef,
5151
ModeSwitchPointRef,
52+
AsynchronousServerCallResultPointRef,
53+
TriggerRef,
54+
InternalTriggeringPointRef,
5255
)
5356

5457

@@ -5229,6 +5232,65 @@ def _create_pass_through_connector(self,
52295232
return connector
52305233

52315234

5235+
class POperationInAtomicSwcInstanceRef(ARObject):
5236+
"""
5237+
Complex type AR:P-OPERATION-IN-ATOMIC-SWC-INSTANCE-REF
5238+
Tag variants: 'OPERATION-IREF'
5239+
"""
5240+
5241+
def __init__(self,
5242+
context_port: AbstractProvidedPortPrototypeRef | None = None,
5243+
target_provided_operation: ClientServerOperationRef | str | None = None,
5244+
) -> None:
5245+
# .CONTEXT-P-PORT-REF (Keep name consistent in similar classes)
5246+
self.context_port: AbstractProvidedPortPrototypeRef | None = None
5247+
# .TARGET-PROVIDED-OPERATION-REF
5248+
self.target_provided_operation: ClientServerOperationRef | None = None
5249+
self._assign_optional("context_port", context_port, AbstractProvidedPortPrototypeRef)
5250+
self._assign_optional("target_provided_operation", target_provided_operation, ClientServerOperationRef)
5251+
5252+
5253+
class PModeGroupInAtomicSwcInstanceRef(ARObject):
5254+
"""
5255+
Complex type AR:P-MODE-GROUP-IN-ATOMIC-SWC-INSTANCE-REF
5256+
Tag variants: 'P-MODE-GROUP-IN-ATOMIC-SWC-INSTANCE-REF' | 'MODE-GROUP-IREF' |
5257+
'SWC-MODE-GROUP-IREF'
5258+
"""
5259+
5260+
def __init__(self,
5261+
context_port: AbstractProvidedPortPrototypeRef | None = None,
5262+
context_mode_declaration_group_prototype: ModeDeclarationGroupPrototypeRef | str | None = None,
5263+
) -> None:
5264+
# .CONTEXT-P-PORT-REF
5265+
self.context_port: AbstractProvidedPortPrototypeRef | None = None
5266+
# .CONTEXT-MODE-DECLARATION-GROUP-PROTOTYPE-REF
5267+
self.context_mode_declaration_group_prototype: ModeDeclarationGroupPrototypeRef | None = None
5268+
5269+
self._assign_optional("context_port", context_port, AbstractProvidedPortPrototypeRef)
5270+
self._assign_optional("context_mode_declaration_group_prototype",
5271+
context_mode_declaration_group_prototype,
5272+
ModeDeclarationGroupPrototypeRef)
5273+
5274+
5275+
class PTriggerInAtomicSwcTypeInstanceRef(ARObject):
5276+
"""
5277+
Complex type AR:P-TRIGGER-IN-ATOMIC-SWC-TYPE-INSTANCE-REF
5278+
Tag variants: 'P-TRIGGER-IN-ATOMIC-SWC-TYPE-INSTANCE-REF' | 'SWC-TRIGGER-IREF' |
5279+
'TRIGGER-IREF'
5280+
"""
5281+
5282+
def __init__(self,
5283+
context_port: AbstractProvidedPortPrototypeRef | None = None,
5284+
target_trigger: TriggerRef | str | None = None,
5285+
) -> None:
5286+
# .CONTEXT-P-PORT-REF (Keep name consistent in similar classes)
5287+
self.context_port: AbstractProvidedPortPrototypeRef | None = None
5288+
# .TARGET-TRIGGER-REF
5289+
self.target_trigger: TriggerRef | None = None
5290+
self._assign_optional("context_port", context_port, AbstractProvidedPortPrototypeRef)
5291+
self._assign_optional("target_trigger", target_trigger, TriggerRef)
5292+
5293+
52325294
class RModeInAtomicSwcInstanceRef(ARObject):
52335295
"""
52345296
Complex type AR:R-MODE-IN-ATOMIC-SWC-INSTANCE-REF
@@ -5267,26 +5329,28 @@ def __init__(self,
52675329
self.context_port: AbstractRequiredPortPrototypeRef | None = None
52685330
# .TARGET-DATA-ELEMENT-REF
52695331
self.target_data_element: VariableDataPrototypeRef | None = None
5332+
52705333
self._assign_optional("context_port", context_port, AbstractRequiredPortPrototypeRef)
52715334
self._assign_optional("target_data_element", target_data_element, VariableDataPrototypeRef)
52725335

52735336

5274-
class POperationInAtomicSwcInstanceRef(ARObject):
5337+
class RTriggerInAtomicSwcInstanceRef(ARObject):
52755338
"""
5276-
Complex type AR:P-OPERATION-IN-ATOMIC-SWC-INSTANCE-REF
5277-
Tag variants: 'OPERATION-IREF'
5339+
Complex type AR:R-TRIGGER-IN-ATOMIC-SWC-INSTANCE-REF
5340+
Tag variants: 'TRIGGER-IREF' | 'REQUIRED-TRIGGER-IREF'
52785341
"""
52795342

52805343
def __init__(self,
5281-
context_port: AbstractProvidedPortPrototypeRef | None = None,
5282-
target_provided_operation: ClientServerOperationRef | str | None = None,
5344+
context_port: AbstractRequiredPortPrototypeRef | None = None,
5345+
target_trigger: TriggerRef | str | None = None,
52835346
) -> None:
5284-
# .CONTEXT-P-PORT-REF (Keep name consistent in similar classes)
5285-
self.context_port: AbstractProvidedPortPrototypeRef | None = None
5286-
# .TARGET-PROVIDED-OPERATION-REF
5287-
self.target_provided_operation: ClientServerOperationRef | None = None
5288-
self._assign_optional("context_port", context_port, AbstractProvidedPortPrototypeRef)
5289-
self._assign_optional("target_provided_operation", target_provided_operation, ClientServerOperationRef)
5347+
# .CONTEXT-R-PORT-REF (Keep name consistent in similar classes)
5348+
self.context_port: AbstractRequiredPortPrototypeRef | None = None
5349+
# .TARGET-TRIGGER-REF
5350+
self.target_trigger: TriggerRef | None = None
5351+
5352+
self._assign_optional("context_port", context_port, AbstractRequiredPortPrototypeRef)
5353+
self._assign_optional("target_trigger", target_trigger, TriggerRef)
52905354

52915355
# --- SWC internal behavior elements
52925356

@@ -5652,6 +5716,31 @@ def append_disabled_mode(self, disabled_mode: RModeInAtomicSwcInstanceRef) -> No
56525716
raise TypeError("disabled_mode must be of type RModeInAtomicSwcInstanceRef")
56535717

56545718

5719+
class AsynchronousServerCallReturnsEvent(RteEvent):
5720+
"""
5721+
Complex type AR:ASYNCHRONOUS-SERVER-CALL-RETURNS-EVENT
5722+
Tag variants: 'ASYNCHRONOUS-SERVER-CALL-RETURNS-EVENT'
5723+
"""
5724+
5725+
def __init__(self,
5726+
name: str,
5727+
start_on_event: RunnableEntityRef | str | None = None,
5728+
event_source: AsynchronousServerCallResultPointRef | str | None = None,
5729+
**kwargs) -> None:
5730+
super().__init__(name, start_on_event, **kwargs)
5731+
# .EVENT-SOURCE-REF
5732+
self.event_source: AsynchronousServerCallResultPointRef | None = None
5733+
self._assign_optional("event_source", event_source, AsynchronousServerCallResultPointRef)
5734+
5735+
5736+
class BackgroundEvent(RteEvent):
5737+
"""
5738+
Complex Type AR:BACKGROUND-EVENT
5739+
Tag variants: 'BACKGROUND-EVENT'
5740+
Inherits constructor from base-class
5741+
"""
5742+
5743+
56555744
class DataReceiveErrorEvent(RteEvent):
56565745
"""
56575746
Complex Type AR:DATA-RECEIVE-ERROR-EVENT
@@ -5752,14 +5841,61 @@ def __init__(self,
57525841
self._assign_optional("event_source", event_source, VariableAccessRef)
57535842

57545843

5844+
class ExternalTriggerOccurredEvent(RteEvent):
5845+
"""
5846+
Complex Type AR:EXTERNAL-TRIGGER-OCCURRED-EVENT
5847+
Tag variants: 'EXTERNAL-TRIGGER-OCCURRED-EVENT'
5848+
"""
5849+
5850+
def __init__(self,
5851+
name: str,
5852+
start_on_event: RunnableEntityRef | str | None = None,
5853+
trigger: RTriggerInAtomicSwcInstanceRef | str | None = None,
5854+
**kwargs) -> None:
5855+
super().__init__(name, start_on_event, **kwargs)
5856+
# .TRIGGER-IREF
5857+
self.trigger: RTriggerInAtomicSwcInstanceRef | None = None
5858+
self._assign_optional_strict("trigger", trigger, RTriggerInAtomicSwcInstanceRef)
5859+
5860+
@classmethod
5861+
def make(cls,
5862+
name: str,
5863+
start_on_event: RunnableEntityRef | str | None = None,
5864+
context_port: AbstractRequiredPortPrototypeRef | None = None,
5865+
target_trigger: TriggerRef | str | None = None,
5866+
**kwargs) -> "ExternalTriggerOccurredEvent":
5867+
"""
5868+
#convenience-method
5869+
"""
5870+
trigger = RTriggerInAtomicSwcInstanceRef(context_port, target_trigger)
5871+
return cls(name, start_on_event, trigger, **kwargs)
5872+
5873+
57555874
class InitEvent(RteEvent):
57565875
"""
57575876
Complex Type AR:INIT-EVENT
57585877
Tag variants: 'INIT-EVENT'
5759-
Reuses constructor from base-class
5878+
Inherits constructor from base-class
57605879
"""
57615880

57625881

5882+
class InternalTriggerOccurredEvent(RteEvent):
5883+
"""
5884+
Complex type AR:INTERNAL-TRIGGER-OCCURRED-EVENT
5885+
Tag variants: 'INTERNAL-TRIGGER-OCCURRED-EVENT'
5886+
"""
5887+
5888+
def __init__(self,
5889+
name: str,
5890+
start_on_event: RunnableEntityRef | str | None = None,
5891+
event_source: InternalTriggeringPointRef | str | None = None,
5892+
**kwargs) -> None:
5893+
super().__init__(name, start_on_event, **kwargs)
5894+
# .EVENT-SOURCE-REF
5895+
self.event_source: InternalTriggeringPointRef | None = None
5896+
self._assign_optional("event_source", event_source, InternalTriggeringPointRef)
5897+
5898+
57635899
class ModeSwitchedAckEvent(RteEvent):
57645900
"""
57655901
Complex type AR:MODE-SWITCHED-ACK-EVENT
@@ -5815,6 +5951,36 @@ def make(cls,
58155951
None]
58165952

58175953

5954+
class SwcModeManagerErrorEvent(RteEvent):
5955+
"""
5956+
Complex type AR:SWC-MODE-MANAGER-ERROR-EVENT
5957+
Tag variants: 'SWC-MODE-MANAGER-ERROR-EVENT'
5958+
"""
5959+
5960+
def __init__(self,
5961+
name: str,
5962+
start_on_event: RunnableEntityRef | str | None = None,
5963+
mode_group: PModeGroupInAtomicSwcInstanceRef | str | None = None,
5964+
**kwargs) -> None:
5965+
super().__init__(name, start_on_event, **kwargs)
5966+
# .MODE-GROUP-IREF
5967+
self.mode_group: PModeGroupInAtomicSwcInstanceRef | None = None
5968+
self._assign_optional_strict("mode_group", mode_group, PModeGroupInAtomicSwcInstanceRef)
5969+
5970+
@classmethod
5971+
def make(cls,
5972+
name: str,
5973+
start_on_event: RunnableEntityRef | str | None = None,
5974+
context_port: AbstractProvidedPortPrototypeRef | None = None,
5975+
context_mode_declaration_group_prototype: ModeDeclarationGroupPrototypeRef | str | None = None,
5976+
**kwargs) -> "SwcModeManagerErrorEvent":
5977+
"""
5978+
#convenience-method
5979+
"""
5980+
mode_group = PModeGroupInAtomicSwcInstanceRef(context_port, context_mode_declaration_group_prototype)
5981+
return cls(name, start_on_event, mode_group, **kwargs)
5982+
5983+
58185984
class SwcModeSwitchEvent(RteEvent):
58195985
"""
58205986
Complex type AR:SWC-MODE-SWITCH-EVENT
@@ -5893,6 +6059,32 @@ def __init__(self,
58936059
self._assign_optional("period", period, float)
58946060

58956061

6062+
class TransformerHardErrorEvent(RteEvent):
6063+
"""
6064+
Complex type AR:TRANSFORMER-HARD-ERROR-EVENT
6065+
Tag variants: 'TRANSFORMER-HARD-ERROR-EVENT'
6066+
"""
6067+
6068+
def __init__(self,
6069+
name: str,
6070+
start_on_event: RunnableEntityRef | str | None = None,
6071+
operation: POperationInAtomicSwcInstanceRef | None = None,
6072+
required_trigger: RTriggerInAtomicSwcInstanceRef | None = None,
6073+
trigger: PTriggerInAtomicSwcTypeInstanceRef | None = None,
6074+
**kwargs) -> None:
6075+
super().__init__(name, start_on_event, **kwargs)
6076+
# .OPERATION-IREF
6077+
self.operation: POperationInAtomicSwcInstanceRef | None = None
6078+
# .REQUIRED-TRIGGER-IREF
6079+
self.required_trigger: RTriggerInAtomicSwcInstanceRef | None = None
6080+
# .TRIGGER-IREF
6081+
self.trigger: PTriggerInAtomicSwcTypeInstanceRef | None = None
6082+
6083+
self._assign_optional_strict("operation", operation, POperationInAtomicSwcInstanceRef)
6084+
self._assign_optional_strict("required_trigger", required_trigger, RTriggerInAtomicSwcInstanceRef)
6085+
self._assign_optional_strict("trigger", trigger, PTriggerInAtomicSwcTypeInstanceRef)
6086+
6087+
58966088
class InternalBehavior(Identifiable):
58976089
"""
58986090
Group AR:INTERNAL-BEHAVIOR

0 commit comments

Comments
 (0)