Device QML Type

Represents an external accessory device. More...

Import Statement: import ArcGIS.AppFramework.Devices 1.0
Inherited By:

BluetoothLEDevice, SerialBluetoothDevice, and SerialPortDevice

Properties

Methods

Detailed Description

The Device component holds values related to a discovered external device, such as device name, address, type, and NMEA sentences. The Device class is a singleton component, meaning it does not need to be instantiated.

For an example of this component in action, refer to the code sample for DeviceDiscoveryAgent.

Enumerations

DeviceType enumeration

Enum describing the type of device being used. Informs the deviceType property.

NameValue
Device.DeviceTypeUnknown-1
Device.DeviceTypeBluetooth0
Device.DeviceTypeSerialPort1
Device.DeviceTypeBluetoothLE2

PairingStatus enumeration

NameValue
Device.PairingStatusUnknown-1
Device.PairingStatusUnpaired0
Device.PairingStatusPaired1
Device.PairingStatusAuthorizedPaired2

Property Documentation

[read-only] address : string

Returns the device address as a string. Typically this address is the Bluetooth MAC address of the device: for example, 0C:00:0A:BB:28:FC. However on iOS and macOS a Bluetooth MAC is not available, so instead a unique device identifier is returned: for example, 3f89ecd0-bbe5-11ea-8b6e-0800200c9a66.


connected : bool

Returns true if a connection has been established to this device. This can be set to false to disconnect from the device.


[read-only] deviceType : DeviceType

Returns the type of device. Informed by the DeviceType enum.


[read-only] error : string

Returns a device-related error string.


[read-only] name : string

Returns the connected device's name as a string.


options : object

A dictionary of key value pairs that changes the way information is read from and written to the device.

By setting the readWithNoNewline to true, the device will set the readData property as soon as streams of characters are available, and will not wait for a \n newline character as it does by default.


[read-only] readData : string

Holds a line of data read from the device.

This code sample logs the read line of data from the device whenever the onReadDataChanged signal is emitted.

Connections {
    target: device

    onReadDataChanged: {
        console.log("onReadDataChanged:", JSON.stringify(device.readData));
    }
}

writeData : string

Holds a line of data to be written to the device.


writeInBinary : bool

This should be set to true if the lines of data being written to the device by the writeData property is in binary.


Method Documentation

Device fromJson(string json)

Creates and returns a new device object, using values derived from a JSON object.

The json parameter

The JSON object to extract values from.


Device fromJson(string json, object parent)

The json parameter

The parent parameter


object toJson()

Writes the values stored about a device to a JSON object.


Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.