mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-09 01:30:36 +01:00
libnm-core: add nm_utils_wifi_freq_to_band
allow to retrieve wifi band from frequency. [lkundrak@v3.sk: formatting fixes, move the prototype to a private header]
This commit is contained in:
parent
ed4dd32cb9
commit
4dc375a068
2 changed files with 21 additions and 0 deletions
|
|
@ -866,4 +866,6 @@ void _nm_bridge_vlan_str_append_rest (const NMBridgeVlan *vlan,
|
|||
|
||||
gboolean nm_utils_connection_is_adhoc_wpa (NMConnection *connection);
|
||||
|
||||
const char *nm_utils_wifi_freq_to_band (guint32 freq);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -3724,6 +3724,25 @@ nm_utils_wifi_freq_to_channel (guint32 freq)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_utils_wifi_freq_to_band:
|
||||
* @freq: frequency
|
||||
*
|
||||
* Utility function to translate a Wi-Fi frequency to its corresponding band.
|
||||
*
|
||||
* Returns: the band containing the frequency or NULL if freq is invalid
|
||||
**/
|
||||
const char *
|
||||
nm_utils_wifi_freq_to_band (guint32 freq)
|
||||
{
|
||||
if (freq >= 4915 && freq <= 5825)
|
||||
return "a";
|
||||
else if (freq >= 2412 && freq <= 2484)
|
||||
return "bg";
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_utils_wifi_channel_to_freq:
|
||||
* @channel: channel
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue