Finding Devices

Functions for detecting, identifying, and retrieving information about data-logging devices.

endaq.device.deviceChanged(recordersOnly=True, clear=False)

Returns True if a drive has been connected or disconnected since the last call to deviceChanged().

Parameters
  • recordersOnly (bool, default: True) – If False, any change to the mounted drives is reported as a change. If True, the mounted drives are checked and True is only returned if the change occurred to a recorder. Checking for recorders only takes marginally more time.

  • clear (bool, default: False) – If True, clear the cache of previously-detected drives and devices.

endaq.device.findDevice(sn=None, chipId=None, paths=None, unmounted=False, update=False, strict=True)

Find a specific recorder by serial number or unique chip ID. One or the other must be provided, but not both. Note that early firmware versions do not report the device’s chip ID.

Parameters
  • sn (Union[str, int, None], default: None) – The serial number of the recorder to find. Cannot be used with chipId. It can be an integer or a formatted serial number string (e.g., 12345 or “S00012345”).

  • chipId (Union[str, int, None], default: None) – The chip ID of the recorder to find. Cannot be used with sn. It can be an integer or a hex string. Note that chipId cannot be used to find SlamStick and older enDAQ S devices (prior to hardware revision 2.0), as they do not report their chip ID.

  • paths (Optional[List[Union[AnyStr, Path, Drive]]], default: None) – A list of specific paths to recording devices. Defaults to all found devices (as returned by getDeviceList()).

  • unmounted (bool, default: False) – If True, include devices connected by USB and responsive to commands but not appearing as drives. Note: Not all devices/firmware versions support this.

  • update (bool, default: False) – If True, update the path of known devices if they have changed (e.g., their drive letter or mount point changed after a device reset).

  • strict (bool, default: True) – If False, only the directory structure is used to identify a recorder. If True, non-FAT file systems will be automatically rejected.

Returns

An instance of a Recorder subclass representing the device with the specified serial number or chip ID, or None if it cannot be found.

Return type

Optional[endaq.device.base.Recorder]

endaq.device.fromRecording(doc)

Create a ‘virtual’ recorder from the data contained in a recording file.

Parameters

doc (Dataset) – An imported IDE recording. Note that very old IDE files may not contain the metadata requires to create a virtual device.

endaq.device.getDeviceList(strict=True)

Get a list of local data recorders, as their respective path (or the drive letter under Windows).

Parameters

strict (bool, default: True) – If False, only the directory structure is used to identify a recorder. If True, non-FAT file systems will be automatically rejected.

Returns

A list of Drive objects (named tuples containing the drive path, label, and other low-level filesystem info).

Return type

List[endaq.device.types.Drive]

endaq.device.getDevices(paths=None, unmounted=True, update=True, strict=True)

Get a list of data recorder objects.

Parameters
  • paths (Optional[List[Union[AnyStr, Path, Drive]]], default: None) – A list of specific paths to recording devices. Defaults to all found devices (as returned by getDeviceList()).

  • unmounted (bool, default: True) – If True, include devices connected by USB and responsive to commands but not appearing as drives. Note: Not all devices/firmware versions support this.

  • update (bool, default: True) – If True, update the path of known devices if they have changed (e.g., their drive letter or mount point changed after a device reset).

  • strict (bool, default: True) – If False, only the directory structure is used to identify a recorder. If True, non-FAT file systems and non-removable media will be automatically rejected.

Returns

A list of instances of Recorder subclasses.

Return type

List[endaq.device.base.Recorder]

endaq.device.getRecorder(path, update=False, strict=True)

Get a specific recorder by its path.

Parameters
  • path (Union[AnyStr, Path, Drive]) – The filesystem path to the recorder’s root directory.

  • update (bool, default: False) – If True, update the path of known devices if they have changed (e.g., their drive letter or mount point changed after a device reset).

  • strict (bool, default: True) – If False, only the directory structure within path is used to identify a recorder. If True, non-FAT file systems will be automatically rejected.

Returns

An instance of a Recorder subclass, or None if the path is not a recorder.

Return type

Optional[endaq.device.base.Recorder]

endaq.device.isRecorder(path, strict=True)

Determine if the given path is a recording device.

Parameters
  • path (Union[AnyStr, Path, Drive]) – The filesystem path to check.

  • strict (bool, default: True) – If False, only the directory structure within path is used to identify a recorder. If True, non-FAT file systems will be automatically rejected.

endaq.device.onRecorder(path, strict=True)

Returns the root directory of a recorder from a path to a directory or file on that recorder. It can be used to test whether a file is on a recorder. False is returned if the path is not on a recorder. The test is only whether the path refers to a recorder, not whether the path or file actually exists; if you need to know if the path is valid, perform your own checks first.

Parameters
  • path (Union[AnyStr, Path, Drive]) – The full path/name of a file.

  • strict (bool, default: True) – If False, only the directory structure within path is used to identify a recorder. If True, non-FAT file systems will be automatically rejected.

Returns

The path to the root directory of a recorder (e.g. the drive letter in Windows) if the path is to a subdirectory on a recording device, False if not.

Return type

bool