blob: 4a1a40ddd56915af014f115dbae8f6605e5fe5b6 [file] [log] [blame]
Darin Petkove9d12e02011-07-27 15:09:37 -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#ifndef SHILL_MODEM_PROXY_
6#define SHILL_MODEM_PROXY_
7
8#include <base/basictypes.h>
9
10#include "shill/dbus_bindings/modem.h"
11#include "shill/modem_proxy_interface.h"
12
13namespace shill {
14
Darin Petkovc5f56562011-08-06 16:40:05 -070015// A proxy to ModemManager.Modem.
Darin Petkove9d12e02011-07-27 15:09:37 -070016class ModemProxy : public ModemProxyInterface {
17 public:
Darin Petkovc5f56562011-08-06 16:40:05 -070018 // Constructs a ModemManager.Modem DBus object proxy at |path| owned by
19 // |service|. Caught signals will be dispatched to |listener|.
20 ModemProxy(ModemProxyListener *listener,
21 DBus::Connection *connection,
Darin Petkove9d12e02011-07-27 15:09:37 -070022 const std::string &path,
23 const std::string &service);
24 virtual ~ModemProxy();
25
26 // Inherited from ModemProxyInterface.
27 virtual void Enable(const bool enable);
Darin Petkovceb68172011-07-29 14:47:48 -070028 virtual Info GetInfo();
Darin Petkove9d12e02011-07-27 15:09:37 -070029
30 private:
31 class Proxy : public org::freedesktop::ModemManager::Modem_proxy,
32 public DBus::ObjectProxy {
33 public:
Darin Petkovc5f56562011-08-06 16:40:05 -070034 Proxy(ModemProxyListener *listener,
35 DBus::Connection *connection,
Darin Petkove9d12e02011-07-27 15:09:37 -070036 const std::string &path,
37 const std::string &service);
38 virtual ~Proxy();
39
40 private:
41 // Signal callbacks inherited from ModemManager::Modem_proxy.
Darin Petkov1ec741c2011-08-02 10:45:27 -070042 virtual void StateChanged(const uint32 &old,
43 const uint32 &_new,
Darin Petkove9d12e02011-07-27 15:09:37 -070044 const uint32 &reason);
45
Darin Petkovc5f56562011-08-06 16:40:05 -070046 ModemProxyListener *listener_;
47
Darin Petkove9d12e02011-07-27 15:09:37 -070048 DISALLOW_COPY_AND_ASSIGN(Proxy);
49 };
50
51 Proxy proxy_;
52
53 DISALLOW_COPY_AND_ASSIGN(ModemProxy);
54};
55
56} // namespace shill
57
58#endif // SHILL_MODEM_PROXY_