ArcGIS for Developers

SerialPortDevice QML Type

Contains identifying data about a connected device. More...

Import Statement: import ArcGIS.AppFramework.Devices 1.0




Detailed Description

The SerialPortDevice component provides identifying and descriptive information about a single currently-connected serial port device. This is useful for confirming that the correct type of serial port device is being used for your app's needs.

This component inherits the properties and methods from the Device component, allowing for it to use the readData and writeData properties to send and receive data between your app and the device.

This code sample demonstrates usage of the SerialPortDevice component, displaying in a list view properties read from a device detected by DeviceDiscoveryAgent.

Item {
        property DeviceListModel deviceListModel: discoveryAgent.devices
        property SerialPortDevice currentDevice

        ColumnLayout {
                anchors.fill: parent
                anchors.margins: 10

                ComboBox {
                        id: comboBox
                        Layout.fillWidth: true
                        model: deviceListModel
                        textRole: "name"
                        onCurrentTextChanged: currentDevice = deviceListModel.get(currentIndex)

                ListView {
                        id: listView
                        property var fields: [
                        Layout.fillWidth: true
                        Layout.fillHeight: true
                        model: currentDevice != null ? fields : 0
                        delegate: Text { text: "%1: %2".arg(modelData).arg(currentDevice[modelData]) }

        DeviceDiscoveryAgent {
                id: discoveryAgent

        Connections {
                target: deviceListModel
                onCountChanged: if (comboBox.currentIndex == -1 && deviceListModel.count > 0) { comboBox.currentIndex = 0; }

        Component.onCompleted: discoveryAgent.start()

Property Documentation

baudRate : int

Holds the data baud rate at which the communication device operates. This should be set before opening the serial port.

[read-only] description : string

Returns the description string of the serial port. If unavailable, returns an empty string.

[read-only] isSupported : bool

[read-only] manufacturer : string

Returns the manufacturer string of the serial port. If unavailable, returns an empty string.

[read-only] productIdentifier : ushort

Returns the 16-bit product number for the port. If unavailable, returns an empty string.

[read-only] serialNumber : string

Returns the serial number string of the serial port. If unavailable, returns an empty string.

[read-only] systemLocation : string

Returns the system location of the serial port.

[read-only] vendorIdentifier : ushort

Returns the 16-bit vendor number for the serial port. if not available, returns 0.

Signal Documentation


Signal emitted when the port information has changed.