blob: 5e44a01bf919f61b450372edd2fad0d27403defe [file] [log] [blame]
Arman Uguray6e5639f2012-11-15 20:30:19 -08001// 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
Ben Chanc54afe52014-11-05 10:28:08 -08005#ifndef SHILL_CELLULAR_MM1_BEARER_PROXY_H_
6#define SHILL_CELLULAR_MM1_BEARER_PROXY_H_
Arman Uguray6e5639f2012-11-15 20:30:19 -08007
8#include <string>
9
Liam McLoughlinef342b42013-09-13 21:05:36 +010010#include "dbus_proxies/org.freedesktop.ModemManager1.Bearer.h"
Ben Chanc54afe52014-11-05 10:28:08 -080011#include "shill/cellular/mm1_bearer_proxy_interface.h"
Arman Uguray6e5639f2012-11-15 20:30:19 -080012#include "shill/dbus_properties.h"
Arman Uguray6e5639f2012-11-15 20:30:19 -080013
14namespace shill {
15namespace mm1 {
16
mukesh agrawalf407d592013-07-31 11:37:57 -070017// A proxy to org.freedesktop.ModemManager1.Bearer.
Arman Uguray6e5639f2012-11-15 20:30:19 -080018class BearerProxy : public BearerProxyInterface {
19 public:
20 // Constructs an org.freedesktop.ModemManager1.Bearer DBus object
21 // proxy at |path| owned by |service|.
Paul Stewartf58b28e2015-06-16 13:13:10 -070022 BearerProxy(DBus::Connection* connection,
23 const std::string& path,
24 const std::string& service);
Arman Uguray6e5639f2012-11-15 20:30:19 -080025
Ben Chan5ea763b2014-08-13 11:07:54 -070026 ~BearerProxy() override;
Arman Uguray6e5639f2012-11-15 20:30:19 -080027
28 // Inherited methods from BearerProxyInterface
Paul Stewartf58b28e2015-06-16 13:13:10 -070029 void Connect(Error* error,
30 const ResultCallback& callback,
Yunlian Jiang6acd9662015-01-30 08:36:10 -080031 int timeout) override;
Paul Stewartf58b28e2015-06-16 13:13:10 -070032 void Disconnect(Error* error,
33 const ResultCallback& callback,
Yunlian Jiang6acd9662015-01-30 08:36:10 -080034 int timeout) override;
Arman Uguray6e5639f2012-11-15 20:30:19 -080035
Arman Uguray6e5639f2012-11-15 20:30:19 -080036 private:
37 class Proxy : public org::freedesktop::ModemManager1::Bearer_proxy,
38 public DBus::ObjectProxy {
39 public:
Paul Stewartf58b28e2015-06-16 13:13:10 -070040 Proxy(DBus::Connection* connection,
41 const std::string& path,
42 const std::string& service);
Ben Chan5ea763b2014-08-13 11:07:54 -070043 ~Proxy() override;
Arman Uguray6e5639f2012-11-15 20:30:19 -080044
45 private:
46 // Method callbacks inherited from
47 // org::freedesktop::ModemManager1::BearerProxy
Paul Stewartf58b28e2015-06-16 13:13:10 -070048 void ConnectCallback(const ::DBus::Error& dberror,
49 void* data) override;
50 void DisconnectCallback(const ::DBus::Error& dberror,
51 void* data) override;
Arman Uguray6e5639f2012-11-15 20:30:19 -080052
53 DISALLOW_COPY_AND_ASSIGN(Proxy);
54 };
55
56 Proxy proxy_;
57
58 DISALLOW_COPY_AND_ASSIGN(BearerProxy);
59};
60
61} // namespace mm1
62} // namespace shill
63
Ben Chanc54afe52014-11-05 10:28:08 -080064#endif // SHILL_CELLULAR_MM1_BEARER_PROXY_H_