sgr_commhandler.api.device_api

Provides the device-level API.

Classes

DeviceInformation

Implements a device information container.

SGrBaseInterface

Defines an abstract base class for all SGr device interfaces.

Module Contents

class sgr_commhandler.api.device_api.DeviceInformation

Implements a device information container.

name

Defines the device name

Type:

str

manufacturer

Defines the manufacturer’s name

Type:

str

software_revision

Defines the device software version

Type:

str

hardware_revision

Defines the device hardware version

Type:

str

device_category

Defines the device category

Type:

DeviceCategory

is_local

Defines if the device is controlled locally or via cloud

Type:

bool

name: str
manufacturer: str
software_revision: str
hardware_revision: str
device_category: sgr_specification.v0.generic.DeviceCategory
is_local: bool
class sgr_commhandler.api.device_api.SGrBaseInterface(frame)

Bases: abc.ABC

Defines an abstract base class for all SGr device interfaces.

Parameters:

frame (sgr_specification.v0.product.product.DeviceFrame)

device_frame

the device specification

Type:

DeviceFrame

configuration_parameters

the configuration parameters with default values

Type:

list[ConfigurationParameter]

device_information

the device information

Type:

DeviceInformation

functional_profiles

the configured functional profiles

Type:

dict[str, FunctionalProfile]

device_frame: sgr_specification.v0.product.product.DeviceFrame
configuration_parameters: list[sgr_commhandler.api.configuration_parameter.ConfigurationParameter]
device_information: DeviceInformation
functional_profiles: dict[str, sgr_commhandler.api.functional_profile_api.FunctionalProfile]
abstract connect_async()
Async:

Connects the device asynchronously.

abstract disconnect_async()
Async:

Disconnects the device asynchronously.

abstract is_connected()

Gets the connection state.

Returns:

the connection state

Return type:

bool

get_functional_profiles()

Gets all functional profiles.

Returns:

all functional profiles

Return type:

dict[str, FunctionalProfile]

get_functional_profile(functional_profile_name)

Gets a functional profile.

Parameters:

functional_profile_name (str) – the functional profile name

Returns:

a functional profile

Return type:

FunctionalProfile

get_data_point(dp)

Gets a data point.

Parameters:

dp (tuple[str, str]) – the functional profile and data point name

Returns:

a data point

Return type:

DataPoint

get_data_points()

Gets all data points.

Returns:

all data points

Return type:

dict[tuple[str, str], DataPoint]

async get_values_async(parameters=None)

Gets all data point values asynchronously.

Returns:

all data point values

Return type:

dict[tuple[str, str], Any]

Parameters:

parameters (Optional[dict[str, str]])

describe()

Gets the device description and all data.

Returns:

a tuple of device name and all data point values

Return type:

tuple[str, dict[str, dict[str, tuple[DataDirectionProduct, DataTypes]]]]

get_specification()

Gets the complete SGr specification of the device.

Returns:

the device specification

Return type:

DeviceFrame