Add 802.11ac 80MHz and 160MHz channels support to wireless toolbar
Add UI support for selecting 80MHz and 160MHz channel bandwidth to wireless toolbar. 80+80MHz was left out on purpose since will need updated UI to select the second center frequency. For 80MHz and 160MHz bandwidth the center frequency is calculated from selected control frequency. Change-Id: I2551ba396f732b3240d40dfa6ea1cf2617b799d2 Reviewed-on: https://code.wireshark.org/review/13965 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
9063aca615
commit
5da2b43703
|
@ -237,6 +237,18 @@ void WirelessFrame::getInterfaceInfo()
|
|||
ui->channelTypeComboBox->setCurrentIndex(ui->channelTypeComboBox->count() - 1);
|
||||
}
|
||||
}
|
||||
if (iface->channel_types & (1 << WS80211_CHAN_VHT80)) {
|
||||
ui->channelTypeComboBox->addItem("VHT 80", WS80211_CHAN_VHT80);
|
||||
if (iface_info.current_chan_type == WS80211_CHAN_VHT80) {
|
||||
ui->channelTypeComboBox->setCurrentIndex(ui->channelTypeComboBox->count() - 1);
|
||||
}
|
||||
}
|
||||
if (iface->channel_types & (1 << WS80211_CHAN_VHT160)) {
|
||||
ui->channelTypeComboBox->addItem("VHT 160", WS80211_CHAN_VHT160);
|
||||
if (iface_info.current_chan_type == WS80211_CHAN_VHT160) {
|
||||
ui->channelTypeComboBox->setCurrentIndex(ui->channelTypeComboBox->count() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (ws80211_has_fcs_filter()) {
|
||||
ui->fcsComboBox->setCurrentIndex(iface_info.current_fcs_validation);
|
||||
|
@ -257,16 +269,19 @@ void WirelessFrame::setInterfaceInfo()
|
|||
if (cur_iface.isEmpty() || cur_chan_idx < 0 || cur_type_idx < 0) return;
|
||||
|
||||
#if defined(HAVE_LIBNL) && defined(HAVE_NL80211)
|
||||
const QString frequency = ui->channelComboBox->itemData(cur_chan_idx).toString();
|
||||
int frequency = ui->channelComboBox->itemData(cur_chan_idx).toInt();
|
||||
int chan_type = ui->channelTypeComboBox->itemData(cur_type_idx).toInt();
|
||||
int bandwidth = getBandwidthFromChanType(chan_type);
|
||||
int center_freq = getCenterFrequency(frequency, bandwidth);
|
||||
const gchar *chan_type_s = ws80211_chan_type_to_str(chan_type);
|
||||
gchar *data, *primary_msg, *secondary_msg;
|
||||
int ret;
|
||||
|
||||
if (frequency.isEmpty() || chan_type < 0) return;
|
||||
if (frequency < 0 || chan_type < 0) return;
|
||||
|
||||
ret = sync_interface_set_80211_chan(cur_iface.toUtf8().constData(), frequency.toUtf8().constData(),
|
||||
chan_type_s, "-1", "-1",
|
||||
ret = sync_interface_set_80211_chan(cur_iface.toUtf8().constData(),
|
||||
QString::number(frequency).toUtf8().constData(), chan_type_s,
|
||||
QString::number(center_freq).toUtf8().constData(), "-1",
|
||||
&data, &primary_msg, &secondary_msg, main_window_update);
|
||||
|
||||
g_free(data);
|
||||
|
@ -299,6 +314,26 @@ void WirelessFrame::setInterfaceInfo()
|
|||
getInterfaceInfo();
|
||||
}
|
||||
|
||||
int WirelessFrame::getCenterFrequency(int control_frequency, int bandwidth)
|
||||
{
|
||||
if (bandwidth < 80 || control_frequency < 5180)
|
||||
return -1;
|
||||
|
||||
return ((control_frequency - 5180) / bandwidth) * bandwidth + 5180 + (bandwidth / 2) - 10;
|
||||
}
|
||||
|
||||
int WirelessFrame::getBandwidthFromChanType(int chan_type)
|
||||
{
|
||||
switch (chan_type) {
|
||||
case WS80211_CHAN_VHT80:
|
||||
return 80;
|
||||
case WS80211_CHAN_VHT160:
|
||||
return 160;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void WirelessFrame::on_interfaceComboBox_activated(int)
|
||||
{
|
||||
getInterfaceInfo();
|
||||
|
|
|
@ -50,6 +50,8 @@ protected:
|
|||
private:
|
||||
void getInterfaceInfo();
|
||||
void setInterfaceInfo();
|
||||
int getCenterFrequency(int control_frequency, int bandwidth);
|
||||
int getBandwidthFromChanType(int chan_type);
|
||||
|
||||
private slots:
|
||||
void updateWidgets();
|
||||
|
|
Loading…
Reference in New Issue