-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch creation of all parameters to the
.from_et()
pattern
Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Florian Jost <[email protected]>
- Loading branch information
Showing
17 changed files
with
397 additions
and
230 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,50 @@ | ||
# SPDX-License-Identifier: MIT | ||
from dataclasses import dataclass | ||
from typing import List | ||
from xml.etree import ElementTree | ||
|
||
from typing_extensions import override | ||
|
||
from ..decodestate import DecodeState | ||
from ..encodestate import EncodeState | ||
from ..odxlink import OdxDocFragment | ||
from ..odxtypes import ParameterValue | ||
from ..utils import dataclass_fields_asdict | ||
from .parameter import Parameter, ParameterType | ||
|
||
|
||
@dataclass | ||
class DynamicParameter(Parameter): | ||
|
||
@staticmethod | ||
@override | ||
def from_et(et_element: ElementTree.Element, | ||
doc_frags: List[OdxDocFragment]) -> "DynamicParameter": | ||
|
||
kwargs = dataclass_fields_asdict(Parameter.from_et(et_element, doc_frags)) | ||
|
||
return DynamicParameter(**kwargs) | ||
|
||
@property | ||
@override | ||
def parameter_type(self) -> ParameterType: | ||
return "DYNAMIC" | ||
|
||
@property | ||
@override | ||
def is_required(self) -> bool: | ||
raise NotImplementedError(".is_required for a DynamicParameter") | ||
|
||
@property | ||
@override | ||
def is_settable(self) -> bool: | ||
raise NotImplementedError(".is_settable for a DynamicParameter") | ||
|
||
@override | ||
def get_coded_value_as_bytes(self, encode_state: EncodeState) -> bytes: | ||
raise NotImplementedError("Encoding a DynamicParameter is not implemented yet.") | ||
|
||
@override | ||
@override | ||
def _decode_positioned_from_pdu(self, decode_state: DecodeState) -> ParameterValue: | ||
raise NotImplementedError("Decoding a DynamicParameter is not implemented yet.") |
Oops, something went wrong.