# DeviceScanner

public final class DeviceScanner implements IDeviceScanner

Class responsible for discovering nearby Nix devices.

## Constructors

DeviceScanner
Link copied to clipboard
public DeviceScanner DeviceScanner(Context context)

## Properties

state
Link copied to clipboard
private final IDeviceScanner.DeviceScannerState state

Current state of the IDeviceScanner.

## Functions

getState
Link copied to clipboard
public IDeviceScanner.DeviceScannerState getState()

Current state of the IDeviceScanner.

listUsbDevices
Link copied to clipboard
public List<IDeviceCompat> listUsbDevices()

List USB attached IDeviceCompat instances without running a Bluetooth search.

scanForHardwareId
Link copied to clipboard
public IDeviceCompat scanForHardwareId(String id, Long scanPeriodMs)

Starts a search for a specific Nix device using Bluetooth. The search will run until the specified device is found, or until a timeout elapses, whichever is shorter.

setOnScannerStateChangeListener
Link copied to clipboard
public Unit setOnScannerStateChangeListener(IDeviceScanner.OnScannerStateChangeListener listener)

Sets a OnScannerStateChangeListener callback reference.

start
Link copied to clipboard
public IDeviceScanner.DeviceScannerState start(IDeviceScanner.OnDeviceFoundListener listener, Long scanPeriodMs)

Starts a search for nearby Nix devices using Bluetooth for a selected time interval. If no timeout interval is specified, the search will run for DEFAULT_GENERAL_SCAN_PERIOD_MS.

startSearchForId
Link copied to clipboard
public IDeviceScanner.DeviceScannerState startSearchForId(IDeviceScanner.OnDeviceFoundListener listener, String id, Long scanPeriodMs)

Starts a search for a specific Nix device using Bluetooth. The search will run until the specified device is found, or until a timeout elapses, whichever is shorter. This search can alternatively be achieved without a callback by calling the coroutine function scanForHardwareId.

stop
Link copied to clipboard
public Unit stop()

Stops a Bluetooth search if one is currently running.