# IDeviceScanner

interface IDeviceScanner

#### Inheritors

DeviceScanner

## Types

Companion
Link copied to clipboard
object Companion
DeviceScannerState
Link copied to clipboard
enum DeviceScannerState : Enum<IDeviceScanner.DeviceScannerState>

Enum class to describe the current state of the IDeviceScanner.

OnDeviceFoundListener
Link copied to clipboard
interface OnDeviceFoundListener

Interface definition for a callback to be invoked when an IDeviceScanner has discovered a supported Nix device.

OnScannerStateChangeListener
Link copied to clipboard
interface OnScannerStateChangeListener

Interface definition for a callback to be invoked when an IDeviceScanner starts or stops a search.

## Properties

state
Link copied to clipboard
abstract val state: IDeviceScanner.DeviceScannerState

Current state of the IDeviceScanner.

## Functions

listUsbDevices
Link copied to clipboard
abstract fun listUsbDevices(): List<IDeviceCompat>

List USB attached IDeviceCompat instances without running a Bluetooth search.

scanForHardwareId
Link copied to clipboard
abstract suspend fun scanForHardwareId(id: String, scanPeriodMs: Long = DEFAULT_SINGLE_DEVICE_PERIOD_MS): IDeviceCompat?

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
abstract fun setOnScannerStateChangeListener(listener: IDeviceScanner.OnScannerStateChangeListener)

Sets a OnScannerStateChangeListener callback reference.

start
Link copied to clipboard
abstract fun start(listener: IDeviceScanner.OnDeviceFoundListener, scanPeriodMs: Long = DEFAULT_GENERAL_SCAN_PERIOD_MS): IDeviceScanner.DeviceScannerState

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
abstract fun startSearchForId(listener: IDeviceScanner.OnDeviceFoundListener, id: String, scanPeriodMs: Long = DEFAULT_SINGLE_DEVICE_PERIOD_MS): IDeviceScanner.DeviceScannerState

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
abstract fun stop()

Stops a Bluetooth search if one is currently running.