Make Enable/Disable work using new callbacks for async support.

Use new-style callbacks to implement the Manager EnableTechnology
and DisableTechnology operations asynchronously. This allows
devices to be enabled and disabled from the UI ,and for the UI
to display available networks once the device is enabled.

Removed the behavior whereby setting the Device.Powered property
had the side effect of enabling or disabling the device. To
replace this, I added new Device.Enable and Device.Disable calls
for enabling and disabling individual devices.

Also separated the in-memory value of the Powered property from
the persisted value. Whenever a client requests that a device
be enabled or disabled, the desired power state is immediately
saved in the profile, but the in-memory value isn't updated until
the operation completes. On startup, shill now automatically
starts any devices for which the persistent Powered property
is set, and does not start devices for which it is not set.

BUG=chromium-os:23319,chromium-os:27814
TEST=Manual testing on device + unit tests passing.

Change-Id: Id676be3fc662cfd5efb730c67687edfd16b2dc6b
Reviewed-on: https://gerrit.chromium.org/gerrit/18123
Commit-Ready: Eric Shienbrood <ers@chromium.org>
Reviewed-by: Eric Shienbrood <ers@chromium.org>
Tested-by: Eric Shienbrood <ers@chromium.org>
diff --git a/mm1_modem_simple_proxy_interface.h b/mm1_modem_simple_proxy_interface.h
index 99bdafc..9ec59c3 100644
--- a/mm1_modem_simple_proxy_interface.h
+++ b/mm1_modem_simple_proxy_interface.h
@@ -9,10 +9,9 @@
 
 #include <base/basictypes.h>
 
-#include "shill/dbus_properties.h"
+#include "shill/callbacks.h"
 
 namespace shill {
-class AsyncCallHandler;
 class Error;
 
 namespace mm1 {
@@ -20,42 +19,25 @@
 // These are the methods that a
 // org.freedesktop.ModemManager1.Modem.Simple proxy must support.  The
 // interface is provided so that it can be mocked in tests.  All calls
-// are made asynchronously. Call completion is signalled through the
-// corresponding 'OnXXXCallback' method in the ProxyDelegate
-// interface.
+// are made asynchronously. Call completion is signalled via the callbacks
+// passed to the methods.
 class ModemSimpleProxyInterface {
  public:
   virtual ~ModemSimpleProxyInterface() {}
 
-  virtual void Connect(
-      const DBusPropertiesMap &properties,
-      AsyncCallHandler *call_handler,
-      int timeout) = 0;
+  virtual void Connect(const DBusPropertiesMap &properties,
+                       Error *error,
+                       const DBusPathCallback &callback,
+                       int timeout) = 0;
   virtual void Disconnect(const ::DBus::Path &bearer,
-                          AsyncCallHandler *call_handler,
+                          Error *error,
+                          const ResultCallback &callback,
                           int timeout) = 0;
-  virtual void GetStatus(AsyncCallHandler *call_handler,
+  virtual void GetStatus(Error *error,
+                         const DBusPropertyMapCallback &callback,
                          int timeout) = 0;
 };
 
-// ModemManager1.Modem.Simple signal delegate to be associated with
-// the proxy.
-class ModemSimpleProxyDelegate {
- public:
-  virtual ~ModemSimpleProxyDelegate() {}
-
-  // Handle async callbacks
-  virtual void OnConnectCallback(const ::DBus::Path &bearer,
-                                 const Error &error,
-                                 AsyncCallHandler *call_handler) = 0;
-  virtual void OnDisconnectCallback(const Error &error,
-                                    AsyncCallHandler *call_handler) = 0;
-  virtual void OnGetStatusCallback(
-      const DBusPropertiesMap &bearer,
-      const Error &error,
-      AsyncCallHandler *call_handler) = 0;
-};
-
 }  // namespace mm1
 }  // namespace shill