new LuCI.network.WifiNetwork()
Methods
-
disconnectClient(mac, deauth, reason, ban_time){Promise.<number>}
-
Forcibly disconnect the given client from the wireless network.
Name Type Default Description mac
string The MAC address of the client to disconnect.
deauth
boolean false optional Specifies whether to de-authenticate (
true
) or disassociate (false
) the client.reason
number 1 optional Specifies the IEEE 802.11 reason code to disassoc/deauth the client with. Default is
1
which corresponds toUnspecified reason
.ban_time
number 0 optional Specifies the amount of milliseconds to ban the client from reconnecting. By default, no ban time is set which allows the client to re-associate / reauthenticate immediately.
Returns:
Type Description Promise.<number> Returns a promise resolving to the underlying ubus call result code which is typically 0
, even for not existing MAC addresses. The promise might reject with an error in case invalid arguments are passed. -
get(opt){null|string|Array.<string>}
-
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}
-
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}
-
Query the current encryption settings from runtime information.
Returns:
Type Description string Returns a string describing the current encryption or -
if the encryption state could not be found inubus
runtime information. -
getActiveMode(){string}
-
Query the current operation mode from runtime information.
Returns:
Type Description string Returns the human readable mode name as reported by iwinfo or uci mode. Possible returned values are: Master
Ad-Hoc
Client
Monitor
Master (VLAN)
WDS
Mesh Point
P2P Client
P2P Go
Unknown
-
getActiveModeI18n(){string}
-
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}
-
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>>}
-
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}
-
Query the current average bit-rate 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 ornull
if the information is not available. -
getBSSID(){null|string}
-
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}
-
Query the current wireless channel.
Returns:
Type Description null | number Returns the wireless channel as reported by ubus
runtime information ornull
if it cannot be determined. -
getCountryCode(){string}
-
Query the current country code.
Returns:
Type Description string Returns the wireless country code as reported by ubus
runtime information or00
if it cannot be determined. -
getDevice(){LuCI.network.Device}
-
Get the associated Linux network device.
Returns:
Type Description LuCI.network.Device Returns a Network.Device
instance representing the Linux network device associated with this wireless network. -
getFrequency(){null|string}
-
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 ornull
if the information is not available. -
getI18n(){string}
-
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}
-
Get the internal network ID of this wireless network.
The network ID is a LuCI specific identifier 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}
-
Get the Linux network device name.
Returns:
Type Description null | string Returns the current Linux network device name as resolved from ubus
runtime information ornull
if this network has no associated network device, e.g. when not configured or up. -
getMeshID(){null|string}
-
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}
-
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) modesta
- Station (client) modeadhoc
- Ad-Hoc (IBSS) modemesh
- Mesh (IEEE 802.11s) modemonitor
- Monitor mode
-
getName(){string}
-
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}
-
Get the primary logical interface this network is attached to.
Returns:
Type Description null | LuCI.network.Protocol Returns a Network.Protocol
instance representing the logical interface ornull
if this network is not attached to any logical interface. -
getNetworkNames(){Array.<string>}
-
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>}
-
Get the logical interfaces this 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}
-
Query the current radio noise floor.
Returns:
Type Description number Returns the radio noise floor in dBm as reported by ubus
runtime information or0
if it cannot be determined. -
getShortName(){string}
-
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}
-
Query the current wireless signal.
Returns:
Type Description null | number Returns the wireless signal in dBm as reported by ubus
runtime information ornull
if it cannot be determined. -
getSignalLevel(){number}
-
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}
-
Calculate the current signal quality percentage.
Returns:
Type Description number Returns the calculated signal quality in percent. The value is calculated from the quality
andquality_max
indicators reported byubus
runtime state. -
getSSID(){null|string}
-
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}
-
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 ornull
if it cannot be determined. -
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.
Returns:
Type Description number Returns the wireless network transmit power offset in dBm as reported by ubus
runtime information or0
if there is no offset, or if it cannot be determined. -
getVlanIfnames(){Array.<string>}
-
Get the Linux VLAN network device names.
Returns:
Type Description Array.<string> Returns the current Linux VLAN network device name as resolved from ubus
runtime information or empty array if this network has no associated VLAN network devices. -
getWifiDevice(){null|LuCI.network.WifiDevice}
-
Get the corresponding WiFi radio device.
Returns:
Type Description null | LuCI.network.WifiDevice Returns a Network.WifiDevice
instance representing the corresponding WiFi radio device ornull
if the related radio device could not be found. -
getWifiDeviceName(){null|string}
-
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. -
isClientDisconnectSupported(){boolean}
-
Check whether this WiFi network supports de-authenticating clients.
Returns:
Type Description boolean Returns true
when this WiFi network instance supports forcibly de-authenticating clients, otherwisefalse
. -
isDisabled(){boolean}
-
Checks whether this wireless network is disabled.
Returns:
Type Description boolean Returns true
when the wireless radio is marked as disabled inubus
runtime state or when thedisabled
option is set in the corresponding UCI configuration. -
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.
Returns:
Type Description boolean Returns true
when the network is up, elsefalse
. -
set(opt, value)
-
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.
value
null | string | Array.<string> The value to set or
null
to remove the given option from the configuration.