shill: Add support for saving wifi frequency in service object.

BUG=chromium-os:25882
TEST=Unit tests, network_WiFiManager (7/9)

Change-Id: Ia491ef6b240778781470d7ff820e23deb7aa28f0
Reviewed-on: https://gerrit.chromium.org/gerrit/15363
Commit-Ready: Thieu Le <thieule@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
diff --git a/wifi_endpoint.cc b/wifi_endpoint.cc
index 12d9e59..cb04800 100644
--- a/wifi_endpoint.cc
+++ b/wifi_endpoint.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -21,7 +21,8 @@
 namespace shill {
 
 WiFiEndpoint::WiFiEndpoint(
-    const map<string, ::DBus::Variant> &properties) {
+    const map<string, ::DBus::Variant> &properties)
+    : frequency_(0) {
   // XXX will segfault on missing properties
   ssid_ =
       properties.find(wpa_supplicant::kBSSPropertySSID)->second.
@@ -32,6 +33,10 @@
   signal_strength_ =
       properties.find(wpa_supplicant::kBSSPropertySignal)->second.
       reader().get_int16();
+  map<string, ::DBus::Variant>::const_iterator it =
+      properties.find(wpa_supplicant::kBSSPropertyFrequency);
+  if (it != properties.end())
+    frequency_ = it->second.reader().get_uint16();
   network_mode_ = ParseMode(
       properties.find(wpa_supplicant::kBSSPropertyMode)->second);
   security_mode_ = ParseSecurity(properties);
@@ -86,6 +91,10 @@
   return signal_strength_;
 }
 
+uint16 WiFiEndpoint::frequency() const {
+  return frequency_;
+}
+
 const string &WiFiEndpoint::network_mode() const {
   return network_mode_;
 }