shill: acquire ip addresses for wifi (via dhcp), and signal when
the service is ready

BUG=chromium-os:20191
TEST=unittest, network_WiFiManager/000_SSID_Length_Limit

note: with this CL, 000_SSID_Length_Limit connects to the
open network, but fails on the hidden network. hidden network
support requires shill to implement Manager.GetService.

Change-Id: I71d1634fb3fc48de36fd2bf828969bfe0b3a46f6
Reviewed-on: http://gerrit.chromium.org/gerrit/7466
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
diff --git a/service.cc b/service.cc
index 2740065..d1ed9a4 100644
--- a/service.cc
+++ b/service.cc
@@ -176,7 +176,7 @@
     failure_ = kFailureUnknown;
   }
   manager_->UpdateService(this);
-  // TODO(pstew): Broadcast property change notification via control interface
+  adaptor_->EmitStringChanged(flimflam::kStateProperty, CalculateState());
 }
 
 void Service::SetFailure(ConnectFailure failure) {
@@ -265,6 +265,16 @@
 
 void Service::set_profile(const ProfileRefPtr &p) { profile_ = p; }
 
+string Service::CalculateState() {
+  switch (state_) {
+    case kStateConnected:
+      return flimflam::kStateReady;
+    default:
+      // TODO(quiche): provide strings for other states
+      return flimflam::kStateIdle;
+  }
+}
+
 void Service::HelpRegisterDerivedBool(const string &name,
                                       bool(Service::*get)(void),
                                       bool(Service::*set)(const bool&)) {