blob: a438df02baf90cbe958adcab8d5de62f6212115a [file] [log] [blame]
Jason Glasgowee1081c2012-03-06 15:14:53 -05001// 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#ifndef SHILL_MM1_MODEM_SIMPLE_PROXY_
6#define SHILL_MM1_MODEM_SIMPLE_PROXY_
7
8#include <string>
9
10#include "shill/dbus_bindings/mm1-modem-simple.h"
11#include "shill/dbus_properties.h"
12#include "shill/mm1_modem_simple_proxy_interface.h"
13
14namespace shill {
15namespace mm1 {
16
17class ModemSimpleProxy : public ModemSimpleProxyInterface {
18 public:
19 // Constructs a org.freedesktop.ModemManager1.Modem.Simple DBus
20 // object proxy at |path| owned by |service|. Caught signals and
21 // asynchronous method replies will be dispatched to |delegate|.
22 ModemSimpleProxy(ModemSimpleProxyDelegate *delegate,
23 DBus::Connection *connection,
24 const std::string &path,
25 const std::string &service);
26 virtual ~ModemSimpleProxy();
27
28 // Inherited methods from SimpleProxyInterface.
29 virtual void Connect(
30 const DBusPropertiesMap &properties,
31 AsyncCallHandler *call_handler,
32 int timeout);
33 virtual void Disconnect(const ::DBus::Path &bearer,
34 AsyncCallHandler *call_handler,
35 int timeout);
36 virtual void GetStatus(AsyncCallHandler *call_handler, int timeout);
37
38 private:
39 class Proxy : public org::freedesktop::ModemManager1::Modem::Simple_proxy,
40 public DBus::ObjectProxy {
41 public:
42 Proxy(ModemSimpleProxyDelegate *delegate,
43 DBus::Connection *connection,
44 const std::string &path,
45 const std::string &service);
46 virtual ~Proxy();
47
48 private:
49 // Method callbacks inherited from
50 // org::freedesktop::ModemManager1::Modem::SimpleProxy
51 virtual void ConnectCallback(const ::DBus::Path &bearer,
52 const ::DBus::Error &dberror,
53 void *data);
54 virtual void DisconnectCallback(const ::DBus::Error &dberror, void *data);
55 virtual void GetStatusCallback(
56 const DBusPropertiesMap &bearer,
57 const ::DBus::Error &dberror,
58 void *data);
59 ModemSimpleProxyDelegate *delegate_;
60
61 DISALLOW_COPY_AND_ASSIGN(Proxy);
62 };
63
64 Proxy proxy_;
65
66 DISALLOW_COPY_AND_ASSIGN(ModemSimpleProxy);
67};
68
69} // namespace mm1
70} // namespace shill
71
72#endif // SHILL_MM1_MODEM_SIMPLE_PROXY_