shill: report BSSID for wifi services

BUG=chromium-os:22377
TEST=unit tests, manual (see below)

Manual testing: view BSSID in Chrome network settings UI.
(chrome://chrome/settings/ -> "Wi-Fi network" -> "Network options...",
look for BSSID in "Connection" tab.)

Change-Id: I07f08921f8e412c84aa1eea2c32c6c963bb45b36
Reviewed-on: https://gerrit.chromium.org/gerrit/24455
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Gary Morain <gmorain@chromium.org>
Commit-Ready: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
diff --git a/wifi_service.cc b/wifi_service.cc
index 63757b5..a10f665 100644
--- a/wifi_service.cc
+++ b/wifi_service.cc
@@ -79,6 +79,7 @@
   store->RegisterConstBool(flimflam::kWifiHiddenSsid, &hidden_ssid_);
   store->RegisterConstUint16(flimflam::kWifiFrequency, &frequency_);
   store->RegisterConstUint16(flimflam::kWifiPhyMode, &physical_mode_);
+  store->RegisterConstString(flimflam::kWifiBSsid, &bssid_);
 
   hex_ssid_ = base::HexEncode(ssid_.data(), ssid_.size());
   string ssid_string(
@@ -490,7 +491,6 @@
   const WiFiEndpoint *representative_endpoint = NULL;
 
   if (current_endpoint_) {
-    // TODO: Copy BSSID here (crosbug.com/22377).
     representative_endpoint = current_endpoint_;
   } else  {
     int16 best_signal = std::numeric_limits<int16>::min();
@@ -505,18 +505,24 @@
 
   uint16 frequency;
   int16 signal;
+  string bssid;
   if (!representative_endpoint) {
     frequency = 0;
     signal = std::numeric_limits<int16>::min();
   } else {
     frequency = representative_endpoint->frequency();
     signal = representative_endpoint->signal_strength();
+    bssid = representative_endpoint->bssid_string();
   }
 
   if (frequency_ != frequency) {
     frequency_ = frequency;
     adaptor()->EmitUint16Changed(flimflam::kWifiFrequency, frequency_);
   }
+  if (bssid_ != bssid) {
+    bssid_ = bssid;
+    adaptor()->EmitStringChanged(flimflam::kWifiBSsid, bssid_);
+  }
   SetStrength(SignalToStrength(signal));
 }