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.

Methods

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

Read the given UCI option value of this wireless network.

Parameters:
Name Type Description
opt string

The UCI option name to read.

Source:
Returns:

Returns the UCI option value or null if the requested option is not found.

Type
null | string | Array.<string>

getActiveBSSID() → {string}

Query the current BSSID from runtime information.

Source:
Returns:

Returns the current BSSID or Mesh ID as reported by ubus runtime information.

Type
string

getActiveEncryption() → {string}

Query the current encryption settings from runtime information.

Source:
Returns:

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

Type
string

getActiveMode() → {string}

Query the current operation mode from runtime information.

Source:
Returns:

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
Type
string

getActiveModeI18n() → {string}

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

Source:
Returns:

Returns the translated, human readable mode name as reported by ubus runtime state.

Type
string

getActiveSSID() → {string}

Query the current SSID from runtime information.

Source:
Returns:

Returns the current SSID or Mesh ID as reported by ubus runtime information.

Type
string

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

Fetch the list of associated peers.

Source:
Returns:

Returns a promise resolving to an array of wireless peers associated with this network.

Type
Promise.<Array.<LuCI.Network.WifiPeerEntry>>

getBitRate() → {null|number}

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

Source:
Returns:

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.

Type
null | number

getBSSID() → {null|string}

Get the configured BSSID of the wireless network.

Source:
Returns:

Returns the BSSID value or null if none has been specified.

Type
null | string

getChannel() → {null|number}

Query the current wireless channel.

Source:
Returns:

Returns the wireless channel as reported by ubus runtime information or null if it cannot be determined.

Type
null | number

getCountryCode() → {string}

Query the current country code.

Source:
Returns:

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

Type
string

getDevice() → {LuCI.Network.Device}

Get the associated Linux network device.

Source:
Returns:

Returns a Network.Device instance representing the Linux network device associted with this wireless network.

Type
LuCI.Network.Device

getFrequency() → {null|string}

Query the current operating frequency of the wireless network.

Source:
Returns:

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

Type
null | string

getI18n() → {string}

Get a description string for this wireless network.

Source:
Returns:

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.

Type
string

getID() → {string}

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.

Source:
Returns:

Returns the LuCI specific network ID.

Type
string

getIfname() → {null|string}

Get the Linux network device name.

Source:
Returns:

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.

Type
null | string

getMeshID() → {null|string}

Get the configured Mesh ID of the wireless network.

Source:
Returns:

Returns the configured mesh ID value or null when this network is not in mesh mode.

Type
null | string

getMode() → {string}

Get the configured operation mode of the wireless network.

Source:
Returns:

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
Type
string

getName() → {string}

Get the configuration ID of this wireless network.

Source:
Returns:

Returns the corresponding UCI section ID of the network.

Type
string

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

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

Source:
Returns:

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

Type
null | LuCI.Network.Protocol

getNetworkNames() → {Array.<string>}

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

Source:
Returns:

Returns an array of logical interface names.

Type
Array.<string>

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

Get the logical interfaces this wireless network is attached to.

Source:
Returns:

Returns an array of Network.Protocol instances representing the logical interfaces this wireless network is attached to.

Type
Array.<LuCI.Network.Protocol>

getNoise() → {number}

Query the current radio noise floor.

Source:
Returns:

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

Type
number

getShortName() → {string}

Get a short description string for this wireless network.

Source:
Returns:

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.

Type
string

getSignal() → {null|number}

Query the current wireless signal.

Source:
Returns:

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

Type
null | number

getSignalLevel() → {number}

Calculate the current signal.

Deprecated:
  • Yes
Source:
Returns:

Returns the calculated signal level, which is the difference between noise and signal (SNR), divided by 5.

Type
number

getSignalPercent() → {number}

Calculate the current signal quality percentage.

Source:
Returns:

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

Type
number

getSSID() → {null|string}

Get the configured SSID of the wireless network.

Source:
Returns:

Returns the configured SSID value or null when this network is in mesh mode.

Type
null | string

getTXPower() → {null|number}

Query the current radio TX power.

Source:
Returns:

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

Type
null | number

getTXPowerOffset() → {number}

Query the radio TX power offset.

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

Source:
Returns:

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.

Type
number

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

Get the corresponding wifi radio device.

Source:
Returns:

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

Type
null | LuCI.Network.WifiDevice

getWifiDeviceName() → {null|string}

Get the name of the corresponding wifi radio device.

Source:
Returns:

Returns the name of the radio device this network is configured on or null if it cannot be determined.

Type
null | string

isDisabled() → {boolean}

Checks whether this wireless network is disabled.

Source:
Returns:

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.

Type
boolean

isUp() → {boolean}

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.

Source:
Returns:

Returns true when the network is up, else false.

Type
boolean

set(opt, val)

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

Parameters:
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.

Source: