new LuCI.Network.WifiNetwork()
Methods
-
disconnectClient(mac, deauth, reason, ban_time){Promise.<number>}
network.js, line 4080 -
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 deauthenticate (
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 reassociate / 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>}
network.js, line 3371 -
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 3624 -
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 3635 -
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 inubus
runtime information. -
getActiveMode(){string}
network.js, line 3572 -
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 3593 -
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 3613 -
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 3815 -
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 3845 -
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 ornull
if the information is not available. -
getBSSID(){null|string}
network.js, line 3450 -
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 3861 -
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}
network.js, line 3894 -
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}
network.js, line 4040 -
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 3827 -
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}
network.js, line 3988 -
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 3475 -
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 3497 -
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}
network.js, line 3437 -
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 3412 -
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}
network.js, line 3485 -
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 4004 -
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 ornull
if this network is not attached to any logical interface. -
getNetworkNames(){Array.<string>}
network.js, line 3461 -
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 4015 -
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 3883 -
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}
network.js, line 3973 -
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 3872 -
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}
network.js, line 3932 -
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 3955 -
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}
network.js, line 3423 -
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 3905 -
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}
network.js, line 3920 -
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. -
getWifiDevice(){null|LuCI.Network.WifiDevice}
network.js, line 3525 -
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}
network.js, line 3513 -
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}
network.js, line 4051 -
Check whether this wifi network supports deauthenticating clients.
Returns:
Type Description boolean Returns true
when this wifi network instance supports forcibly deauthenticating clients, otherwisefalse
. -
isDisabled(){boolean}
network.js, line 3397 -
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}
network.js, line 3546 -
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, val)
network.js, line 3385 -
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.