Network QML Type

Manages the network configurations provided by the system. More...

Import Statement: import ArcGIS.AppFramework 1.0
Inherits:

AppFrameworkObject

Properties

Signals

Methods

Detailed Description

The Network component handles available network configurations currently accessible by the device. This component has no means to access or set up these configurations, it is only capable of reading them.

This code sample demonstrates the usage of the Network component, providing a list of available network configurations, described with identifiers, bearer types, and the network state. It also provides a label describing if the device is currently online or offline.

Item {
    Component.onCompleted: {
        console.log("defaultConfiguration", JSON.stringify(AppFramework.network.defaultConfiguration, undefined, 2));
        console.log("getConfigurations", JSON.stringify(AppFramework.network.getConfigurations(), undefined, 2));
    }

    property bool updating: false
    property int filter: (filterUndefined.checked ? Network.ConfigurationStateUndefined : 0) +
                         (filterDefined.checked ? Network.ConfigurationStateDefined : 0) +
                         (filterDiscovered.checked ? Network.ConfigurationStateDiscovered : 0) +
                         (filterActive.checked ? Network.ConfigurationStateActive : 0)

    Connections {
        target: AppFramework.network

        onUpdateCompleted: {
            updating = false;
        }
    }

    ColumnLayout {
        anchors {
            fill: parent
            margins: 10
        }

        Text {
            Layout.fillWidth: true

            text: AppFramework.network.isOnline ? "Online" : "Offline"
                font {
                    pointSize: 24
                    bold: true
            }
                color: AppFramework.network.isOnline ? "darkgreen" : "red"
        }

        RowLayout {
            Layout.fillWidth: true

            Button {
                text: updating ? "Updating Configurations" : "Update Configurations"
                enabled: !updating

                onClicked: {
                    AppFramework.network.updateConfigurations();
                    updating = true;
                }
            }
        }

        ListView {
            id: configurationsView

            Layout.fillWidth: true
            Layout.fillHeight: true
            model: AppFramework.network.getConfigurations(filter, updating)
            clip: true

            delegate: Column {
                property var configuration: configurationsView.model[index]

                width: ListView.view.width
                spacing: 5

                Rectangle {
                    width: parent.width
                    height: 1
                    color: "#80000000"
                }

                Text {
                    text: "name: " + configuration.name
                    font {
                        bold: configuration.state == 14
                        pointSize: 16
                    }
                    color: font.bold ? "darkgreen" : "black"
                }

                Text {
                    text: "identifier: " + configuration.identifier
                }

                Text {
                    text: "bearerTypeName: " + configuration.bearerTypeName
                }

                Text {
                    text: "state: " + configuration.state
                }
            }
        }
    }
}

Enumerations

ConfigurationType enumeration

This enum describes the type of network configuration.

NameValue
Network.ConfigurationTypeInternetAccessPoint0
Network.ConfigurationTypeServiceNetwork1
Network.ConfigurationTypeUserChoice2
Network.ConfigurationTypeInvalid3

ConfigurationPurpose enumeration

This enum specifies the purpose of the network configuration.

NameValue
Network.ConfigurationPurposeUnknown0
Network.ConfigurationPurposePublic1
Network.ConfigurationPurposePrivate2
Network.ConfigurationPurposeServiceSpecific3

ConfigurationState enumeration

This enum describes the current state of a configuration.

An undefined configuration is used for transient configurations for which the user has not yet created a configuration. A defined configuration is known to the system, but is not immediately usable. A discovered configuration can be immediately used to create a network session. An active configuration is currently being used by an open network session.

NameValue
Network.ConfigurationStateUndefined1
Network.ConfigurationStateDefined2
Network.ConfigurationStateDiscovered6
Network.ConfigurationStateActive14

BearerType enumeration

This enum specifies the type of bearer used by a configuration.

NameValue
Network.BearerUnknown0
Network.BearerEthernet1
Network.BearerWLAN2
Network.Bearer2G3
Network.BearerCDMA20004
Network.BearerWCDMA5
Network.BearerHSPA6
Network.BearerBluetooth7
Network.BearerWiMAX8
Network.BearerEVDO9
Network.BearerLTE10
Network.Bearer3G11
Network.Bearer4G12

NetworkLayerProtocol enumeration

This enum describes the preferred internet protocol (IP) to use for networking.

NameValue
Network.ProtocolUnknown-1
Network.ProtocolIPv40
Network.ProtocolIPv61
Network.ProtocolAny2

Property Documentation

[read-only] addresses : object

Returns an object containing a list of all IP addresses found on the device.


[read-only] defaultConfiguration : object

Returns the default configuration to be used. This function always returns either a discovered or invalid configuration.


[read-only] interfaces : object

Returns an object containing all network interfaces found on the device, described by details such as hardware address and human-readable name.


[read-only] isOnline : bool

True if the system is considered to be connected to another device via an active network interface; otherwise false.

This property will be deprecated soon, and should no longer be used. Instead, use the isOnline property in the Networking component.


[read-only] proxy : NetworkProxy

Returns the active NetworkProxy object. If one does not exist, one will be created.


Signal Documentation

configurationAdded(object configuration)

Signal emitted when a new network configuration has been added.

Note: The corresponding handler is onConfigurationAdded.


configurationChanged(object configuration)

Signal emitted when a preexisting network configuration has been changed.

Note: The corresponding handler is onConfigurationChanged.


configurationRemoved(object configuration)

Signal emitted when a network configuration has been removed.

Note: The corresponding handler is onConfigurationRemoved.


onlineStateChanged(bool online)

This signal is emitted when the device changes from online to offline mode or vice versa.

Note: The corresponding handler is onOnlineStateChanged.


updateCompleted()

Signal emitted when the updateConfigurations function has completed.

Note: The corresponding handler is onUpdateCompleted.


Method Documentation

object getConfigurations()

Returns a list of all currently known network configurations.


object getConfigurations(int filter)

Returns a list of all currently known network configurations, filtered by the defined state.

The filter parameter

The state flag you want to receive results for.


updateConfigurations()

Initiates an update of all configurations. This may be used to initiate WLAN scans or other time-consuming updates which may be required to obtain the correct state for configurations.


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