# DeviceScanner

class DeviceScanner(context: Context) : IDeviceScanner

Class responsible for discovering nearby Nix devices.

## Constructors

DeviceScanner
Link copied to clipboard
constructor(context: Context)

## Types

Util
Link copied to clipboard
object Util

## Properties

state
Link copied to clipboard
open override val state: IDeviceScanner.DeviceScannerState

Current state of the IDeviceScanner.

## Functions

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

List USB attached IDeviceCompat instances without running a Bluetooth search.

scanForHardwareId
Link copied to clipboard
open suspend override fun scanForHardwareId(id: String, scanPeriodMs: Long): 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
open override fun setOnScannerStateChangeListener(listener: IDeviceScanner.OnScannerStateChangeListener)

Sets a OnScannerStateChangeListener callback reference.

start
Link copied to clipboard
open override fun start(listener: IDeviceScanner.OnDeviceFoundListener, scanPeriodMs: Long): 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
open override fun startSearchForId(listener: IDeviceScanner.OnDeviceFoundListener, id: String, scanPeriodMs: Long): 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
open override fun stop()

Stops a Bluetooth search if one is currently running.