• Docs
  • API
Show / Hide Table of Contents
  • NixUniversalSDK
    • BatteryStateEventArgs
    • ColorData
    • ColorDifferenceType
    • ColorDifferenceTypeExtensions
    • ColorType
    • ColorTypeExtensions
    • ColorUtils
    • CommandStatus
    • CommandStatusExtensions
    • DensityData
    • DensityStatus
    • DensityStatusExtensions
    • DeviceCompat
    • DeviceResult
    • DeviceScanner
    • DeviceScannerState
    • DeviceScannerStateExtensions
    • DeviceState
    • DeviceStateExtensions
    • DeviceStatus
    • DeviceStatusArgs
    • DeviceStatusExtensions
    • DeviceType
    • DeviceTypeExtensions
    • DeviceVersion
    • ExtPowerStateEventArgs
    • IColorData
    • IColorDataExtensions
    • IDensityData
    • IDeviceCompat
    • IDeviceCompatEvents
    • IDeviceCompatExtensions
    • IDeviceScanner
    • IDeviceScannerEvents
    • IMeasurementData
    • IMeasurementDataExtensions
    • ISpectralData
    • ISpectralDataExtensions
    • Illuminant
    • IlluminantExtensions
    • InterfaceType
    • InterfaceTypeExtensions
    • LicenseFeature
    • LicenseFeatureExtensions
    • LicenseManager
    • LicenseManagerState
    • MeasurementData
    • Observer
    • ObserverExtensions
    • ReferenceWhite
    • ReferenceWhiteExtensions
    • ScanMode
    • ScanModeExtensions
    • ScanResultEventArgs
    • ScannerCreatedEventArgs
    • SpectralData
  • NixUniversalSDK.Wrapper
    • Constants
    • Delegates
    • Delegates.BoolValue
    • Delegates.Empty
    • Delegates.IntValue
    • Delegates.StringValue
    • DeviceCompatModule
    • DeviceScannerModule
    • Exported

Class DeviceScanner

Class responsible for discovering nearby Nix devices.

Inheritance
object
DeviceScanner
Implements
IDeviceScanner
IDeviceScannerEvents
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: NixUniversalSDK
Assembly: NixUniversalSDK.dll
Syntax
public class DeviceScanner : IDeviceScanner, IDeviceScannerEvents

Fields

DefaultGeneralScanPeriodMs

Scan period in milliseconds (20000) used when no time period is provided to Start(long)

Declaration
public const long DefaultGeneralScanPeriodMs = 20000
Field Value
Type Description
long

DefaultSingleDevicePeriodMs

Scan period in milliseconds (10000) used when no time period is provided to SearchForIdAsync(string, long)

Declaration
public const long DefaultSingleDevicePeriodMs = 10000
Field Value
Type Description
long

Properties

State

Current state of the IDeviceScanner

Declaration
public DeviceScannerState State { get; }
Property Value
Type Description
DeviceScannerState

Methods

InitializeAsync()

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

Declaration
public 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
public 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
public Task<IDeviceCompat> SearchForIdAsync(string id, long scanPeriodMs)
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
public 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
public void Stop()

Events

ScanResult

Event that is invoked when the IDeviceScanner has found a Nix device. This is invoked each time that a device advertisement has been received, or signal strength Rssi has updated, so multiple events may be received for a given Nix device. The Id can be used to uniquely identify each separate device.

Declaration
public event EventHandler<ScanResultEventArgs> ScanResult
Event Type
Type Description
EventHandler<ScanResultEventArgs>

ScannerCreated

Event that is invoked when the IDeviceScanner has been created

Declaration
public event EventHandler<ScannerCreatedEventArgs> ScannerCreated
Event Type
Type Description
EventHandler<ScannerCreatedEventArgs>

ScannerStarted

Event that is invoked when the IDeviceScanner starts searching for devices

Declaration
public event EventHandler ScannerStarted
Event Type
Type Description
EventHandler

ScannerStopped

Event that is invoked when the IDeviceScanner stops searching for devices

Declaration
public event EventHandler ScannerStopped
Event Type
Type Description
EventHandler

Implements

IDeviceScanner
IDeviceScannerEvents
In this article
Back to top Generated by DocFX