Show / Hide Table of Contents

# Class DeviceCompat

Class describing the supported properties and methods for a Nix device.

##### Inheritance

object
DeviceCompat

##### Implements

IDeviceCompat
IDeviceCompatEvents
IComparable

##### 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 DeviceCompat : IDeviceCompat, IDeviceCompatEvents, IComparable

### Fields

#### BuildUuid

Build ID for this `NixUniversalSDK` binary.

##### Declaration

    [Obsolete("Use LicenseManager.Uuid instead", false)]
    public readonly string BuildUuid

##### Field Value

Type | Description
--- | ---
string |

### Properties

#### BatteryLevel

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.

##### Declaration

    public int? BatteryLevel { get; }

##### Property Value

Type | Description
--- | ---
int? |

#### ExtPowerState

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

##### Declaration

    public bool ExtPowerState { get; }

##### Property Value

Type | Description
--- | ---
bool |

#### FieldCalibrationDue

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.

##### Declaration

    public bool FieldCalibrationDue { get; }

##### Property Value

Type | Description
--- | ---
bool |

#### FieldCalibrationEnabled

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.

##### Declaration

    public bool FieldCalibrationEnabled { get; }

##### Property Value

Type | Description
--- | ---
bool |

#### FieldCalibrationMaxDelta

Maximum Delta E threshold used when performing in-field calibration (if supported), or NaN if the device does not support this operation. If a difference from the reference greater than this value is detected during RunFieldCalibrationAsync(string), the command will fail with status ErrorScanDelta.

##### Declaration

    public double FieldCalibrationMaxDelta { get; set; }

##### Property Value

Type | Description
--- | ---
double |

#### FirmwareVersion

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

##### Declaration

    public DeviceVersion FirmwareVersion { get; }

##### Property Value

Type | Description
--- | ---
DeviceVersion |

#### HapticFeedbackEnabled

Flag to indicate if device haptic feedback is enabled.

##### Declaration

    public bool HapticFeedbackEnabled { get; }

##### Property Value

Type | Description
--- | ---
bool |

#### HardwareVersion

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

##### Declaration

    public DeviceVersion HardwareVersion { get; }

##### Property Value

Type | Description
--- | ---
DeviceVersion |

#### Id

Unique identifier for this device

##### Declaration

    public string Id { get; }

##### Property Value

Type | Description
--- | ---
string |

#### InterfaceType

Interface / connection type for this device

##### Declaration

    public InterfaceType InterfaceType { get; }

##### Property Value

Type | Description
--- | ---
InterfaceType |

#### Name

Name for this device

##### Declaration

    public string Name { get; }

##### Property Value

Type | Description
--- | ---
string |

#### Note

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

##### Declaration

    public string Note { get; }

##### Property Value

Type | Description
--- | ---
string |

#### PowerState

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

##### Declaration

    public bool PowerState { get; }

##### Property Value

Type | Description
--- | ---
bool |

#### ProvidesDensity

Flag to indicate if this device type provides density information in its supplied IMeasurementData results.

##### Declaration

    public bool ProvidesDensity { get; }

##### Property Value

Type | Description
--- | ---
bool |

#### ProvidesSpectral

Flag to indicate if this device type provides spectral information in its supplied IMeasurementData results.

##### Declaration

    public bool ProvidesSpectral { get; }

##### Property Value

Type | Description
--- | ---
bool |

#### ReferenceDate

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

##### Declaration

    public DateTime? ReferenceDate { get; }

##### Property Value

Type | Description
--- | ---
DateTime? |

#### ReferenceTemperature

Baseline temperature for this device. Corresponds to in-field normalization temperature for Spectro2 and Mini3, or factory temperature for others. Value is `null` if the device does not support this feature. The value is valid only after a connection has successfully been opened.

##### Declaration

    public float? ReferenceTemperature { get; }

##### Property Value

Type | Description
--- | ---
float? |

#### RgbFeedbackEnabled

Flag to indicate if device RGB feedback is enabled.

