device_info
frog.device_info
¤
Provides common dataclasses about devices for using in backend and frontend.
Classes¤
DeviceBaseTypeInfo(name, description, names_short, names_long)
dataclass
¤
A generic device type (e.g. stepper motor).
Attributes¤
description
instance-attribute
¤
A human-readable name for these types of device.
name
instance-attribute
¤
Short name for use in pubsub topics etc.
names_long
instance-attribute
¤
A list of names for this type of device (human readable).
names_short
instance-attribute
¤
A list of possible names for this type of device.
Functions¤
get_instances_and_descriptions()
¤
Get instances and descriptions.
If there are no possible names for the type, then there will only be one instance, otherwise there will be one per name.
Source code in frog/device_info.py
65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
DeviceInstanceRef(base_type, name=None)
dataclass
¤
Information uniquely describing an instance of a particular device type.
Attributes¤
base_type
instance-attribute
¤
The device base type.
name = None
class-attribute
instance-attribute
¤
The (optional) name of the device.
Used for disambiguating devices where there can be multiple instances.
Functions¤
__str__()
¤
Get the short string representation of this device.
Source code in frog/device_info.py
92 93 94 95 96 97 |
|
from_str(s)
staticmethod
¤
Convert from a string in the format "base_type.name" or "base_type".
Source code in frog/device_info.py
99 100 101 102 103 |
|
DeviceParameter(description, possible_values, default_value=None)
dataclass
¤
A parameter that a device needs (e.g. baudrate).
Attributes¤
default_value = None
class-attribute
instance-attribute
¤
The default value for this parameter.
A value of None indicates that there is no default value.
description
instance-attribute
¤
A human-readable description of the parameter.
possible_values
instance-attribute
¤
Possible values the parameter can take.
This can either be a Sequence of possible values or a type (e.g. str or float).
Functions¤
__post_init__()
¤
Check that default value is valid.
Source code in frog/device_info.py
26 27 28 29 30 31 32 33 34 35 36 37 |
|