shill: enable background scanning for wifi

When connecting to a WiFi service, supply wpa_supplicant with background
scan configuration parameters. Also, allow bgscan parameters to be
configured via RPC.

Collateral change: added NOTIMPLEMENTED log messages for ClearProperty
methods on {Device,IPConfig,Service}DBusAdaptor

BUG=chromium-os:24309
TEST=unit tests, WiFiRoaming.003SSIDMultiSwitchBack

Change-Id: I3289684bcae58a01be61d2341fd6a1099c1c7f6f
Reviewed-on: https://gerrit.chromium.org/gerrit/13844
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: mukesh agrawal <quiche@chromium.org>
diff --git a/wifi.h b/wifi.h
index f4da2e1..a416b2d 100644
--- a/wifi.h
+++ b/wifi.h
@@ -71,6 +71,10 @@
   typedef std::map<const std::string, WiFiEndpointRefPtr> EndpointMap;
   typedef std::map<WiFiService *, std::string> ReverseServiceMap;
 
+  static const char *kDefaultBgscanMethod;
+  static const uint16 kDefaultBgscanShortIntervalSeconds;
+  static const int32 kDefaultBgscanSignalThresholdDbm;
+  static const uint16 kDefaultScanIntervalSeconds;
   static const char kManagerErrorPassphraseRequired[];
   static const char kManagerErrorSSIDTooLong[];
   static const char kManagerErrorSSIDTooShort[];
@@ -81,6 +85,20 @@
   static const char kManagerErrorUnsupportedServiceMode[];
   static const char kInterfaceStateUnknown[];
 
+  std::string CreateBgscanConfigString();
+  std::string GetBgscanMethod(Error */* error */) { return bgscan_method_; }
+  uint16 GetBgscanShortInterval(Error */* error */) {
+    return bgscan_short_interval_seconds_;
+  }
+  int32 GetBgscanSignalThreshold(Error */* error */) {
+    return bgscan_signal_threshold_dbm_;
+  }
+  uint16 GetScanInterval(Error */* error */) { return scan_interval_seconds_; }
+  void SetBgscanMethod(const std::string &method, Error *error);
+  void SetBgscanShortInterval(const uint16 &seconds, Error *error);
+  void SetBgscanSignalThreshold(const int32 &dbm, Error *error);
+  void SetScanInterval(const uint16 &seconds, Error *error);
+
   WiFiServiceRefPtr CreateServiceForEndpoint(
       const WiFiEndpoint &endpoint, bool hidden_ssid);
   void CurrentBSSChanged(const ::DBus::Path &new_bss);
@@ -103,6 +121,22 @@
   void ScanTask();
   void StateChanged(const std::string &new_state);
 
+  void HelpRegisterDerivedInt32(
+      PropertyStore *store,
+      const std::string &name,
+      int32(WiFi::*get)(Error *error),
+      void(WiFi::*set)(const int32 &value, Error *error));
+  void HelpRegisterDerivedString(
+      PropertyStore *store,
+      const std::string &name,
+      std::string(WiFi::*get)(Error *error),
+      void(WiFi::*set)(const std::string &value, Error *error));
+  void HelpRegisterDerivedUint16(
+      PropertyStore *store,
+      const std::string &name,
+      uint16(WiFi::*get)(Error *error),
+      void(WiFi::*set)(const uint16 &value, Error *error));
+
   // Store cached copies of singletons for speed/ease of testing.
   ProxyFactory *proxy_factory_;
 
@@ -130,10 +164,10 @@
 
   // Properties
   std::string bgscan_method_;
-  uint16 bgscan_short_interval_;
-  int32 bgscan_signal_threshold_;
+  uint16 bgscan_short_interval_seconds_;
+  int32 bgscan_signal_threshold_dbm_;
   bool scan_pending_;
-  uint16 scan_interval_;
+  uint16 scan_interval_seconds_;
 
   DISALLOW_COPY_AND_ASSIGN(WiFi);
 };