Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 1 | // 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 | |
| 13 | namespace shill { |
| 14 | |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 15 | // A proxy to ModemManager.Modem. |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 16 | class ModemProxy : public ModemProxyInterface { |
| 17 | public: |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 18 | // 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 Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 22 | 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 Petkov | ceb6817 | 2011-07-29 14:47:48 -0700 | [diff] [blame] | 28 | virtual Info GetInfo(); |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 29 | |
| 30 | private: |
| 31 | class Proxy : public org::freedesktop::ModemManager::Modem_proxy, |
| 32 | public DBus::ObjectProxy { |
| 33 | public: |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 34 | Proxy(ModemProxyListener *listener, |
| 35 | DBus::Connection *connection, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 36 | const std::string &path, |
| 37 | const std::string &service); |
| 38 | virtual ~Proxy(); |
| 39 | |
| 40 | private: |
| 41 | // Signal callbacks inherited from ModemManager::Modem_proxy. |
Darin Petkov | 1ec741c | 2011-08-02 10:45:27 -0700 | [diff] [blame] | 42 | virtual void StateChanged(const uint32 &old, |
| 43 | const uint32 &_new, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 44 | const uint32 &reason); |
| 45 | |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 46 | ModemProxyListener *listener_; |
| 47 | |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 48 | 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_ |