##### Declaration

    public bool RgbFeedbackEnabled { get; }

##### Property Value

Type | Description
--- | ---
bool |

#### Rssi

Signal strength for this device

##### Declaration

    public int Rssi { get; }

##### Property Value

Type | Description
--- | ---
int |

#### ScanCount

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

##### Declaration

    public uint? ScanCount { get; }

##### Property Value

Type | Description
--- | ---
uint? |

#### ScanTemperature

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.

##### Declaration

    public float? ScanTemperature { get; }

##### Property Value

Type | Description
--- | ---
float? |

#### SdkId

Build ID for this `NixUniversalSDK` binary

##### Declaration

    public string SdkId { get; }

##### Property Value

Type | Description
--- | ---
string |

#### SerialNumber

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

##### Declaration

    public string SerialNumber { get; }

##### Property Value

Type | Description
--- | ---
string |

#### SoftwareVersion

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

##### Declaration

    public DeviceVersion SoftwareVersion { get; }

##### Property Value

Type | Description
--- | ---
DeviceVersion |

#### State

Current state of this device

##### Declaration

    public DeviceState State { get; }

##### Property Value

Type | Description
--- | ---
DeviceState |

#### SupportedModes

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

##### Declaration

    public IEnumerable<ScanMode> SupportedModes { get; }

##### Property Value

Type | Description
--- | ---
IEnumerable<ScanMode> |

#### SupportedReferences

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

##### Declaration

    public IEnumerable<ReferenceWhite> SupportedReferences { get; }

##### Property Value

Type | Description
--- | ---
IEnumerable<ReferenceWhite> |

#### SupportsFieldCalibration

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

##### Declaration

    public bool SupportsFieldCalibration { get; }

##### Property Value

Type | Description
--- | ---
bool |

#### SupportsHapticFeedback

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

##### Declaration

    public bool SupportsHapticFeedback { get; }

##### Property Value

Type | Description
--- | ---
bool |

#### SupportsRgbFeedback

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

##### Declaration

    public bool SupportsRgbFeedback { get; }

##### Property Value

Type | Description
--- | ---
bool |

#### SupportsTemperatureCompensation

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

##### Declaration

    public bool SupportsTemperatureCompensation { get; }

##### Property Value

Type | Description
--- | ---
bool |

#### TemperatureCompensationEnabled

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.

##### Declaration

    public bool TemperatureCompensationEnabled { get; }

##### Property Value

Type | Description
--- | ---
bool |

#### Type

Type for this device

##### Declaration

    public DeviceType Type { get; }

##### Property Value

Type | Description
--- | ---
DeviceType |

### Methods

#### CompareTo(object)

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

##### Declaration

    public int CompareTo(object other)

##### Parameters

Type | Name | Description
--- | --- | ---
object | other |

##### Returns

Type | Description
--- | ---
int |

#### ConnectAsync()

Open a connection to this Nix device. A connection in progress can be cancelled by calling Disconnect().

##### Declaration

    public Task<DeviceStatus> ConnectAsync()

##### Returns

Type | Description
--- | ---
Task<DeviceStatus> | DeviceStatus indicating success or failure of the connection operation

#### Disconnect()

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

##### Declaration

    public void Disconnect()

#### InvalidateFieldCalibrationAsync()

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

##### Declaration

    public Task<DeviceResult> InvalidateFieldCalibrationAsync()

##### Returns

Type | Description
--- | ---
Task<DeviceResult> | DeviceResult containing status code of the completed operation

#### IsTileStringValid(string)

Used to check if a decoded string from the reference tile is valid.

##### Declaration

    public bool? IsTileStringValid(string tileString)

##### Parameters

Type | Name | Description
--- | --- | ---
string | tileString | String value decoded from the reference tile QR code

##### Returns

Type | Description
--- | ---
bool? | 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.

#### LedTestAsync()

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.

##### Declaration

    public Task<DeviceResult> LedTestAsync()

##### Returns

