Class: WifiNetwork

LuCI.Network. WifiNetwork

A Network.WifiNetwork instance represents a wireless network (vif) configured on top of a radio device and provides functions for querying the runtime state of the network. Most radio devices support multiple such networks in parallel.

new LuCI.Network.WifiNetwork()

network.js, line 3280

Methods

get(opt){null|string|Array.<string>}

network.js, line 3313

Read the given UCI option value of this wireless network.

Name Type Description
opt string

The UCI option name to read.

Returns:
Type Description
null | string | Array.<string> Returns the UCI option value or null if the requested option is not found.

getActiveBSSID(){string}

network.js, line 3566

Query the current BSSID from runtime information.

Returns:
Type Description
string Returns the current BSSID or Mesh ID as reported by ubus runtime information.

getActiveEncryption(){string}

network.js, line 3577

Query the current encryption settings from runtime information.

Returns:
Type Description
string Returns a string describing the current encryption or - if the the encryption state could not be found in ubus runtime information.

getActiveMode(){string}

network.js, line 3514

Query the current operation mode from runtime information.

Returns:
Type Description
string Returns the human readable mode name as reported by ubus runtime state. Possible returned values are:
  • Master
  • Ad-Hoc
  • Client
  • Monitor
  • Master (VLAN)
  • WDS
  • Mesh Point
  • P2P Client
  • P2P Go
  • Unknown

getActiveModeI18n(){string}

network.js, line 3535

Query the current operation mode from runtime information as translated string.

Returns:
Type Description
string Returns the translated, human readable mode name as reported by ubus runtime state.

getActiveSSID(){string}

network.js, line 3555

Query the current SSID from runtime information.

Returns:
Type Description
string Returns the current SSID or Mesh ID as reported by ubus runtime information.

getAssocList(){Promise.<Array.<LuCI.Network.WifiPeerEntry>>}

network.js, line 3757

Fetch the list of associated peers.

Returns:
Type Description
Promise.<Array.<LuCI.Network.WifiPeerEntry>> Returns a promise resolving to an array of wireless peers associated with this network.

getBitRate(){null|number}

network.js, line 3787

Query the current average bitrate of all peers associated to this wireless network.

Returns:
Type Description
null | number Returns the average bit rate among all peers associated to the network as reported by ubus runtime information or null if the information is not available.

getBSSID(){null|string}

network.js, line 3392

Get the configured BSSID of the wireless network.

Returns:
Type Description
null | string Returns the BSSID value or null if none has been specified.

getChannel(){null|number}

network.js, line 3803

Query the current wireless channel.

Returns:
Type Description
null | number Returns the wireless channel as reported by ubus runtime information or null if it cannot be determined.

getCountryCode(){string}

network.js, line 3836

Query the current country code.

Returns:
Type Description
string Returns the wireless country code as reported by ubus runtime information or 00 if it cannot be determined.

getDevice(){LuCI.Network.Device}

network.js, line 3982

Get the associated Linux network device.

Returns:
Type Description
LuCI.Network.Device Returns a Network.Device instance representing the Linux network device associted with this wireless network.

getFrequency(){null|string}

network.js, line 3769

Query the current operating frequency of the wireless network.

Returns:
Type Description
null | string Returns the current operating frequency of the network from ubus runtime information in GHz or null if the information is not available.

getI18n(){string}

network.js, line 3930

Get a description string for this wireless network.

Returns:
Type Description
string Returns a string describing this network, consisting of the term Wireless Network, followed by the active operation mode, the SSID, BSSID or internal network ID and the Linux network device name, depending on which information is available.

getID(){string}

network.js, line 3417

Get the internal network ID of this wireless network.

The network ID is a LuCI specific identifer in the form radio#.network# to identify wireless networks by their corresponding radio and network index numbers.

Returns:
Type Description
string Returns the LuCI specific network ID.

getIfname(){null|string}

network.js, line 3439

Get the Linux network device name.

Returns:
Type Description
null | string Returns the current Linux network device name as resolved from ubus runtime information or null if this network has no associated network device, e.g. when not configured or up.

getMeshID(){null|string}

network.js, line 3379

Get the configured Mesh ID of the wireless network.

Returns:
Type Description
null | string Returns the configured mesh ID value or null when this network is not in mesh mode.

getMode(){string}

network.js, line 3354

Get the configured operation mode of the wireless network.

