blob: 271a620aa6b17b08f5cf855d48feca5eaf88554b [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
7#include <base/bind.h>
8
9#include "shill/cellular_error.h"
mukesh agrawal0e9e9d12014-04-18 16:09:58 -070010#include "shill/dbus_async_call_helper.h"
Darin Petkovc37a9c42012-09-06 15:28:22 +020011#include "shill/error.h"
12#include "shill/logging.h"
13
14using base::Bind;
15using base::Callback;
16using std::string;
17
18namespace shill {
19
20ModemGobiProxy::ModemGobiProxy(DBus::Connection *connection,
21 const string &path,
22 const string &service)
23 : proxy_(connection, path, service) {}
24
25ModemGobiProxy::~ModemGobiProxy() {}
26
27void ModemGobiProxy::SetCarrier(const string &carrier,
28 Error *error,
29 const ResultCallback &callback,
30 int timeout) {
mukesh agrawal0e9e9d12014-04-18 16:09:58 -070031 BeginAsyncDBusCall(__func__, proxy_, &Proxy::SetCarrierAsync, callback,
32 error, &CellularError::FromDBusError, timeout,
33 carrier);
Darin Petkovc37a9c42012-09-06 15:28:22 +020034}
35
36ModemGobiProxy::Proxy::Proxy(DBus::Connection *connection,
37 const string &path,
38 const string &service)
39 : DBus::ObjectProxy(*connection, path, service.c_str()) {}
40
41ModemGobiProxy::Proxy::~Proxy() {}
42
43void ModemGobiProxy::Proxy::SetCarrierCallback(const DBus::Error &dberror,
44 void *data) {
45 SLOG(DBus, 2) << __func__;
46 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
47 Error error;
48 CellularError::FromDBusError(dberror, &error);
49 callback->Run(error);
50}
51
52} // namespace shill