Show / Hide Table of Contents

# Interface IDeviceScanner

Interface implemented by the DeviceScanner

##### Inherited Members

IDeviceScannerEvents.ScannerCreated
IDeviceScannerEvents.ScannerStarted
IDeviceScannerEvents.ScannerStopped
IDeviceScannerEvents.ScanResult

###### Namespace: NixUniversalSDK

###### Assembly: NixUniversalSDK.dll

##### Syntax

    public interface IDeviceScanner : IDeviceScannerEvents

### Properties

#### State

Current state of the IDeviceScanner

##### Declaration

    DeviceScannerState State { get; }

##### Property Value

Type | Description
--- | ---
DeviceScannerState |

### Methods

#### InitializeAsync()

Initializes the IDeviceScanner and verifies Bluetooth adapter state in the host PC

##### Declaration

    Task<DeviceScannerState> InitializeAsync()

##### Returns

Type | Description
--- | ---
Task<DeviceScannerState> | DeviceScannerState of the IDeviceScanner after initialization

#### ListUsbDevicesAsync()

Lists USB attached IDeviceCompat instances without running a Bluetooth search

##### Declaration

    Task<IEnumerable<IDeviceCompat>> ListUsbDevicesAsync()

##### Returns

Type | Description
--- | ---
Task<IEnumerable<IDeviceCompat>> | Task with resulting list of USB attached devices

#### SearchForIdAsync(string, long)

Searches for a specific Nix device via USB and Bluetooth. The search will run until the specified device is found, or until the specified time interval elapses, whichever is shorter. If no time interval is specified, the search will run for DefaultSingleDevicePeriodMs.

##### Declaration

    Task<IDeviceCompat> SearchForIdAsync(string id, long scanPeriodMs = 10000)

##### Parameters

Type | Name | Description
--- | --- | ---
string | id | Nix device ID used to filter search results
long | scanPeriodMs | Period to run the search in milliseconds. Must be positive

##### Returns

Type | Description
--- | ---
Task<IDeviceCompat> | Nix device instance, or null if no device is found

#### Start(long)

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 DefaultGeneralScanPeriodMs

##### Declaration

    void Start(long scanPeriodMs = 20000)

##### Parameters

Type | Name | Description
--- | --- | ---
long | scanPeriodMs | Period to run the search in milliseconds. Set to a negative value for continuous search

#### Stop()

Stops a Bluetooth search if one is currently running.

##### Declaration

    void Stop()