Driver
- class pyjoulescope_driver.Driver
The Joulescope driver class.
- Parameters:
timeout – The optional timeout for open. None (default) uses the default timeout.
- close(device_prefix, timeout=None)
Close an attached device.
- Parameters:
device_prefix – The prefix name for the device.
timeout – The timeout in seconds. None uses the default timeout.
- device_paths(timeout=None)
List the currently connected devices.
- Parameters:
timeout – The timeout in seconds. None (default) uses the default timeout.
- Returns:
The list of device path strings.
- finalize(timeout=None)
Finalize the driver.
- Parameters:
timeout – The timeout in seconds. None (default) uses the default timeout.
- open(device_prefix, mode=None, timeout=None)
Open an attached device.
- Parameters:
device_prefix – The prefix name for the device.
mode – The open mode which is one of: * ‘defaults’: Reconfigure the device for default operation. * ‘restore’: Update our state with the current device state. * ‘raw’: Open the device in raw mode for development or firmware update. * None: equivalent to ‘defaults’.
timeout – The timeout in seconds. None uses the default timeout.
- publish(topic: str, value, timeout=None)
Publish a value to a topic.
- Parameters:
topic – The topic string.
value – The value, which must pass validation for the topic.
timeout – The timeout in seconds. None (default) uses the default timeout.
- Raise:
On error.
- query(topic: str, timeout=None)
Query the value for a topic.
- Parameters:
topic – The topic name.
timeout – The timeout in seconds. None (default) uses the default timeout.
- Returns:
The value for the topic.
- Raise:
On error.
- subscribe(topic: str, flags, fn, timeout=None)
Subscribe to receive topic updates.
- Parameters:
self – The driver instance.
topic – Subscribe to this topic string.
flags –
The flags or list of flags for this subscription. The flags can be int32 jsdrv_subscribe_flag_e or string mnemonics, which are:
pub: Subscribe to normal values
pub_retain: Subscribe to normal values and immediately publish all matching retained values. With timeout, this function does not return successfully until all retained values have been published.
metadata_req: Subscribe to metadata requests (not normally useful).
metadata_rsp: Subscribe to metadata updates.
metadata_rsp_retain: Subscribe to metadata updates and immediately publish all matching retained metadata values.
query_req: Subscribe to all query requests (not normally useful).
query_rsp: Subscribe to all query responses.
return_code: Subscribe to all return code responses.
fn – The function to call on each publish. Note that python dynamically constructs bound methods. To unsubscribe a method, provide the exact same bound method instance to unsubscribe.
timeout – The timeout in float seconds to wait for this operation to complete. None waits the default amount. 0 does not wait and subscription will occur asynchronously.
- Raises:
RuntimeError – on subscribe failure.
- unsubscribe(topic, fn, timeout=None)
Unsubscribe from a topic.
- Parameters:
topic – The topic name string.
fn – The function previously provided to
subscribe()
.timeout – The timeout in seconds. None (default) uses the default timeout.
- Raise:
On error.
- unsubscribe_all(fn, timeout=None)
Unsubscribe a callback from all topics.
- Parameters:
fn – The function previously provided to
subscribe()
.timeout – The timeout in seconds. None (default) uses the default timeout.
- Raise:
On error.
- class pyjoulescope_driver.ElementType
The element type enumeration.
- class pyjoulescope_driver.ErrorCode
The error code enumeration.
- class pyjoulescope_driver.Field
The field enumeration.
- class pyjoulescope_driver.LogLevel
The log level enumeration.
- class pyjoulescope_driver.SubscribeFlags
The available subscribe flags.