blob: c491b94ba1eb157cc1c1a6b370bb32a3491d09ae [file] [log] [blame]
Darin Petkovc90fe522011-07-15 13:59:47 -07001// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "shill/modem_manager_proxy.h"
6
7#include <base/logging.h>
8
Darin Petkov5c97ac52011-07-19 16:30:49 -07009#include "shill/modem_manager.h"
mukesh agrawal06175d72012-04-23 16:46:01 -070010#include "shill/scope_logger.h"
Darin Petkov5c97ac52011-07-19 16:30:49 -070011
Darin Petkovc90fe522011-07-15 13:59:47 -070012using std::string;
13using std::vector;
14
15namespace shill {
16
Darin Petkovaceede32011-07-18 15:32:38 -070017ModemManagerProxy::ModemManagerProxy(DBus::Connection *connection,
David Rochberg81030ea2012-03-02 15:44:25 -050018 ModemManagerClassic *manager,
Darin Petkovc90fe522011-07-15 13:59:47 -070019 const string &path,
20 const string &service)
Darin Petkovaceede32011-07-18 15:32:38 -070021 : proxy_(connection, manager, path, service) {}
Darin Petkovc90fe522011-07-15 13:59:47 -070022
23ModemManagerProxy::~ModemManagerProxy() {}
24
25vector<DBus::Path> ModemManagerProxy::EnumerateDevices() {
mukesh agrawal06175d72012-04-23 16:46:01 -070026 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -070027 try {
28 return proxy_.EnumerateDevices();
29 } catch (const DBus::Error &e) {
30 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
31 return vector<DBus::Path>(); // Make the compiler happy.
32 }
Darin Petkovc90fe522011-07-15 13:59:47 -070033}
34
Darin Petkovaceede32011-07-18 15:32:38 -070035ModemManagerProxy::Proxy::Proxy(DBus::Connection *connection,
David Rochberg81030ea2012-03-02 15:44:25 -050036 ModemManagerClassic *manager,
Darin Petkovc90fe522011-07-15 13:59:47 -070037 const string &path,
38 const string &service)
39 : DBus::ObjectProxy(*connection, path, service.c_str()),
40 manager_(manager) {}
41
42ModemManagerProxy::Proxy::~Proxy() {}
43
44void ModemManagerProxy::Proxy::DeviceAdded(const DBus::Path &device) {
mukesh agrawal06175d72012-04-23 16:46:01 -070045 SLOG(DBus, 2) << __func__;
David Rochbergfa1d31d2012-03-20 10:38:07 -040046 manager_->OnDeviceAdded(device);
Darin Petkovc90fe522011-07-15 13:59:47 -070047}
48
49void ModemManagerProxy::Proxy::DeviceRemoved(const DBus::Path &device) {
mukesh agrawal06175d72012-04-23 16:46:01 -070050 SLOG(DBus, 2) << __func__;
David Rochbergfa1d31d2012-03-20 10:38:07 -040051 manager_->OnDeviceRemoved(device);
Darin Petkovc90fe522011-07-15 13:59:47 -070052}
53
54} // namespace shill