blob: 9e2f2cc21fadaf4b16f0498b141920f495500097 [file] [log] [blame]
Darin Petkovc37a9c42012-09-06 15:28:22 +02001// Copyright (c) 2012 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_gobi_proxy.h"
6
Ben Chanc20ed132014-10-16 12:25:03 -07007#include <memory>
8
Darin Petkovc37a9c42012-09-06 15:28:22 +02009#include <base/bind.h>
10
11#include "shill/cellular_error.h"
mukesh agrawal0e9e9d12014-04-18 16:09:58 -070012#include "shill/dbus_async_call_helper.h"
Darin Petkovc37a9c42012-09-06 15:28:22 +020013#include "shill/error.h"
14#include "shill/logging.h"
15
16using base::Bind;
17using base::Callback;
18using std::string;
Ben Chanc20ed132014-10-16 12:25:03 -070019using std::unique_ptr;
Darin Petkovc37a9c42012-09-06 15:28:22 +020020
21namespace shill {
22
23ModemGobiProxy::ModemGobiProxy(DBus::Connection *connection,
24 const string &path,
25 const string &service)
26 : proxy_(connection, path, service) {}
27
28ModemGobiProxy::~ModemGobiProxy() {}
29
30void ModemGobiProxy::SetCarrier(const string &carrier,
31 Error *error,
32 const ResultCallback &callback,
33 int timeout) {
mukesh agrawal0e9e9d12014-04-18 16:09:58 -070034 BeginAsyncDBusCall(__func__, proxy_, &Proxy::SetCarrierAsync, callback,
35 error, &CellularError::FromDBusError, timeout,
36 carrier);
Darin Petkovc37a9c42012-09-06 15:28:22 +020037}
38
39ModemGobiProxy::Proxy::Proxy(DBus::Connection *connection,
40 const string &path,
41 const string &service)
42 : DBus::ObjectProxy(*connection, path, service.c_str()) {}
43
44ModemGobiProxy::Proxy::~Proxy() {}
45
46void ModemGobiProxy::Proxy::SetCarrierCallback(const DBus::Error &dberror,
47 void *data) {
48 SLOG(DBus, 2) << __func__;
Ben Chanc20ed132014-10-16 12:25:03 -070049 unique_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Darin Petkovc37a9c42012-09-06 15:28:22 +020050 Error error;
51 CellularError::FromDBusError(dberror, &error);
52 callback->Run(error);
53}
54
55} // namespace shill