void WirelessFrame::setInterfaceInfo()
{
    QString cur_iface = ui->interfaceComboBox->currentText();
    int cur_chan_idx = ui->channelComboBox->currentIndex();
    int cur_type_idx = ui->channelTypeComboBox->currentIndex();
    int cur_fcs_idx = ui->fcsComboBox->currentIndex();

    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 chan_type = ui->channelTypeComboBox->itemData(cur_type_idx).toInt();
    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;

    ret = sync_interface_set_80211_chan(cur_iface.toUtf8().constData(), frequency.toUtf8().constData(), chan_type_s,
                                        &data, &primary_msg, &secondary_msg, main_window_update);

    g_free(data);
    g_free(primary_msg);
    g_free(secondary_msg);

    /* Parse the error msg */
    if (ret) {
        QString err_str = tr("Unable to set channel or offset.");
        emit pushAdapterStatus(err_str);
    }
#elif defined(HAVE_AIRPCAP)
    int frequency = ui->channelComboBox->itemData(cur_chan_idx).toInt();
    int chan_type = ui->channelTypeComboBox->itemData(cur_type_idx).toInt();
    if (frequency < 0 || chan_type < 0) return;

    if (ws80211_set_freq(cur_iface.toUtf8().constData(), frequency, chan_type) != 0) {
        QString err_str = tr("Unable to set channel or offset.");
        emit pushAdapterStatus(err_str);
    }
#endif

    if (cur_fcs_idx >= 0) {
        if (ws80211_set_fcs_validation(cur_iface.toUtf8().constData(), (enum ws80211_fcs_validation) cur_fcs_idx) != 0) {
            QString err_str = tr("Unable to set FCS validation behavior.");
            emit pushAdapterStatus(err_str);
        }
    }

    getInterfaceInfo();
}
void WirelessFrame::on_fcsComboBox_activated(int index)
{
    QString cur_iface = ui->interfaceComboBox->currentText();
    if (cur_iface.isEmpty()) return;

    if (ws80211_set_fcs_validation(cur_iface.toUtf8().constData(), (enum ws80211_fcs_validation) index) != 0) {
        QString err_str = tr("Unable to set FCS validation behavior.");
        emit pushAdapterStatus(err_str);
    }
    updateWidgets();
}