ONC

Agent.Network. ONC

Methods

createNetwork(shared, properties) → {Promise}

Creates a new network configuration from properties. If a matching configured network already exists, this will fail. Otherwise resolves to the GUID of the new Agent.network.

Parameters:
Name Type Description
shared Boolean

[false] Always false.

properties Object

The properties to configure the new network with.

See:

disableNetworkType(type) → {Promise}

Disables any devices matching the specified network type.

Parameters:
Name Type Description
type String

The type of network to disable.

See:

enableNetworkType(type) → {Promise}

Enables any devices matching the specified network type. Note, the type might represent multiple network types (e.g. 'Wireless').

Parameters:
Name Type Description
type String

The type of network to enable.

See:

forgetNetwork(guid) → {Promise}

Forgets a network configuration by clearing any configured properties for the network with GUID networkGuid. This may also include any other networks with matching identifiers (e.g. WiFi SSID and Security). If no such configuration exists, an error will be set and the operation will fail.
Note: Cannot Delete a Shared Network (Created outside of Kiosk Mode on ChromeOS)

Parameters:
Name Type Description
guid String

The GUID of the network to forget.

See:

getCaptivePortalStatus(networkGuid) → {Promise}

Get the captive portal status for the network with the given GUID

Parameters:
Name Type Description
networkGuid String

The GUID of the network to get captive portal status for.

See:

getDeviceStates()

Returns states of available networking devices.

See:

getGlobalPolicy() → {Promise}

Gets the global policy properties. These properties are not expected to change during a session.

See:

getManagedProperties(guid) → {Promise}

Gets the merged properties of the network with id networkGuid from the sources: User settings, shared settings, user policy, device policy and the currently active settings.

Parameters:
Name Type Description
guid String

The GUID of the network

See:

getNetworks(filter) → {Promise}

Returns a list of network objects with the same properties provided by getState. A filter is provided to specify the type of networks returned and to limit the number of networks. Networks are ordered by the system based on their priority, with connected or connecting networks listed first.

Parameters:
Name Type Description
filter Object

Describes which networks to return.

Properties
Name Type Description
networkType String

The type of networks to return.

visible Boolean

[false] If true, only include visible (physically connected or in-range) networks.

configured Boolean

[false] If true, only include configured (saved) networks.

limit Boolean

[1000] Maximum number of networks to return. Defaults to 1000 if unspecified. Use 0 for no limit.

See:

getProperties(guid) → {Promise}

Gets all the properties of the network with id networkGuid. Includes all properties of the network (read-only and read/write values).

Parameters:
Name Type Description
guid String

The GUID of the network

See:

getState(guid) → {Promise}

Gets the cached read-only properties of the network with id networkGuid. This is meant to be a higher performance function than getProperties, which requires a round trip to query the networking subsystem. The following properties are returned for all networks: GUID, Type, Name, WiFi.Security. Additional properties are provided for visible networks: ConnectionState, ErrorState, WiFi.SignalStrength, Cellular.NetworkTechnology, Cellular.ActivationState, Cellular.RoamingState.

Parameters:
Name Type Description
guid String

The GUID of the network to get properties for.

See:

onDeviceStateListChanged(callback)

Fired when the list of devices has changed or any device state properties have changed.

Parameters:
Name Type Description
callback function

Called when the list of device has changed.

See:
Listens to Events:
  • event:networkListChanged

onNetworkListChanged(callback)

Fired when the list of networks has changed. Sends a complete list of GUIDs for all the current networks.

Parameters:
Name Type Description
callback function

Called with a complete list of GUIDs for all the current networks.

See:
Listens to Events:
  • event:networkListChanged

onNetworksChanged(callback)

Fired when the properties change on any of the networks. Sends a list of GUIDs for networks whose properties have changed.

Parameters:
Name Type Description
callback function

Called with a list of GUIDs for networks whose properties have changed.

See:
Listens to Events:
  • event:networksChanged

onPortalDetectionCompleted(callback)

Fired when a portal detection for a network completes. Sends the GUID of the network and the corresponding captive portal status.

Parameters:
Name Type Description
callback function

Called with a GUID of the network and the corresponding captive portal status.

See:
Listens to Events:
  • event:networkListChanged

requestNetworkScan(type) → {Promise}

Requests that the networking subsystem scan for new networks and update the list returned by getVisibleNetworks. This is only a request: the network subsystem can choose to ignore it. If the list is updated, then the onNetworkListChanged event will be fired.

Parameters:
Name Type Description
type String

If provided, requests a scan specific to the type. For Cellular a mobile network scan will be requested if supported. (ChromeOS 63+)

See:

setProperties(guid) → {Promise}

Sets the properties of the network with id |networkGuid|. This is only valid for configured networks (Source != None). Unconfigured visible networks should use createNetwork instead. Calling this method on a shared network (created outside of Kiosk Mode on ChromeOS) will fail.

Parameters:
Name Type Description
guid String

The GUID of the network

See:

startConnect(networkGuid) → {Promise}

Starts a connection to the network with networkGuid.

Parameters:
Name Type Description
networkGuid String

The GUID of the network to connect to.

See:

startDisconnect(networkGuid) → {Promise}

Starts a disconnect from the network with networkGuid.

Parameters:
Name Type Description
networkGuid String

The GUID of the network to disconnect from.

See: