Device Enumeration

DriverType

class fluxEngine.DriverType(value)

Driver Type

Instrument = 0

Instrument driver

This driver accesses instrument devices, such as cameras, spectrometers, and other sensors.

LightControl = 2

Light control device

This driver accesses light control devices that can be used to switch a light on and off, and possibly set the light intensity.

Unknown = -1

Unknown driver

This driver is for a device type that is not supported by fluxEngine.

DriverState

class fluxEngine.DriverState(value)

Driver state

Describes the state of the driver at the end of the enumeration process. This can be used to detect issues with the driver.

Crashed = 4

Driver crashed

The driver crashed during enumeration. This typically indicates that there is an issue with a missing dependency of the driver.

EnumerationError = 3

Enumeration error

The driver generated an error message during the enumeration process. That error can be queried from the enumeration result.

LoadError = 2

Driver load error

The driver could not be loaded, for example because the driver file is not valid, or the isolation executable could not be found (in which case all drivers will suffer from this error).

LoadTimeout = 1

Driver load timeout

The driver didn’t respond at all within the specified enumeration timeout, indicating that it didn’t load in time. If a sufficiently long timeout has been provided (e.g. more than 3 seconds) this is typically an indication that there is an issue with the driver.

OK = 0

OK

The driver could successfully perform the enumeration. This is a valid state even if the driver didn’t find any device.

Unknown = -1

The state is unknown

This likely indicates an internal error during enumeration.

EnumeratedDriver

class fluxEngine.EnumeratedDriver(name, type, description, version, state)

Enumerated driver

Describes a driver that was used during enumeration. Failed drivers will also have such a structure, even though they will not have any associated devices.

This structure is returned as part of an enumeration process. The user will never need to create a structure of this type themselves, but will access the properties of the driver through the attributes.

name

The name of the driver

This is the filename component of the driver and may be used to identify the driver for connection purposes.

Type:

str

type

The type of the driver

This is required for identifying the driver for connection purposes.

Type:

DriverType

description

A human-readable name of the driver

Type:

str

version

A human-readable version of the driver

Type:

str

state

The state of the driver

Type:

DriverState

devices

The devices the driver has found

This list may be empty if a specific driver has found no devices.

Type:

list(EnumeratedDevice)

EnumeratedDevice

class fluxEngine.EnumeratedDevice(id, driver, displayName, manufacturer, model, serialNumber, parameterInfo)

Enumerated device

Describes a device that was found during enumeration.

Note that some drivers can’t actually enumerate the available devices in the system, and rely on probing to actually connect to a device. In that case a device entry will appear regardless of whether the device is actually present, and connection failure is the only way of ascertaining that the device is not actually present.

This structure is returned as part of an enumeration process. The user will never need to create a structure of this type themselves, but will access the properties of the device through the attributes.

id

A driver-specific id of the device

This id must be provided in combination with the type and name of the driver for a connection attempt.

The id is guaranteed to be stable for a short period of time after enumeration so that it may be used for connection purposes.

It is not guaranteed to be stable across reboots, software updates, etc. The user should never rely on the specific content of this id, even if it appars to be stable at the moment.

Type:

bytes

driver

The driver that enumerated the device

Type:

EnumeratedDriver

displayName

The display name of the device

This is a human-readable text that is of the format Vendor Model (Serial Number), but in such a manner that if one or more of these strings is empty a sensible text will still be generated – for example, if a device has no serial number, the format will be Vendor Model instead.

Type:

str

manufacturer

The manufacturer of the device

Type:

str

model

The model of the device

Type:

str

serialNumber

The serial number of the device

This may be empty, which can mean two things: either the device has no serial number, or the serial number could not be obtained during device enumeration and requires the user to connect to the device to actually read it.

Type:

str

parameterInfo

The parameter info for the connection parameters

Contains information about all connection parameters of the device. For some devices it is necessary to set the some parameters (such as the path to a calibration file) when connecting to the device. This contains the available parameters.

Type:

ParameterInfo

EnumerationWarning

class fluxEngine.EnumerationWarning(driver, message)

Enumeration warning

Describes a warning that was encountered during enumeration. This could be a USB device that could not be accessed because the correct kernel driver is not installed, or a network device that was found but was on the wrong subnet for a given network interface.

This structure is returned as part of an enumeration process. The user will never need to create a structure of this type themselves, but will access the properties of the device through the attributes.

driver

The driver for which the warning occurred

Type:

EnumeratedDriver

message

The warning message

Type:

str

EnumerationError

class fluxEngine.EnumerationError(driver, message)

Enumeration error

Describes an error that occurred during enumeration, for example a driver that crashed.

This structure is returned as part of an enumeration process. The user will never need to create a structure of this type themselves, but will access the properties of the device through the attributes.

driver

The driver for which the error occurred

Type:

EnumeratedDriver

message

The error message

Type:

str

EnumerationResult

class fluxEngine.EnumerationResult(devices, drivers, warnings, errors)

The result of an enumeration process

This structure is returned by an enumeration process. The user will never need to create a structure of this type themselves, but will access the properties of the device through the attributes.

devices

The devices that were found

Type:

list(EnumeratedDevice)

drivers

The drivers that were used during enumeration

Type:

list(EnumeratedDriver)

warnings

Warnings that occurred during enumeration

Type:

list(EnumerationWarning)

errors

Errors that occurred during enumeration

Type:

list(EnumerationError)

enumerateDevices

fluxEngine.enumerateDevices(handle, driverType, timeout)

Enumerate devices

This function enumerates all devices that are connected to the system for which drivers have been installed. Please note that Handle.setDriverBaseDirectory() must be called before this function to indicate where the drivers are to be found. Also, if the user has changed the path to the fluxDriverIsolation.exe (by default it is deployed along with the Python module) they must also call Handle.setDriverIsolationExecutable() before this function.

Parameters:
  • handle (Handle) – The fluxEngine handle

  • driverType (DriverType or None) – The type of driver to enumerate. Specify None to indicate all driver types should be enumerated.

  • timeout (int) – How long to enumerate in milliseconds. This method will always wait this long for the enumeration process to complete and will then return all devices that were found within that given timespan. It is recommended to set this to at least 3.5 seconds.

Returns:

The enumerated devices

Return type:

EnumerationResult