Device QML Type

Represents an external accessory device. More...

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

BluetoothLEDevice, SerialBluetoothDevice, and SerialPortDevice



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.


DeviceType enumeration

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


PairingStatus enumeration


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.

[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(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(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.