Type | Description
--- | ---
Task<DeviceResult> | DeviceResult containing status code of the completed operation

#### MeasureAsync(params 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 ErrorNotSupported.

##### Declaration

    public Task<DeviceResult> MeasureAsync(params ScanMode[] modes)

##### Parameters

Type | Name | Description
--- | --- | ---
ScanMode[] | modes | Scan modes to select. If omitted, the device will measure for all supported modes

##### Returns

Type | Description
--- | ---
Task<DeviceResult> | DeviceResult containing the status code of the completed operation and measurement data, if applicable.

#### RunFieldCalibrationAsync(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.

##### Declaration

    public Task<DeviceResult> RunFieldCalibrationAsync(string tileString)

##### Parameters

Type | Name | Description
--- | --- | ---
string | tileString | String value decoded from the reference tile QR code

##### Returns

Type | Description
--- | ---
Task<DeviceResult> | DeviceResult containing the status code of the completed operation and measurement data, if applicable.

#### SetFieldCalibrationEnabledAsync(bool)

Set the value for FieldCalibrationEnabled.

##### Declaration

    public Task<DeviceResult> SetFieldCalibrationEnabledAsync(bool enabled)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | enabled | New state for this option

##### Returns

Type | Description
--- | ---
Task<DeviceResult> | DeviceResult containing status code of the completed operation

#### SetHapticFeedbackEnabledAsync(bool)

Set the value for HapticFeedbackEnabled.

##### Declaration

    public Task<DeviceResult> SetHapticFeedbackEnabledAsync(bool enabled)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | enabled | New state for this option

##### Returns

Type | Description
--- | ---
Task<DeviceResult> | DeviceResult containing status code of the completed operation

#### SetRgbFeedbackEnabledAsync(bool)

Set the value for RgbFeedbackEnabled.

##### Declaration

    public Task<DeviceResult> SetRgbFeedbackEnabledAsync(bool enabled)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | enabled | New state for this option

##### Returns

Type | Description
--- | ---
Task<DeviceResult> | DeviceResult containing status code of the completed operation

#### SetTemperatureCompensationEnabledAsync(bool)

Set the value for TemperatureCompensationEnabled.

##### Declaration

    public Task<DeviceResult> SetTemperatureCompensationEnabledAsync(bool enabled)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | enabled | New state for this option

##### Returns

Type | Description
--- | ---
Task<DeviceResult> | DeviceResult containing status code of the completed operation

### Events

#### BatteryStateChanged

Called when the Nix device has updated its battery level measurement

##### Declaration

    public event EventHandler<BatteryStateEventArgs> BatteryStateChanged

##### Event Type

Type | Description
--- | ---
EventHandler<BatteryStateEventArgs> |

#### Connected

Called when the Nix device has completed the connection process and is now idle

##### Declaration

    public event EventHandler Connected

##### Event Type

Type | Description
--- | ---
EventHandler |

#### Disconnected

Called when the Nix device has disconnected from the host

##### Declaration

    public event EventHandler<DeviceStatusArgs> Disconnected

##### Event Type

Type | Description
--- | ---
EventHandler<DeviceStatusArgs> |

#### ExtPowerStateChanged

Called when the Nix device has been connected or disconnected from an external power source.

##### Declaration

    public event EventHandler<ExtPowerStateEventArgs> ExtPowerStateChanged

##### Event Type

Type | Description
--- | ---
EventHandler<ExtPowerStateEventArgs> |

### Implements

IDeviceCompat
IDeviceCompatEvents
IComparable

### Extension Methods

IDeviceCompatExtensions.HasOptions(IDeviceCompat)
IDeviceCompatExtensions.IsFeatureSupported(IDeviceCompat, LicenseFeature)
IDeviceCompatExtensions.IsModeSupported(IDeviceCompat, ScanMode)
IDeviceCompatExtensions.ProvidesColor(IDeviceCompat, Illuminant, Observer)
IDeviceCompatExtensions.ProvidesColor(IDeviceCompat, ReferenceWhite)