Device Discovery

The device discovery functions allow the application to find Joulescopes connected to the host. Most scripts that only support a single Joulescopes will use:

joulescope.scan_require_one(config='auto')

To support multiple Joulescopes, use:

joulescope.scan(config='auto')

See joulescope.driver.Device.

scan

joulescope.scan(name: Optional[str] = None, config=None)List[joulescope.driver.Device][source]

Scan for connected devices.

Parameters
  • name – The case-insensitive device name to scan. None (default) is equivalent to ‘Joulescope’.

  • config – The configuration for the Device.

Returns

The list of Device instances. A new instance is created for each detected device. Use scan_for_changes() to preserved existing instances.

Raises

None - guaranteed not to raise an exception

scan_require_one

joulescope.scan_require_one(name: Optional[str] = None, config=None)joulescope.driver.Device[source]

Scan for one and only one device.

Parameters
  • name – The case-insensitive device name to scan. None (default) is equivalent to ‘Joulescope’.

  • config – The configuration for the Device.

Returns

The Device found.

Raises

RuntimeError – If no devices or more than one device was found.

scan_for_changes

joulescope.scan_for_changes(name: Optional[str] = None, devices=None, config=None)[source]

Scan for device changes.

Parameters
  • name – The case-insensitive device name to scan. None (default) is equivalent to ‘Joulescope’.

  • devices – The list of existing Device instances returned by a previous scan. Pass None or [] if no scan has yet been performed.

  • config – The configuration for the Device.

Returns

The tuple of lists (devices_now, devices_added, devices_removed). “devices_now” is the list of all currently connected devices. If the device was in “devices”, then return the Device instance from “devices”. “devices_added” is the list of connected devices not in “devices”. “devices_removed” is the list of devices in “devices” but not “devices_now”.