Returns:
Type Description
string Returns the configured operation mode. Possible values are:
  • ap - Master (Access Point) mode
  • sta - Station (client) mode
  • adhoc - Ad-Hoc (IBSS) mode
  • mesh - Mesh (IEEE 802.11s) mode
  • monitor - Monitor mode

getName(){string}

network.js, line 3427

Get the configuration ID of this wireless network.

Returns:
Type Description
string Returns the corresponding UCI section ID of the network.

getNetwork(){null|LuCI.Network.Protocol}

network.js, line 3946

Get the primary logical interface this wireless network is attached to.

Returns:
Type Description
null | LuCI.Network.Protocol Returns a Network.Protocol instance representing the logical interface or null if this network is not attached to any logical interface.

getNetworkNames(){Array.<string>}

network.js, line 3403

Get the names of the logical interfaces this wireless network is attached to.

Returns:
Type Description
Array.<string> Returns an array of logical interface names.

getNetworks(){Array.<LuCI.Network.Protocol>}

network.js, line 3957

Get the logical interfaces this wireless network is attached to.

Returns:
Type Description
Array.<LuCI.Network.Protocol> Returns an array of Network.Protocol instances representing the logical interfaces this wireless network is attached to.

getNoise(){number}

network.js, line 3825

Query the current radio noise floor.

Returns:
Type Description
number Returns the radio noise floor in dBm as reported by ubus runtime information or 0 if it cannot be determined.

getShortName(){string}

network.js, line 3915

Get a short description string for this wireless network.

Returns:
Type Description
string Returns a string describing this network, consisting of the active operation mode, followed by either the SSID, BSSID or internal network ID, depending on which information is available.

getSignal(){null|number}

network.js, line 3814

Query the current wireless signal.

Returns:
Type Description
null | number Returns the wireless signal in dBm as reported by ubus runtime information or null if it cannot be determined.

getSignalLevel(){number}

network.js, line 3874

Calculate the current signal.

Deprecated
  • Yes
Returns:
Type Description
number Returns the calculated signal level, which is the difference between noise and signal (SNR), divided by 5.

getSignalPercent(){number}

network.js, line 3897

Calculate the current signal quality percentage.

Returns:
Type Description
number Returns the calculated signal quality in percent. The value is calculated from the quality and quality_max indicators reported by ubus runtime state.

getSSID(){null|string}

network.js, line 3365

Get the configured SSID of the wireless network.

Returns:
Type Description
null | string Returns the configured SSID value or null when this network is in mesh mode.

getTXPower(){null|number}

network.js, line 3847

Query the current radio TX power.

Returns:
Type Description
null | number Returns the wireless network transmit power in dBm as reported by ubus runtime information or null if it cannot be determined.

getTXPowerOffset(){number}

network.js, line 3862

Query the radio TX power offset.

Some wireless radios have a fixed power offset, e.g. due to the use of external amplifiers.

Returns:
Type Description
number Returns the wireless network transmit power offset in dBm as reported by ubus runtime information or 0 if there is no offset, or if it cannot be determined.

getWifiDevice(){null|LuCI.Network.WifiDevice}

network.js, line 3467

Get the corresponding wifi radio device.

Returns:
Type Description
null | LuCI.Network.WifiDevice Returns a Network.WifiDevice instance representing the corresponding wifi radio device or null if the related radio device could not be found.

getWifiDeviceName(){null|string}

network.js, line 3455

Get the name of the corresponding wifi radio device.

Returns:
Type Description
null | string Returns the name of the radio device this network is configured on or null if it cannot be determined.

isDisabled(){boolean}

network.js, line 3339

Checks whether this wireless network is disabled.

Returns:
Type Description
boolean Returns true when the wireless radio is marked as disabled in ubus runtime state or when the disabled option is set in the corresponding UCI configuration.

isUp(){boolean}

network.js, line 3488

Check whether the radio network is up.

This function actually queries the up state of the related radio device and assumes this network to be up as well when the parent radio is up. This is due to the fact that OpenWrt does not control virtual interfaces individually but within one common hostapd instance.

Returns:
Type Description
boolean Returns true when the network is up, else false.

set(opt, val)

network.js, line 3327

Set the given UCI option of this network to the given value.

Name Type Description
opt string

The name of the UCI option to set.

val null | string | Array.<string>

The value to set or null to remove the given option from the configuration.