diff options
author | Vitaly Buka <vitalybuka@google.com> | 2016-02-12 18:56:15 -0800 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2016-02-19 18:09:02 -0800 |
commit | e1b6e2659cfd734aced688ebb718fc367a156301 (patch) | |
tree | b148a57cb2b87991ce4f930856d60496f75c458e | |
parent | c08d3ff1e1a6d85d62f1a853afd4dd13fb6d240b (diff) | |
download | shill-brillo-m10-release.tar.gz |
Add device's "WiFi.SupportedFrequencies" property.brillo-m10-releasebrillo-m10-dev
weaved needs to know which frequencies are being
supported by device.
BUG: 27070625
Change-Id: I0b7d86eabbccf4720adcf74ccb5316c31ce97a3e
-rw-r--r-- | property_store.cc | 7 | ||||
-rw-r--r-- | property_store.h | 2 | ||||
-rw-r--r-- | wifi/wifi.cc | 14 | ||||
-rw-r--r-- | wifi/wifi.h | 5 |
4 files changed, 28 insertions, 0 deletions
diff --git a/property_store.cc b/property_store.cc index d28a7725..dc630a8c 100644 --- a/property_store.cc +++ b/property_store.cc @@ -883,6 +883,13 @@ void PropertyStore::RegisterDerivedUint64(const string& name, uint64_properties_[name] = acc; } +void PropertyStore::RegisterDerivedUint16s(const std::string& name, + const Uint16sAccessor& acc) { + DCHECK(!Contains(name) || ContainsKey(uint16s_properties_, name)) + << "(Already registered " << name << ")"; + uint16s_properties_[name] = acc; +} + void PropertyStore::RegisterDerivedByteArray(const string& name, const ByteArrayAccessor& acc) { DCHECK(!Contains(name) || ContainsKey(bytearray_properties_, name)) diff --git a/property_store.h b/property_store.h index f6eb9e25..83749bc5 100644 --- a/property_store.h +++ b/property_store.h @@ -264,6 +264,8 @@ class PropertyStore { const Uint16Accessor& accessor); void RegisterDerivedUint64(const std::string& name, const Uint64Accessor& accessor); + void RegisterDerivedUint16s(const std::string& name, + const Uint16sAccessor& accessor); void RegisterDerivedByteArray(const std::string& name, const ByteArrayAccessor& accessor); diff --git a/wifi/wifi.cc b/wifi/wifi.cc index 5d6ab9db..7563233b 100644 --- a/wifi/wifi.cc +++ b/wifi/wifi.cc @@ -219,6 +219,8 @@ WiFi::WiFi(ControlInterface* control_interface, HelpRegisterConstDerivedBool(store, kScanningProperty, &WiFi::GetScanPending); + HelpRegisterConstDerivedUint16s(store, kWifiSupportedFrequenciesProperty, + &WiFi::GetAllScanFrequencies); HelpRegisterDerivedUint16(store, kRoamThresholdProperty, &WiFi::GetRoamThreshold, @@ -1841,6 +1843,14 @@ void WiFi::HelpRegisterConstDerivedBool( BoolAccessor(new CustomAccessor<WiFi, bool>(this, get, nullptr))); } +void WiFi::HelpRegisterConstDerivedUint16s(PropertyStore* store, + const std::string& name, + Uint16s (WiFi::*get)(Error* error)) { + store->RegisterDerivedUint16s( + name, + Uint16sAccessor(new CustomAccessor<WiFi, Uint16s>(this, get, nullptr))); +} + void WiFi::OnBeforeSuspend(const ResultCallback& callback) { if (!enabled()) { callback.Run(Error(Error::kSuccess)); @@ -2466,6 +2476,10 @@ KeyValueStore WiFi::GetLinkStatistics(Error* /*error*/) { return link_statistics_; } +Uint16s WiFi::GetAllScanFrequencies(Error* /* error */) { + return {begin(all_scan_frequencies_), end(all_scan_frequencies_)}; +} + bool WiFi::GetScanPending(Error* /* error */) { return scan_state_ == kScanScanning || scan_state_ == kScanBackgroundScanning; } diff --git a/wifi/wifi.h b/wifi/wifi.h index 9811cc79..d2bd286a 100644 --- a/wifi/wifi.h +++ b/wifi/wifi.h @@ -399,6 +399,8 @@ class WiFi : public Device, public SupplicantEventDelegateInterface { // RPC accessor for |link_statistics_|. KeyValueStore GetLinkStatistics(Error* error); + Uint16s GetAllScanFrequencies(Error* /* error */); + bool GetScanPending(Error* /* error */); bool SetBgscanMethod( const int& argument, const std::string& method, Error* error); @@ -464,6 +466,9 @@ class WiFi : public Device, public SupplicantEventDelegateInterface { PropertyStore* store, const std::string& name, bool(WiFi::*get)(Error* error)); + void HelpRegisterConstDerivedUint16s(PropertyStore* store, + const std::string& name, + Uint16s (WiFi::*get)(Error* error)); // Disable a network entry in wpa_supplicant, and catch any exception // that occurs. Returns false if an exception occurred, true otherwise. |