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 | |
Hristo Stefanov | ed2c28c | 2011-11-29 15:37:30 -0800 | [diff] [blame] | 8 | #include <string> |
| 9 | |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 10 | #include <base/basictypes.h> |
| 11 | |
| 12 | #include "shill/dbus_bindings/modem.h" |
| 13 | #include "shill/modem_proxy_interface.h" |
| 14 | |
| 15 | namespace shill { |
| 16 | |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 17 | // A proxy to ModemManager.Modem. |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 18 | class ModemProxy : public ModemProxyInterface { |
| 19 | public: |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 20 | // Constructs a ModemManager.Modem DBus object proxy at |path| owned by |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 21 | // |service|. Caught signals will be dispatched to |delegate|. |
| 22 | ModemProxy(ModemProxyDelegate *delegate, |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 23 | DBus::Connection *connection, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 24 | const std::string &path, |
| 25 | const std::string &service); |
| 26 | virtual ~ModemProxy(); |
| 27 | |
| 28 | // Inherited from ModemProxyInterface. |
| 29 | virtual void Enable(const bool enable); |
Darin Petkov | ceb6817 | 2011-07-29 14:47:48 -0700 | [diff] [blame] | 30 | virtual Info GetInfo(); |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 31 | |
| 32 | private: |
| 33 | class Proxy : public org::freedesktop::ModemManager::Modem_proxy, |
| 34 | public DBus::ObjectProxy { |
| 35 | public: |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 36 | Proxy(ModemProxyDelegate *delegate, |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 37 | DBus::Connection *connection, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 38 | const std::string &path, |
| 39 | const std::string &service); |
| 40 | virtual ~Proxy(); |
| 41 | |
| 42 | private: |
| 43 | // Signal callbacks inherited from ModemManager::Modem_proxy. |
Darin Petkov | 1ec741c | 2011-08-02 10:45:27 -0700 | [diff] [blame] | 44 | virtual void StateChanged(const uint32 &old, |
| 45 | const uint32 &_new, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 46 | const uint32 &reason); |
| 47 | |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 48 | ModemProxyDelegate *delegate_; |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 49 | |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 50 | DISALLOW_COPY_AND_ASSIGN(Proxy); |
| 51 | }; |
| 52 | |
| 53 | Proxy proxy_; |
| 54 | |
| 55 | DISALLOW_COPY_AND_ASSIGN(ModemProxy); |
| 56 | }; |
| 57 | |
| 58 | } // namespace shill |
| 59 | |
| 60 | #endif // SHILL_MODEM_PROXY_ |