This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a std::promise object | |
std::promise<void> exitSignal; | |
//Fetch std::future object associated with promise | |
std::future<void> futureObj = exitSignal.get_future(); | |
// Starting Thread & move the future object in lambda function by reference | |
std::thread th(&wifiScannerThread, std::move(futureObj), wifiIfName, wifiAPCollection); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QApplication app(argc, argv); | |
ShapedDashboard dashBoard; | |
dashBoard.setWifiAPCollection(wifiAPCollection); | |
dashBoard.show(); | |
int app_exec_code = app.exec(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Set the value in promise | |
exitSignal.set_value(); | |
//Wait for thread to join | |
th.join(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(int argc, char *argv[]) { | |
// read config file | |
std::ifstream confFile; | |
std::string wifiIfName; | |
confFile.open("./MeerkatWifiScanner.conf"); | |
if (!confFile) { | |
std::cerr << "Unable to open file MeerkatWifiScanner.conf"; | |
return -1; | |
} | |
confFile >> wifiIfName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void wifiScannerThread(std::future<void> futureObj, std::string WifiIfName, WifiAPCollection *wifiAPCollection) { | |
int maxNumberOfAPs = 6; // maximal number of APs scanned | |
int refreshTimeInMillis = 3000; // scan frequency | |
while (futureObj.wait_for(std::chrono::milliseconds(1)) == std::future_status::timeout) { | |
std::this_thread::sleep_for(std::chrono::milliseconds(refreshTimeInMillis)); | |
int status, i; | |
struct bss_info bss[maxNumberOfAPs]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
#include "wifiapcollection.h" | |
#include "wifiap.h" | |
WifiAPCollection::WifiAPCollection() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QtWidgets> | |
#include <iostream> | |
#include <cmath> | |
#include "shapeddashboard.h" | |
#include "wifiapcollection.h" | |
int dots = 0; | |
# define MATH_PI 3.14159265358979323846 /* pi */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include "wifiap.h" | |
WifiAP::WifiAP(std::string name, int rssi) { | |
this->name = name; | |
this->rssi = rssi; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Observable } = require('rxjs'); | |
// Create an Observable | |
var observable = Observable.create((observer) => { | |
observer.next('Hello World!'); | |
observer.next('Hello Again!'); | |
observer.complete(); | |
observer.next('Bye'); // this will not be shown | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Observable } = require('rxjs'); | |
// Create an Observable | |
var observable = Observable.create((observer) => { | |
observer.next('Hello World!'); | |
observer.next('Hello Again!'); | |
observer.complete(); | |
observer.next('Bye'); // this will not be shown | |
}); |
OlderNewer