Manages the network configurations provided by the system. More...
Import Statement: | import ArcGIS.AppFramework 1.0 |
Inherits: |
Properties
- addresses : object
- defaultConfiguration : object
- interfaces : object
- isOnline : bool
- proxy : NetworkProxy
Signals
- configurationAdded(object configuration)
- configurationChanged(object configuration)
- configurationRemoved(object configuration)
- onlineStateChanged(bool online)
- updateCompleted()
Methods
- object getConfigurations()
- object getConfigurations(int filter)
- updateConfigurations()
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.
Name | Value |
---|---|
Network.ConfigurationTypeInternetAccessPoint | 0 |
Network.ConfigurationTypeServiceNetwork | 1 |
Network.ConfigurationTypeUserChoice | 2 |
Network.ConfigurationTypeInvalid | 3 |
ConfigurationPurpose enumeration
This enum specifies the purpose of the network configuration.
Name | Value |
---|---|
Network.ConfigurationPurposeUnknown | 0 |
Network.ConfigurationPurposePublic | 1 |
Network.ConfigurationPurposePrivate | 2 |
Network.ConfigurationPurposeServiceSpecific | 3 |
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.
Name | Value |
---|---|
Network.ConfigurationStateUndefined | 1 |
Network.ConfigurationStateDefined | 2 |
Network.ConfigurationStateDiscovered | 6 |
Network.ConfigurationStateActive | 14 |
BearerType enumeration
This enum specifies the type of bearer used by a configuration.
Name | Value |
---|---|
Network.BearerUnknown | 0 |
Network.BearerEthernet | 1 |
Network.BearerWLAN | 2 |
Network.Bearer2G | 3 |
Network.BearerCDMA2000 | 4 |
Network.BearerWCDMA | 5 |
Network.BearerHSPA | 6 |
Network.BearerBluetooth | 7 |
Network.BearerWiMAX | 8 |
Network.BearerEVDO | 9 |
Network.BearerLTE | 10 |
Network.Bearer3G | 11 |
Network.Bearer4G | 12 |
NetworkLayerProtocol enumeration
This enum describes the preferred internet protocol (IP) to use for networking.
Name | Value |
---|---|
Network.ProtocolUnknown | -1 |
Network.ProtocolIPv4 | 0 |
Network.ProtocolIPv6 | 1 |
Network.ProtocolAny | 2 |
Property Documentation
Returns an object containing a list of all IP addresses found on the device.
Returns the default configuration to be used. This function always returns either a discovered or invalid configuration.
Returns an object containing all network interfaces found on the device, described by details such as hardware address and human-readable name.
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
Signal emitted when a new network configuration has been added.
Note: The corresponding handler is onConfigurationAdded
.
Signal emitted when a preexisting network configuration has been changed.
Note: The corresponding handler is onConfigurationChanged
.
Signal emitted when a network configuration has been removed.
Note: The corresponding handler is onConfigurationRemoved
.
This signal is emitted when the device changes from online to offline mode or vice versa.
Note: The corresponding handler is onOnlineStateChanged
.
Signal emitted when the updateConfigurations function has completed.
Note: The corresponding handler is onUpdateCompleted
.
Method Documentation
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.
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.