shill: Update WiMAX DBus proxy interfaces and classes.
Adds WiMaxManager.Network proxy. Creates WiMaxService objects based on
the available WiMax networks thus adding initial support for multiple
active WiMAX services. Adds a "Scanning" property to the WiMax device,
similar to WiFi and Cellular.
BUG=chrome-os-partner:9782
TEST=Build and run unit tests.
CQ-DEPEND=I97ce1351436afb3aeac0d2a48a8f51e1501e7466
Change-Id: Ie3f919846114f63414788c5b970fa0dff2e2d06a
Reviewed-on: https://gerrit.chromium.org/gerrit/23008
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
diff --git a/wimax_network_proxy.cc b/wimax_network_proxy.cc
new file mode 100644
index 0000000..ed2dc73
--- /dev/null
+++ b/wimax_network_proxy.cc
@@ -0,0 +1,93 @@
+// 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.
+
+#include "shill/wimax_network_proxy.h"
+
+#include <base/logging.h>
+#include <chromeos/dbus/service_constants.h>
+
+#include "shill/error.h"
+#include "shill/scope_logger.h"
+
+using std::string;
+
+namespace shill {
+
+WiMaxNetworkProxy::WiMaxNetworkProxy(DBus::Connection *connection,
+ const DBus::Path &path)
+ : proxy_(connection, path) {}
+
+WiMaxNetworkProxy::~WiMaxNetworkProxy() {}
+
+uint32 WiMaxNetworkProxy::Identifier(Error *error) {
+ SLOG(DBus, 2) << __func__;
+ try {
+ return proxy_.Identifier();
+ } catch (const DBus::Error &e) {
+ FromDBusError(e, error);
+ }
+ return 0;
+}
+
+string WiMaxNetworkProxy::Name(Error *error) {
+ SLOG(DBus, 2) << __func__;
+ try {
+ return proxy_.Name();
+ } catch (const DBus::Error &e) {
+ FromDBusError(e, error);
+ }
+ return string();
+}
+
+int WiMaxNetworkProxy::Type(Error *error) {
+ SLOG(DBus, 2) << __func__;
+ try {
+ return proxy_.Type();
+ } catch (const DBus::Error &e) {
+ FromDBusError(e, error);
+ }
+ return 0;
+}
+
+int WiMaxNetworkProxy::CINR(Error *error) {
+ SLOG(DBus, 2) << __func__;
+ try {
+ return proxy_.CINR();
+ } catch (const DBus::Error &e) {
+ FromDBusError(e, error);
+ }
+ return 0;
+}
+
+int WiMaxNetworkProxy::RSSI(Error *error) {
+ SLOG(DBus, 2) << __func__;
+ try {
+ return proxy_.RSSI();
+ } catch (const DBus::Error &e) {
+ FromDBusError(e, error);
+ }
+ return 0;
+}
+
+// static
+void WiMaxNetworkProxy::FromDBusError(const DBus::Error &dbus_error,
+ Error *error) {
+ if (!error) {
+ return;
+ }
+ if (!dbus_error.is_set()) {
+ error->Reset();
+ return;
+ }
+ Error::PopulateAndLog(error, Error::kOperationFailed, dbus_error.what());
+}
+
+WiMaxNetworkProxy::Proxy::Proxy(DBus::Connection *connection,
+ const DBus::Path &path)
+ : DBus::ObjectProxy(*connection, path,
+ wimax_manager::kWiMaxManagerServiceName) {}
+
+WiMaxNetworkProxy::Proxy::~Proxy() {}
+
+} // namespace shill