Skip to content

[Feature]: Support min/max/unit in numeric DataPoint classes #160

@doosuu

Description

@doosuu

Description

Currently, all numeric DataPoint classes e.g. DataPointInt8, DataPointInt16, ... only store their names and their parent. However it would be very convenient if they would also store their min / max values and the unit, if they exist.

This would

  1. enable the vehicle-model-generator to properly fill these attributes.
  2. the vehicle model to be compared against the running model in kuksa databroker (compatibility checks)
  3. the datapoint classes to raise exceptions when trying to set values outside of the allowed range without communicating with kuksa databroker

Suggested Solution

One option would be to pull in a new base class for numeric types which accepts kwargs for modular extension:

class DataPointNumeric(DataPoint, Generic[T]):
    """Base class for numeric datapoints."""

    def __init__(self, name: str, parent: Node, **kwargs):
        super().__init__(name, parent)

        self.min = kwargs.get("min")
        self.max = kwargs.get("max")
        self.unit = kwargs.get("unit")

Alternatives

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions