|
|
@ -21,6 +21,9 @@ struct nl80211_channel_block { |
|
|
|
|
|
|
|
typedef struct nl80211_channel_block nl80211_channel_block_t; |
|
|
|
|
|
|
|
// why is this necessary? I get "SupportedBands does not name a type" if I only declare the typedef in the class definition
|
|
|
|
typedef QFlags<Wireless::Bands> SupportedBands; |
|
|
|
|
|
|
|
int IEEE80211Freq[][2] = { |
|
|
|
{1, 2412}, |
|
|
|
{2, 2417}, |
|
|
@ -138,6 +141,20 @@ m_isNL80211(false) |
|
|
|
|
|
|
|
for(int i = 0; i < cblock.nfreqs; ++i) { |
|
|
|
m_channels.insert(cblock.channel_list[i], ChanToFreq(cblock.channel_list[i])); |
|
|
|
|
|
|
|
// check supported channels to see what bands we support (only makes sense for A and B)
|
|
|
|
// is there a better way to do this?
|
|
|
|
if(!((m_supportedBands & BAND_80211_A) == BAND_80211_A)) { |
|
|
|
if(cblock.channel_list[i] >= 36) { // first US 5GHz channel
|
|
|
|
m_supportedBands |= BAND_80211_A; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(!((m_supportedBands & BAND_80211_B) == BAND_80211_B)) { |
|
|
|
if(cblock.channel_list[i] >= 1) { // first 2.4GHz channel
|
|
|
|
m_supportedBands |= BAND_80211_B; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
free(cblock.channel_list); |
|
|
@ -145,11 +162,45 @@ m_isNL80211(false) |
|
|
|
m_isValid = true; |
|
|
|
} |
|
|
|
|
|
|
|
bool Wireless::isValid() { |
|
|
|
const SupportedBands Wireless::supportedBands() const { |
|
|
|
return m_supportedBands; |
|
|
|
} |
|
|
|
|
|
|
|
QList<int> Wireless::channels() const { |
|
|
|
QList<int> channels = m_channels.keys(); |
|
|
|
|
|
|
|
return channels; |
|
|
|
} |
|
|
|
|
|
|
|
QList<int> Wireless::frequencies() const { |
|
|
|
QList<int> freqs = m_channels.values(); |
|
|
|
|
|
|
|
return freqs; |
|
|
|
} |
|
|
|
|
|
|
|
bool Wireless::channelSupported(int chan) const { |
|
|
|
if(m_channels.contains(chan)) { |
|
|
|
return true; |
|
|
|
}else{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
bool Wireless::frequencySupported(int freq) const { |
|
|
|
QList<int> channels = m_channels.values(); |
|
|
|
|
|
|
|
if(channels.contains(freq)) { |
|
|
|
return true; |
|
|
|
}else{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
bool Wireless::isValid() const { |
|
|
|
return m_isValid; |
|
|
|
} |
|
|
|
|
|
|
|
bool Wireless::isNL80211() { |
|
|
|
bool Wireless::isNL80211() const { |
|
|
|
return m_isNL80211; |
|
|
|
} |
|
|
|
|
|
|
|