phoenix6.status_signal
#
Module Contents#
Attributes#
- phoenix6.status_signal.T#
- class phoenix6.status_signal.SignalMeasurement#
Bases:
Generic
[T
]Information from a single measurement of a status signal.
- value: T#
The value of the signal
- timestamp: phoenix6.units.second = 0.0#
Timestamp of when the data point was taken, in seconds
- status#
Status code response of getting the data
- units = ''#
Units that correspond to this point
- class phoenix6.status_signal.StatusSignal(error: phoenix6.status_code.StatusCode, device_identifier: phoenix6.hardware.device_identifier.DeviceIdentifier, spn: int, report_if_old_func: Callable[[], None], generator: Callable[[], dict[int, str]], signal_name: str, signal_type: type)#
Bases:
phoenix6.base_status_signal.BaseStatusSignal
,Generic
[T
]Represents a status signal with data of type T, and operations available to retrieve information about the signal.
- property value: T#
Gets the value inside this StatusSignal
- Returns:
The value of this StatusSignal
- Return type:
T
- refresh(report_error: bool = True) StatusSignal[T] #
Refreshes the value of this status signal.
If the user application caches this StatusSignal object instead of periodically fetching it from the hardware device, this function must be called to fetch fresh data.
This performs a non-blockin refresh operation. If you want to wait until you receive data, call wait_for_update instead.
- Parameters:
report_error (bool, optional) – Whether to report any errors to the console, defaults to True
- Returns:
Reference to itself
- Return type:
StatusSignal[T]
- wait_for_update(timeout_seconds: phoenix6.units.second, report_error: bool = True) StatusSignal[T] #
Waits up to timeout_seconds to get up-to-date status signal value.
This performs a blocking refresh operation. If you want to non-blocking refresh the signal, call refresh instead.
- Parameters:
timeout_seconds (second) – Maximum time to wait for a signal to update
report_error (bool, optional) – Whether to report any errors to the console, defaults to True
- Returns:
Reference to itself
- Return type:
StatusSignal[T]
- as_supplier() Callable[[], T] #
Returns a lambda that calls refresh and value on this object. This is useful for command-based programming.
- Returns:
Lambda that refreshes this signal and returns it
- Return type:
Callable[[], T]
- get_data_copy() SignalMeasurement[T] #
Get a basic data-only container with this information, to be used for things such as data logging.
Note if looking for Phoenix 6 logging features, see the SignalLogger class instead.
This function returns a new object every call. As a result, we recommend that this is not called inside a tight loop.
- Returns:
Basic structure with all relevant information
- Return type: