# IDeviceCompat

interface IDeviceCompat : Comparable<IDeviceCompat>

Interface describing the supported properties and methods for a Nix device. IDeviceCompat objects are found nearby using the DeviceScanner.

#### Inheritors

DeviceCompat

## Types

InterfaceType
Link copied to clipboard
enum InterfaceType : Enum<IDeviceCompat.InterfaceType>

Enum describing the supported connection interface types for Nix devices.

OnDeviceStateChangeListener
Link copied to clipboard
interface OnDeviceStateChangeListener

Definition for a callback from an IDeviceCompat instance on a connection state change, battery state change, or external power state change.

## Properties

batteryLevel
Link copied to clipboard
abstract val batteryLevel: Int?

Current battery level for this device (0 - 100), or null if not available. The value is valid only after a connection has successfully been opened.

extPowerState
Link copied to clipboard
abstract val extPowerState: Boolean

External power connection state for this device. The value is valid only after a connection has successfully been opened.

fieldCalibrationDue
Link copied to clipboard
abstract val fieldCalibrationDue: Boolean

Flag to indicate if in-field calibration is recommended for this device at this time (if supported). This value is only valid after opening a connection and is a function of both time and ambient temperature. This value also updates each time a measurement is completed.

fieldCalibrationEnabled
Link copied to clipboard
abstract val fieldCalibrationEnabled: Boolean

Flag to indicate if in-field calibration results are applied (`true`) or bypassed (`false`) when evaluating the final calibrated measurement result. Value is `true` by default if supported by the device. It is recommended to leave this set to `true` if supported.

fieldCalibrationMaxDelta
Link copied to clipboard
abstract var fieldCalibrationMaxDelta: Double

Maximum Delta E threshold used when performing in-field calibration (if supported), or NaN if the device does not support this operation. It is recommended to leave this set to its default value, which can vary by device type. If a difference from the reference greater than this value is detected during runFieldCalibration, the command will fail with status CommandStatus.ERROR_SCAN_DELTA.

firmwareVersion
Link copied to clipboard
abstract val firmwareVersion: DeviceVersion

Firmware version of this device. The value is valid only after a connection has successfully been opened.

hapticFeedbackEnabled
Link copied to clipboard
abstract val hapticFeedbackEnabled: Boolean

Flag to indicate if device haptic feedback is enabled.

hardwareVersion
Link copied to clipboard
abstract val hardwareVersion: DeviceVersion

Hardware version of this device. The value is valid only after a connection has successfully been opened.

hasOptions
Link copied to clipboard
open val hasOptions: Boolean

Helper function to describe if any on-device options are available. Value is `true` if any one of supportsFieldCalibration, supportsTemperatureCompensation, supportsHapticFeedback, or supportsRgbFeedback is `true`.

id
Link copied to clipboard
open val id: String

Unique identifier for this device

interfaceType
Link copied to clipboard
open val interfaceType: IDeviceCompat.InterfaceType

Interface / connection type for this device

name
Link copied to clipboard
open val name: String

Name for this device.

note
Link copied to clipboard
abstract val note: String

Factory note for this device, containing allocation code. The value is valid only after a connection has successfully been opened.

powerState
Link copied to clipboard
abstract val powerState: Boolean

Flag set to `true` if sufficient power is available to complete a measurement, or `false` if a measurement will be aborted (function of external power connection and battery level).

providesDensity
Link copied to clipboard
open val providesDensity: Boolean

Flag indicating if this device is capable of providing absolute density values in its IMeasurementData results. This value only indicates the hardware capability; the LicenseFeature.DENSITY_DATA feature must also be be enabled by the active license. See also LicenseManager.Shared.isFeatureEnabled.

providesSpectral
Link copied to clipboard
open val providesSpectral: Boolean

Flag indicating if this device is capable of providing spectral values in its IMeasurementData results. This value only indicates the hardware capability; the LicenseFeature.SPECTRAL_DATA feature must also be be enabled by the active license. See also LicenseManager.Shared.isFeatureEnabled.

referenceDate
Link copied to clipboard
abstract val referenceDate: Date?

Date that the last in-field normalization was last performed, or `null` if this device does not support this feature.

referenceTemperature
Link copied to clipboard
abstract val referenceTemperature: Float?

Baseline temperature for this device. Corresponds to in-field normalization temperature for DeviceType.SPECTRO2 and DeviceType.MINI3, or factory temperature for others. Value is `null` if the device does not support this feature.

rgbFeedbackEnabled
Link copied to clipboard
abstract val rgbFeedbackEnabled: Boolean

Flag to indicate if device RGB feedback is enabled.

rssi
Link copied to clipboard
open var rssi: Int

Signal strength for this device

scanCount
Link copied to clipboard
abstract val scanCount: Int?

Lifetime scan count for this device, or `null` if this device does not support this feature.

scanTemperature
Link copied to clipboard
abstract val scanTemperature: Float?

Last known temperature of the device, corresponding to the most recently completed scan since the device was connected. Value is `null` if the device does not support this feature. This value is only valid if the device is connected and a measurement has completed.

sdkId
Link copied to clipboard
open val sdkId: String

Build ID for this Nix SDK binary

serialNumber
Link copied to clipboard
abstract val serialNumber: String

Serial number for this device. The value is valid only after a connection has successfully been opened.

softwareVersion
Link copied to clipboard
abstract val softwareVersion: DeviceVersion

Software version of this device. The value is valid only after a connection has successfully been opened.

state
Link copied to clipboard
abstract val state: DeviceState

Current state of this device

supportedModes
Link copied to clipboard
abstract val supportedModes: Array<ScanMode>

List of scan modes that are supported by this device. The list is valid only after a connection has successfully been opened.

supportedReferences
Link copied to clipboard
abstract val supportedReferences: Array<ReferenceWhite>

List of supported reference white points for the colorimetry data available from the IMeasurementData results provided by this device.

supportsFieldCalibration
Link copied to clipboard
abstract val supportsFieldCalibration: Boolean

Flag to indicate if this device supports in-field calibration using the provided reference tile.

supportsHapticFeedback
Link copied to clipboard
abstract val supportsHapticFeedback: Boolean

Flag to indicate if the device supports built-in haptic feedback.

supportsRgbFeedback
Link copied to clipboard
abstract val supportsRgbFeedback: Boolean

Flag to indicate if the device supports built-in RGB feedback.

supportsTemperatureCompensation
Link copied to clipboard
abstract val supportsTemperatureCompensation: Boolean

Flag to indicate if this device supports automatic temperature compensation to correct for small changes in ambient temperature.

temperatureCompensationEnabled
Link copied to clipboard
abstract val temperatureCompensationEnabled: Boolean

Flag to indicate if ambient temperature compensation / correction is applied (`true`) or bypassed (`false`) when evaluating the final calibrated measurement. Value is `true` by default if supported by the device. It is recommended to leave this set to `true` if supported.

type
Link copied to clipboard
abstract val type: DeviceType

Type for this device.

## Functions

compareTo
Link copied to clipboard
open operator override fun compareTo(other: IDeviceCompat): Int

Compares this device instance to another (via signal strength / RSSI)

connect
Link copied to clipboard
open fun connect(listener: IDeviceCompat.OnDeviceStateChangeListener)

Open a connection to this Nix device. This operation is asynchronous and this method returns immediately. Status of this operation is updated via the provided OnDeviceStateChangeListener callback.

disconnect
Link copied to clipboard
abstract fun disconnect()

Disconnect from this Nix device, or cancel a connection attempt currently in progress.

invalidateFieldCalibration
Link copied to clipboard
open fun invalidateFieldCalibration(listener: OnDeviceResultListener)

Invalidates current field calibration date, so that fieldCalibrationDue is reported as `true`, if supported by the device.

isFeatureSupported
Link copied to clipboard
open fun isFeatureSupported(feature: LicenseFeature): Boolean

Helper to check if a particular LicenseFeature is supported by this device.

isModeSupported
Link copied to clipboard
open fun isModeSupported(scanMode: ScanMode): Boolean

Helper to check if a particular scan mode is supported by this device (i.e. - checks if the mode is present in the supportedModes list). This value is valid only after a connection has successfully been opened.

isTileStringValid
Link copied to clipboard
open fun isTileStringValid(tileString: String): Boolean?

Used to check if a decoded string from the reference tile is valid. Returns `null` if the string is not in the expected format, `false` if the string is in a valid format but does not match this particular device, `true` if the string is valid.

ledTest
Link copied to clipboard
open fun ledTest(listener: OnDeviceResultListener)

Manually run a LED test routine. On devices featuring RGB feedback, this will use the RGB LEDs. On other devices, this will flash the white LEDs. This method is asynchronous and will return immediately. Status of this operation is updated via the provided OnDeviceResultListener callback.

measure
Link copied to clipboard
open fun measure(listener: OnDeviceResultListener, vararg modes: ScanMode)

Run a measurement for the specified scan modes, or all supported scan modes if none are specified. If unsupported modes are selected, the measurement will fail with status code CommandStatus.ERROR_NOT_SUPPORTED. This method is asynchronous and will return immediately. Status of this operation is provided by the OnDeviceResultListener callback

providesColor
Link copied to clipboard
open fun providesColor(reference: ReferenceWhite): Boolean
open fun providesColor(illuminant: Illuminant, observer: Observer): Boolean

Helper to check if a particular reference white point is supported by the colorimetry data from this device (i.e - checks if the reference is present in the supportedReferences list`).

runFieldCalibration
Link copied to clipboard
open fun runFieldCalibration(listener: OnDeviceResultListener, tileString: String)

Start field calibration using provided reference tile, if supported. Upon executing this command, the scan of the reference tile will begin immediately. The user MUST be prompted to place the device onto the reference tile BEFORE this method is executed. This method is asynchronous and will return immediately. This command requires data from the reference tile QR code. As the format varies between different device types, the string data should be provided exactly as decoded from the QR code.

setFieldCalibrationEnabled
Link copied to clipboard
open fun setFieldCalibrationEnabled(listener: OnDeviceResultListener, enabled: Boolean)

Set the value for fieldCalibrationEnabled. This method is asynchronous and will return immediately.

setHapticFeedbackEnabled
Link copied to clipboard
open fun setHapticFeedbackEnabled(listener: OnDeviceResultListener, enabled: Boolean)

Set the value for hapticFeedbackEnabled. This method is asynchronous and will return immediately.

setRgbFeedbackEnabled
Link copied to clipboard
open fun setRgbFeedbackEnabled(listener: OnDeviceResultListener, enabled: Boolean)

Set the value for rgbFeedbackEnabled. This method is asynchronous and will return immediately.

setTemperatureCompensationEnabled
Link copied to clipboard
open fun setTemperatureCompensationEnabled(listener: OnDeviceResultListener, enabled: Boolean)

Set the value for temperatureCompensationEnabled. This method is asynchronous and will return immediately.