scanresults.ui.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 ** ui.h extension file, included from the uic-generated form implementation.
00003 **
00004 ** If you want to add, delete, or rename functions or slots, use
00005 ** Qt Designer to update this file, preserving your code.
00006 **
00007 ** You should not define a constructor or destructor in this file.
00008 ** Instead, write your code in functions called init() and destroy().
00009 ** These will automatically be called by the form's constructor and
00010 ** destructor.
00011 *****************************************************************************/
00012 
00013 void ScanResults::init()
00014 {
00015     wpagui = NULL;
00016 }
00017 
00018 
00019 void ScanResults::destroy()
00020 {
00021     delete timer;
00022 }
00023 
00024 
00025 void ScanResults::setWpaGui(WpaGui *_wpagui)
00026 {
00027     wpagui = _wpagui;
00028     updateResults();
00029     
00030     timer = new QTimer(this);
00031     connect(timer, SIGNAL(timeout()), SLOT(getResults()));
00032     timer->start(10000, FALSE);
00033 }
00034 
00035 
00036 void ScanResults::updateResults()
00037 {
00038     char reply[8192];
00039     size_t reply_len;
00040     
00041     if (wpagui == NULL)
00042         return;
00043 
00044     reply_len = sizeof(reply) - 1;
00045     if (wpagui->ctrlRequest("SCAN_RESULTS", reply, &reply_len) < 0)
00046         return;
00047     reply[reply_len] = '\0';
00048 
00049     scanResultsView->clear();
00050     
00051     QString res(reply);
00052     QStringList lines = QStringList::split(QChar('\n'), res);
00053     bool first = true;
00054     for (QStringList::Iterator it = lines.begin(); it != lines.end(); it++) {
00055         if (first) {
00056             first = false;
00057             continue;
00058         }
00059         
00060         QStringList cols = QStringList::split(QChar('\t'), *it, true);
00061         QString ssid, bssid, freq, signal, flags;
00062         bssid = cols.count() > 0 ? cols[0] : "";
00063         freq = cols.count() > 1 ? cols[1] : "";
00064         signal = cols.count() > 2 ? cols[2] : "";
00065         flags = cols.count() > 3 ? cols[3] : "";
00066         ssid = cols.count() > 4 ? cols[4] : "";
00067         new Q3ListViewItem(scanResultsView, ssid, bssid, freq, signal, flags);
00068     }
00069 }
00070 
00071 
00072 void ScanResults::scanRequest()
00073 {
00074     char reply[10];
00075     size_t reply_len = sizeof(reply);
00076     
00077     if (wpagui == NULL)
00078         return;
00079     
00080     wpagui->ctrlRequest("SCAN", reply, &reply_len);
00081 }
00082 
00083 
00084 void ScanResults::getResults()
00085 {
00086     updateResults();
00087 }
00088 
00089 
00090 
00091 
00092 void ScanResults::bssSelected( Q3ListViewItem * sel )
00093 {
00094     NetworkConfig *nc = new NetworkConfig();
00095     if (nc == NULL)
00096         return;
00097     nc->setWpaGui(wpagui);
00098     nc->paramsFromScanResults(sel);
00099     nc->show();
00100     nc->exec();
00101 }


wpa_supplicant_node
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Jan 2 2014 11:25:14