nexus: Implement wifi scanner and fix a lot of bugs
Signed-off-by: San Mehat <san@google.com>
diff --git a/nexus/WifiScanner.h b/nexus/WifiScanner.h
new file mode 100644
index 0000000..9ba1309
--- /dev/null
+++ b/nexus/WifiScanner.h
@@ -0,0 +1,36 @@
+#ifndef _WIFISCANNER_H
+#define _WIFISCANNER_H
+
+#include <pthread.h>
+
+class Supplicant;
+
+class WifiScanner {
+ pthread_t mWorker;
+ pthread_mutex_t mWorkerLock;
+ bool mWorkerRunning;
+ bool mAbortRequest;
+ pthread_mutex_t mAbortRequestLock;
+
+ Supplicant *mSuppl;
+ int mPeriod;
+ bool mActive;
+
+
+public:
+ WifiScanner(Supplicant *suppl, int period);
+ virtual ~WifiScanner() {}
+
+ int getPeriod() { return mPeriod; }
+
+ int startPeriodicScan(bool active);
+ int stopPeriodicScan();
+
+private:
+ static void *threadStart(void *obj);
+ static void threadCleanup(void *obj);
+
+ void run();
+};
+
+#endif