deviceaccess.VoidRegisterAccessor
- class deviceaccess.VoidRegisterAccessor
Bases:
pybind11_objectSpecial accessor that represents a register with no user data (ChimeraTK::Void).
This accessor is typically used to model triggers or actions that do not carry a payload. There is no user buffer to read or write values from; read()/write() only perform transfer synchronisation and version-tagged signalling.
Note
Create instances via Device.getVoidRegisterAccessor(). There is no get()/set() as there is no value to access. Use write()/writeDestructively() to trigger an action and read()/readNonBlocking()/readLatest() to synchronise with incoming events.
- __init__(self: deviceaccess.VoidRegisterAccessor) None
Methods
__init__(self)dataValidity(self)Return current validity of the data.
getAccessModeFlags(self)Return the access mode flags that were used to create this accessor.
getDescription(self)Return the description of this variable/register.
getId(self)Obtain unique ID for the actual implementation of this accessor.
getName(self)Return the name that identifies the process variable.
getUnit(self)Return the engineering unit.
getValueType(self)Return the type_info for the value type of this accessor.
getVersionNumber(self)Return the version number that is associated with the last transfer.
interrupt(self)Interrupt a blocking read operation.
isInitialised(self)Check if the accessor is initialised.
isReadOnly(self)Check if accessor is read only.
isReadable(self)Check if accessor is readable.
isWriteable(self)Check if accessor is writeable.
read(self)Read from the device to synchronise with the latest event.
readLatest(self)Read the latest event, discarding intermediate updates since the last read if present.
readNonBlocking(self)Read the next event, if available.
setDataValidity(self, validity)Set the data validity of the accessor.
write(self, versionNumber)Trigger a write to the device (no payload).
writeDestructively(self, versionNumber)Like write(), but allows the implementation to destroy the content of internal buffers in the process.
- __init__(self: deviceaccess.VoidRegisterAccessor) None
- dataValidity(self: deviceaccess.VoidRegisterAccessor) ChimeraTK::DataValidity
Return current validity of the data.
Will always return DataValidity.ok if the backend does not support it.
- Returns:
DataValidity: The current data validity state.
- getAccessModeFlags(self: deviceaccess.VoidRegisterAccessor) list
Return the access mode flags that were used to create this accessor.
This can be used to determine the setting of the raw and the wait_for_new_data flags.
- Returns:
list[AccessMode]: List of access mode flags.
- getDescription(self: deviceaccess.VoidRegisterAccessor) str
Return the description of this variable/register.
- Returns:
str: The description string.
- getId(self: deviceaccess.VoidRegisterAccessor) ChimeraTK::TransferElementID
Obtain unique ID for the actual implementation of this accessor.
This means that e.g. two instances created by the same call to Device.getVoidRegisterAccessor() will have the same ID, while two instances obtained by two different calls will have a different ID even when accessing the very same register.
- Returns:
TransferElementID: The unique TransferElement ID.
- getName(self: deviceaccess.VoidRegisterAccessor) str
Return the name that identifies the process variable.
- Returns:
str: The register name.
- getUnit(self: deviceaccess.VoidRegisterAccessor) str
Return the engineering unit.
If none was specified, it will default to ‘n./a.’.
- Returns:
str: The engineering unit string.
- getValueType(self: deviceaccess.VoidRegisterAccessor) std::type_info
Return the type_info for the value type of this accessor.
This can be used to determine the type at runtime.
- Returns:
type: Type information object.
- getVersionNumber(self: deviceaccess.VoidRegisterAccessor) deviceaccess.VersionNumberBase
Return the version number that is associated with the last transfer.
This refers to the last read or write operation.
- Returns:
VersionNumber: The version number of the last transfer.
- interrupt(self: deviceaccess.VoidRegisterAccessor) None
Interrupt a blocking read operation.
This will cause a blocking read to return immediately and throw an InterruptedException.
- Returns:
None: This function does not return a value.
- isInitialised(self: deviceaccess.VoidRegisterAccessor) bool
Check if the accessor is initialised.
- Returns:
bool: True if initialised, false otherwise.
- isReadOnly(self: deviceaccess.VoidRegisterAccessor) bool
Check if accessor is read only.
This means it is readable but not writeable.
- Returns:
bool: True if read only, false otherwise.
- isReadable(self: deviceaccess.VoidRegisterAccessor) bool
Check if accessor is readable.
- Returns:
bool: True if readable, false otherwise.
- isWriteable(self: deviceaccess.VoidRegisterAccessor) bool
Check if accessor is writeable.
- Returns:
bool: True if writeable, false otherwise.
- read(self: deviceaccess.VoidRegisterAccessor) None
Read from the device to synchronise with the latest event.
If AccessMode.wait_for_new_data was set, this function will block until new data has arrived. Otherwise it still might block for a short time until the data transfer was complete.
- See Also:
readNonBlocking: Read without blocking if no data is available. readLatest: Read latest value while discarding intermediate updates.
- Returns:
None: This function does not return a value.
- readLatest(self: deviceaccess.VoidRegisterAccessor) bool
Read the latest event, discarding intermediate updates since the last read if present.
Otherwise this function is identical to readNonBlocking(), i.e. it will never wait for new values and it will return whether a new value was available if AccessMode.wait_for_new_data is set.
- Returns:
bool: True if new data was available, false otherwise.
- readNonBlocking(self: deviceaccess.VoidRegisterAccessor) bool
Read the next event, if available.
If AccessMode.wait_for_new_data was set, this function returns immediately and the return value indicates if a new value was available (true) or not (false).
If AccessMode.wait_for_new_data was not set, this function is identical to read(), which will still return quickly. Depending on the actual transfer implementation, the backend might need to transfer data to obtain the current state before returning. Also this function is not guaranteed to be lock free. The return value will be always true in this mode.
- Returns:
bool: True if new data was available, false otherwise.
- setDataValidity(self: deviceaccess.VoidRegisterAccessor, validity: ChimeraTK::DataValidity) None
Set the data validity of the accessor.
- Args:
validity (DataValidity): The data validity state to set.
- Returns:
None: This function does not return a value.
- write(self: deviceaccess.VoidRegisterAccessor, versionNumber: deviceaccess.VersionNumber = <PyVersionNumber(versionNumber=v0)>) bool
Trigger a write to the device (no payload).
The return value is true if old data was lost on the write transfer (e.g. due to a buffer overflow). In case of an unbuffered write transfer, the return value will always be false.
- Args:
- versionNumber (VersionNumber): Version number to use for this write operation. If not specified, a new
version number is generated.
- Returns:
bool: True if old data was lost on the write transfer.
- See Also:
writeDestructively: Optimized write that may destroy buffer.
- writeDestructively(self: deviceaccess.VoidRegisterAccessor, versionNumber: deviceaccess.VersionNumber = <PyVersionNumber(versionNumber=v0)>) bool
Like write(), but allows the implementation to destroy the content of internal buffers in the process.
This is an optional optimisation, hence there is a default implementation which just calls write(). In any case, the application must expect internal buffers to contain undefined data after calling this function.
- Args:
- versionNumber (VersionNumber): Version number to use for this write operation. If not specified, a new
version number is generated.
- Returns:
bool: True if old data was lost on the write transfer.