|
@ -13,7 +13,6 @@ extern "C" { |
|
|
#include "utils.h" |
|
|
#include "utils.h" |
|
|
#include <iostream> |
|
|
#include <iostream> |
|
|
#include <QStringList> |
|
|
#include <QStringList> |
|
|
#include <QRegularExpression> |
|
|
|
|
|
|
|
|
|
|
|
#define BIT(x) (1ULL<<(x)) |
|
|
#define BIT(x) (1ULL<<(x)) |
|
|
|
|
|
|
|
@ -95,6 +94,8 @@ struct nl_interfaceCallback { |
|
|
\brief The Wireless class is used to manage 802.11 wireless information associated with an interface. Currently this class makes the assumption that it will only be used within the United States FCC regulatory domain. Only drivers supporting the Linux kernel nl80211 interface are supported. |
|
|
\brief The Wireless class is used to manage 802.11 wireless information associated with an interface. Currently this class makes the assumption that it will only be used within the United States FCC regulatory domain. Only drivers supporting the Linux kernel nl80211 interface are supported. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
static QRegularExpression s_noDigitRegex("[^\\d]"); |
|
|
|
|
|
|
|
|
/*!
|
|
|
/*!
|
|
|
Constructs a Wireless object. All operations will be limited to the specified \a interface. |
|
|
Constructs a Wireless object. All operations will be limited to the specified \a interface. |
|
|
*/ |
|
|
*/ |
|
@ -103,7 +104,6 @@ QObject(0), |
|
|
m_interface(interface), |
|
|
m_interface(interface), |
|
|
m_interfaceType(), |
|
|
m_interfaceType(), |
|
|
m_bands(), |
|
|
m_bands(), |
|
|
m_noDigitRegex("[^\\d]"), |
|
|
|
|
|
m_isValid(false), |
|
|
m_isValid(false), |
|
|
m_isNL80211(false), |
|
|
m_isNL80211(false), |
|
|
m_iftype(NL80211_IFTYPE_UNSPECIFIED) |
|
|
m_iftype(NL80211_IFTYPE_UNSPECIFIED) |
|
@ -406,7 +406,7 @@ int Wireless::ChanToFreq(int channel) { |
|
|
*/ |
|
|
*/ |
|
|
QString Wireless::ChanToFreq(QString channel, QString outputFormat) { |
|
|
QString Wireless::ChanToFreq(QString channel, QString outputFormat) { |
|
|
QString freq; |
|
|
QString freq; |
|
|
channel = channel.replace(m_noDigitRegex, ""); |
|
|
channel = channel.replace(s_noDigitRegex, ""); |
|
|
|
|
|
|
|
|
if(outputFormat.isEmpty()) { |
|
|
if(outputFormat.isEmpty()) { |
|
|
bool ok = false; |
|
|
bool ok = false; |
|
@ -442,7 +442,7 @@ int Wireless::FreqToChan(int frequency) { |
|
|
*/ |
|
|
*/ |
|
|
QString Wireless::FreqToChan(QString frequency, QString outputFormat) { |
|
|
QString Wireless::FreqToChan(QString frequency, QString outputFormat) { |
|
|
QString chan; |
|
|
QString chan; |
|
|
frequency = frequency.replace(m_noDigitRegex, ""); |
|
|
frequency = frequency.replace(s_noDigitRegex, ""); |
|
|
|
|
|
|
|
|
if(frequency.length() < 4) { |
|
|
if(frequency.length() < 4) { |
|
|
for(int i = frequency.length() + 1; i <= 4; ++i) { |
|
|
for(int i = frequency.length() + 1; i <= 4; ++i) { |
|
|