Represents an external accessory device. More...
Import Statement: | import ArcGIS.AppFramework.Devices 1.0 |
Inherited By: | BluetoothLEDevice, SerialBluetoothDevice, and SerialPortDevice |
Properties
- address : string
- connected : bool
- deviceType : DeviceType
- error : string
- name : string
- options : object
- readData : string
- writeData : string
- writeInBinary : bool
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.
Name | Value |
---|---|
Device.DeviceTypeUnknown | -1 |
Device.DeviceTypeBluetooth | 0 |
Device.DeviceTypeSerialPort | 1 |
Device.DeviceTypeBluetoothLE | 2 |
PairingStatus enumeration
Name | Value |
---|---|
Device.PairingStatusUnknown | -1 |
Device.PairingStatusUnpaired | 0 |
Device.PairingStatusPaired | 1 |
Device.PairingStatusAuthorizedPaired | 2 |
Property Documentation
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.
Returns true if a connection has been established to this device. This can be set to false to disconnect from the device.
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.
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)); } }
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