wpa_gui: Add peers menu option for learning AP configuration (ER)

This commit is contained in:
Jouni Malinen 2009-11-21 18:26:21 +02:00
parent a34a330706
commit d914f78880
2 changed files with 35 additions and 0 deletions

View file

@ -166,6 +166,11 @@ void Peers::context_menu(const QPoint &pos)
SLOT(connect_pbc())); SLOT(connect_pbc()));
} }
if (type == PEER_TYPE_WPS_ER_AP) {
menu->addAction(tr("Learn Configuration"), this,
SLOT(learn_ap_config()));
}
menu->addAction(tr("Properties"), this, SLOT(properties())); menu->addAction(tr("Properties"), this, SLOT(properties()));
} else { } else {
ctx_item = NULL; ctx_item = NULL;
@ -797,3 +802,32 @@ void Peers::connect_pbc()
msg.exec(); msg.exec();
} }
} }
void Peers::learn_ap_config()
{
if (ctx_item == NULL)
return;
QString uuid = ctx_item->data(peer_role_uuid).toString();
StringQuery input(tr("AP PIN:"));
input.setWindowTitle(tr("AP PIN for ") + ctx_item->text());
if (input.exec() != QDialog::Accepted)
return;
char cmd[100];
char reply[100];
size_t reply_len;
snprintf(cmd, sizeof(cmd), "WPS_ER_LEARN %s %s",
uuid.toAscii().constData(),
input.get_string().toAscii().constData());
reply_len = sizeof(reply) - 1;
if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) {
QMessageBox msg;
msg.setIcon(QMessageBox::Warning);
msg.setText(tr("Failed to start learning AP configuration."));
msg.exec();
}
}

View file

@ -37,6 +37,7 @@ public slots:
virtual void context_menu(const QPoint &pos); virtual void context_menu(const QPoint &pos);
virtual void enter_pin(); virtual void enter_pin();
virtual void connect_pbc(); virtual void connect_pbc();
virtual void learn_ap_config();
virtual void ctx_refresh(); virtual void ctx_refresh();
virtual void properties(); virtual void properties();