Commit 4dc375a0 authored by Andy Kling's avatar Andy Kling Committed by Lubomir Rintel

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]
parent ed4dd32c
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment