class documentation

class Sample(Generic[T]):

View In Hierarchy

A single OPC UA value with its status and timestamps.

Class Method from_data_value Create a sample from an OPC UA data value.
Class Variable server_timestamp Timestamp the server received the value, if provided by the server.
Class Variable source_timestamp Timestamp of the value at its source, if provided by the server.
Class Variable status Raw OPC UA status code. Defaults to Good, like a missing status code in OPC UA.
Class Variable value Python native value. Is None if there is no value, e.g. for bad samples.
Class Variable variant Raw OPC UA value. Is None if there is no value (also for an OPC UA Null variant).
Property quality Quality derived from the status code.
Property timestamp Source timestamp, falling back to the server timestamp.
@classmethod
def from_data_value(cls, data_value: ua.DataValue, convert: Callable[[ua.Variant], T | None] = _variant_value) -> Sample[T]:

Create a sample from an OPC UA data value.

Parameters
data_value:ua.DataValueUndocumented
convert:Callable[[ua.Variant], T | None]Converts the raw variant into the Python native value. Not called without a variant.
Returns
Sample[T]Undocumented
server_timestamp: datetime | None =

Timestamp the server received the value, if provided by the server.

source_timestamp: datetime | None =

Timestamp of the value at its source, if provided by the server.

status: ua.StatusCode =

Raw OPC UA status code. Defaults to Good, like a missing status code in OPC UA.

value: T | None =

Python native value. Is None if there is no value, e.g. for bad samples.

variant: ua.Variant | None =

Raw OPC UA value. Is None if there is no value (also for an OPC UA Null variant).

@property
quality: Quality =

Quality derived from the status code.

@property
timestamp: datetime | None =

Source timestamp, falling back to the server timestamp.