nexus: Rollup update for nexus
nexus: Change field separator from : to ' '
Signed-off-by: San Mehat <san@google.com>
nexus: Add some prototypes for stuff to come
Signed-off-by: San Mehat <san@google.com>
nexus: Add some TODOs
Signed-off-by: San Mehat <san@google.com>
libsysutils: Put a proper token parser into the FrameworkListener which
supports minimal \ escapes and quotes
Signed-off-by: San Mehat <san@google.com>
nexus: Fix a lot of bugs
Signed-off-by: San Mehat <san@google.com>
libsysutils: Remove some debugging
Signed-off-by: San Mehat <san@google.com>
nexus: Send broadcasts for supplicant state changes
Signed-off-by: San Mehat <san@google.com>
nexus: Plumb DHCP listener state changes to NetworkManager
Signed-off-by: San Mehat <san@google.com>
nexus: Make the SupplicantState strings more parsable
Signed-off-by: San Mehat <san@google.com>
nexus: Broadcast a message when dhcp state changes.
Signed-off-by: San Mehat <san@google.com>
nexus: Add a few new response codes
Signed-off-by: San Mehat <san@google.com>
nexus: Rename ErrorCode -> ResponseCode
Signed-off-by: San Mehat <san@google.com>
nexus: Add DHCP event broadcasting. Also adds the framework for
tracking supplicant 'searching-for-AP' state
Signed-off-by: San Mehat <san@google.com>
nexus: REmove WifiScanner
Signed-off-by: San Mehat <san@google.com>
nexus: Change the way scanning works. scanmode can now be selected
independantly of triggering a scan. Also adds rxfilter support
Signed-off-by: San Mehat <san@google.com>
nexus: Add support for configuring bluetooth coexistence scanning and modes
Signed-off-by: San Mehat <san@google.com>
nexus: use case insensitive match for property names
Signed-off-by: San Mehat <san@google.com>
nexus: Rollup of a bunch of stuff:
- 'list' command now takes an argument to match against
- InterfaceConfig has been moved into the Controller base (for now)
- DhcpClient now has some rudimentry locking
- process 'ADDRINFO' messages from dhcpcd
- Drop tertiary dns
Signed-off-by: San Mehat <san@google.com>
nexus: Clean up some of the supplicant variable parsing and add 'wifi.current'
Signed-off-by: San Mehat <san@google.com>
nexus: Add driver-stop/start, initial suspend support
Signed-off-by: San Mehat <san@google.com>
nexus: Add Controller suspend/resume callbacks, as well as locking
Signed-off-by: San Mehat <san@google.com>
nexus: Make ARP probing configurable for DhcpClient
Signed-off-by: San Mehat <san@google.com>
nexus: Add linkspeed / rssi retrieval
Signed-off-by: San Mehat <san@google.com>
nexus: Add WifiStatusPoller to track RSSI/linkspeed when associated
Signed-off-by: San Mehat <san@google.com>
nexus: Disable some debugging and add 'wifi.netcount' property
Signed-off-by: San Mehat <san@google.com>
nexus: Replace the hackish property system with something more flexible with namespaces
Signed-off-by: San Mehat <san@google.com>
libsysutils: Fix a few bugs in SocketListener
Signed-off-by: San Mehat <san@google.com>
nexus: PropertyManager: Add array support
Signed-off-by: San Mehat <san@google.com>
nexus: Clean up properties
Signed-off-by: San Mehat <san@google.com>
nexus: WifiController: Change name of 'CurrentNetwork' property
Signed-off-by: San Mehat <san@google.com>
diff --git a/nexus/WifiController.h b/nexus/WifiController.h
index c61d97a..b1524f6 100644
--- a/nexus/WifiController.h
+++ b/nexus/WifiController.h
@@ -23,41 +23,207 @@
#include "ScanResult.h"
#include "WifiNetwork.h"
#include "ISupplicantEventHandler.h"
+#include "IWifiStatusPollerHandler.h"
class NetInterface;
class Supplicant;
-class WifiScanner;
class SupplicantAssociatingEvent;
class SupplicantAssociatedEvent;
class SupplicantConnectedEvent;
class SupplicantScanResultsEvent;
class SupplicantStateChangeEvent;
class SupplicantDisconnectedEvent;
+class WifiStatusPoller;
-class WifiController : public Controller, public ISupplicantEventHandler {
-public:
- static const uint32_t SCAN_ENABLE_MASK = 0x01;
- static const uint32_t SCAN_ACTIVE_MASK = 0x02;
- static const uint32_t SCAN_REPEAT_MASK = 0x04;
+class WifiController : public Controller,
+ public ISupplicantEventHandler,
+ public IWifiStatusPollerHandler {
- static const uint32_t SCANMODE_NONE = 0;
- static const uint32_t SCANMODE_PASSIVE_ONESHOT = SCAN_ENABLE_MASK;
- static const uint32_t SCANMODE_PASSIVE_CONTINUOUS = SCAN_ENABLE_MASK | SCAN_REPEAT_MASK;
- static const uint32_t SCANMODE_ACTIVE_ONESHOT = SCAN_ENABLE_MASK | SCAN_ACTIVE_MASK;
- static const uint32_t SCANMODE_ACTIVE_CONTINUOUS = SCAN_ENABLE_MASK | SCAN_ACTIVE_MASK | SCAN_REPEAT_MASK;
+ class WifiIntegerProperty : public IntegerProperty {
+ protected:
+ WifiController *mWc;
+ public:
+ WifiIntegerProperty(WifiController *c, const char *name, bool ro,
+ int elements);
+ virtual ~WifiIntegerProperty() {}
+ virtual int set(int idx, int value) = 0;
+ virtual int get(int idx, int *buffer) = 0;
+ };
+ friend class WifiController::WifiIntegerProperty;
-private:
+ class WifiStringProperty : public StringProperty {
+ protected:
+ WifiController *mWc;
+ public:
+ WifiStringProperty(WifiController *c, const char *name, bool ro,
+ int elements);
+ virtual ~WifiStringProperty() {}
+ virtual int set(int idx, const char *value) = 0;
+ virtual int get(int idx, char *buffer, size_t max) = 0;
+ };
+ friend class WifiController::WifiStringProperty;
+
+ class WifiEnabledProperty : public WifiIntegerProperty {
+ public:
+ WifiEnabledProperty(WifiController *c);
+ virtual ~WifiEnabledProperty() {}
+ int set(int idx, int value);
+ int get(int idx, int *buffer);
+ };
+
+ class WifiScanOnlyProperty : public WifiIntegerProperty {
+ public:
+ WifiScanOnlyProperty(WifiController *c);
+ virtual ~WifiScanOnlyProperty() {}
+ int set(int idx, int value);
+ int get(int idx, int *buffer);
+ };
+
+ class WifiAllowedChannelsProperty : public WifiIntegerProperty {
+ public:
+ WifiAllowedChannelsProperty(WifiController *c);
+ virtual ~WifiAllowedChannelsProperty() {}
+ int set(int idx, int value);
+ int get(int idx, int *buffer);
+ };
+
+ class WifiActiveScanProperty : public WifiIntegerProperty {
+ public:
+ WifiActiveScanProperty(WifiController *c);
+ virtual ~WifiActiveScanProperty() {}
+ int set(int idx, int value);
+ int get(int idx, int *buffer);
+ };
+
+ class WifiSearchingProperty : public WifiIntegerProperty {
+ public:
+ WifiSearchingProperty(WifiController *c);
+ virtual ~WifiSearchingProperty() {}
+ int set(int idx, int value) { return -1; }
+ int get(int idx, int *buffer);
+ };
+
+ class WifiPacketFilterProperty : public WifiIntegerProperty {
+ public:
+ WifiPacketFilterProperty(WifiController *c);
+ virtual ~WifiPacketFilterProperty() {}
+ int set(int idx, int value);
+ int get(int idx, int *buffer);
+ };
+
+ class WifiBluetoothCoexScanProperty : public WifiIntegerProperty {
+ public:
+ WifiBluetoothCoexScanProperty(WifiController *c);
+ virtual ~WifiBluetoothCoexScanProperty() {}
+ int set(int idx, int value);
+ int get(int idx, int *buffer);
+ };
+
+ class WifiBluetoothCoexModeProperty : public WifiIntegerProperty {
+ public:
+ WifiBluetoothCoexModeProperty(WifiController *c);
+ virtual ~WifiBluetoothCoexModeProperty() {}
+ int set(int idx, int value);
+ int get(int idx, int *buffer);
+ };
+
+ class WifiCurrentNetworkProperty : public WifiIntegerProperty {
+ public:
+ WifiCurrentNetworkProperty(WifiController *c);
+ virtual ~WifiCurrentNetworkProperty() {}
+ int set(int idx, int value) { return -1; }
+ int get(int idx, int *buffer);
+ };
+
+ class WifiSuspendedProperty : public WifiIntegerProperty {
+ public:
+ WifiSuspendedProperty(WifiController *c);
+ virtual ~WifiSuspendedProperty() {}
+ int set(int idx, int value);
+ int get(int idx, int *buffer);
+ };
+
+ class WifiNetCountProperty : public WifiIntegerProperty {
+ public:
+ WifiNetCountProperty(WifiController *c);
+ virtual ~WifiNetCountProperty() {}
+ int set(int idx, int value) { return -1; }
+ int get(int idx, int *buffer);
+ };
+
+ class WifiTriggerScanProperty : public WifiIntegerProperty {
+ public:
+ WifiTriggerScanProperty(WifiController *c);
+ virtual ~WifiTriggerScanProperty() {}
+ int set(int idx, int value);
+ int get(int idx, int *buffer);
+ };
+
+ class WifiSupplicantStateProperty : public WifiStringProperty {
+ public:
+ WifiSupplicantStateProperty(WifiController *c);
+ virtual ~WifiSupplicantStateProperty() {}
+ int set(int idx, const char *value) { return -1; }
+ int get(int idx, char *buffer, size_t max);
+ };
+
+ class WifiInterfaceProperty : public WifiStringProperty {
+ public:
+ WifiInterfaceProperty(WifiController *c);
+ virtual ~WifiInterfaceProperty() {}
+ int set(int idx, const char *value) { return -1; }
+ int get(int idx, char *buffer, size_t max);
+ };
+
Supplicant *mSupplicant;
char mModulePath[255];
char mModuleName[64];
char mModuleArgs[255];
- uint32_t mCurrentScanMode;
- WifiScanner *mScanner;
int mSupplicantState;
+ bool mActiveScan;
+ bool mScanOnly;
+ bool mPacketFilter;
+ bool mBluetoothCoexScan;
+ int mBluetoothCoexMode;
+ int mCurrentlyConnectedNetworkId;
+ bool mSuspended;
+ int mLastRssi;
+ int mRssiEventThreshold;
+ int mLastLinkSpeed;
+ int mNumAllowedChannels;
ScanResultCollection *mLatestScanResults;
pthread_mutex_t mLatestScanResultsLock;
+ pthread_mutex_t mLock;
+ WifiStatusPoller *mStatusPoller;
+
+ struct {
+ WifiEnabledProperty *propEnabled;
+ WifiScanOnlyProperty *propScanOnly;
+ WifiAllowedChannelsProperty *propAllowedChannels;
+ IntegerPropertyHelper *propRssiEventThreshold;
+ } mStaticProperties;
+
+ struct {
+ WifiActiveScanProperty *propActiveScan;
+ WifiSearchingProperty *propSearching;
+ WifiPacketFilterProperty *propPacketFilter;
+ WifiBluetoothCoexScanProperty *propBluetoothCoexScan;
+ WifiBluetoothCoexModeProperty *propBluetoothCoexMode;
+ WifiCurrentNetworkProperty *propCurrentNetwork;
+ IntegerPropertyHelper *propRssi;
+ IntegerPropertyHelper *propLinkSpeed;
+ WifiSuspendedProperty *propSuspended;
+ WifiNetCountProperty *propNetCount;
+ WifiSupplicantStateProperty *propSupplicantState;
+ WifiInterfaceProperty *propInterface;
+ WifiTriggerScanProperty *propTriggerScan;
+ } mDynamicProperties;
+
+ // True if supplicant is currently searching for a network
+ bool mIsSupplicantSearching;
+ int mNumScanResultsSinceLastStateChange;
bool mEnabled;
@@ -72,9 +238,6 @@
int removeNetwork(int networkId);
WifiNetworkCollection *createNetworkList();
- virtual int set(const char *name, const char *value);
- virtual const char *get(const char *name, char *buffer, size_t maxlen);
-
ScanResultCollection *createScanResults();
char *getModulePath() { return mModulePath; }
@@ -94,18 +257,25 @@
private:
void sendStatusBroadcast(const char *msg);
- int setScanMode(uint32_t mode);
+ int setActiveScan(bool active);
+ int triggerScan();
int enable();
int disable();
+ int setSuspend(bool suspend);
+ bool getSuspended();
+ int setBluetoothCoexistenceScan(bool enable);
+ int setBluetoothCoexistenceMode(int mode);
+ int setPacketFilter(bool enable);
+ int setScanOnly(bool scanOnly);
// ISupplicantEventHandler methods
- virtual void onAssociatingEvent(SupplicantAssociatingEvent *evt);
- virtual void onAssociatedEvent(SupplicantAssociatedEvent *evt);
- virtual void onConnectedEvent(SupplicantConnectedEvent *evt);
- virtual void onScanResultsEvent(SupplicantScanResultsEvent *evt);
- virtual void onStateChangeEvent(SupplicantStateChangeEvent *evt);
- virtual void onConnectionTimeoutEvent(SupplicantConnectionTimeoutEvent *evt);
- virtual void onDisconnectedEvent(SupplicantDisconnectedEvent *evt);
+ void onAssociatingEvent(SupplicantAssociatingEvent *evt);
+ void onAssociatedEvent(SupplicantAssociatedEvent *evt);
+ void onConnectedEvent(SupplicantConnectedEvent *evt);
+ void onScanResultsEvent(SupplicantScanResultsEvent *evt);
+ void onStateChangeEvent(SupplicantStateChangeEvent *evt);
+ void onConnectionTimeoutEvent(SupplicantConnectionTimeoutEvent *evt);
+ void onDisconnectedEvent(SupplicantDisconnectedEvent *evt);
#if 0
virtual void onTerminatingEvent(SupplicantEvent *evt);
virtual void onPasswordChangedEvent(SupplicantEvent *evt);
@@ -118,6 +288,9 @@
virtual void onDriverStateEvent(SupplicantEvent *evt);
#endif
+ void onStatusPollInterval();
+
+ int verifyNotSuspended();
};
#endif