Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 1 | // 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_MODEMCDMA_PROXY_ |
| 6 | #define SHILL_MM1_MODEM_MODEMCDMA_PROXY_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include "shill/dbus_bindings/mm1-modem-modemcdma.h" |
| 11 | #include "shill/dbus_properties.h" |
| 12 | #include "shill/mm1_modem_modemcdma_proxy_interface.h" |
| 13 | |
| 14 | namespace shill { |
| 15 | class AsyncCallHandler; |
| 16 | namespace mm1 { |
| 17 | |
| 18 | class ModemModemCdmaProxy : public ModemModemCdmaProxyInterface { |
| 19 | public: |
| 20 | // Constructs a org.freedesktop.ModemManager1.Modem.ModemCdma DBus |
| 21 | // object proxy at |path| owned by |service|. Caught signals and |
| 22 | // asynchronous method replies will be dispatched to |delegate|. |
| 23 | ModemModemCdmaProxy(ModemModemCdmaProxyDelegate *delegate, |
| 24 | DBus::Connection *connection, |
| 25 | const std::string &path, |
| 26 | const std::string &service); |
| 27 | virtual ~ModemModemCdmaProxy(); |
| 28 | |
| 29 | // Inherited methods from ModemModemCdmaProxyInterface. |
| 30 | virtual void Activate(const std::string &carrier, |
| 31 | AsyncCallHandler *call_handler, |
| 32 | int timeout); |
| 33 | virtual void ActivateManual( |
| 34 | const DBusPropertiesMap &properties, |
| 35 | AsyncCallHandler *call_handler, |
| 36 | int timeout); |
| 37 | |
| 38 | // Inherited properties from ModemCdmaProxyInterface. |
| 39 | virtual std::string Meid(); |
| 40 | virtual std::string Esn(); |
| 41 | virtual uint32_t Sid(); |
| 42 | virtual uint32_t Nid(); |
| 43 | virtual uint32_t Cdma1xRegistrationState(); |
| 44 | virtual uint32_t EvdoRegistrationState(); |
| 45 | |
| 46 | private: |
| 47 | class Proxy : public org::freedesktop::ModemManager1::Modem::ModemCdma_proxy, |
| 48 | public DBus::ObjectProxy { |
| 49 | public: |
| 50 | Proxy(ModemModemCdmaProxyDelegate *delegate, |
| 51 | DBus::Connection *connection, |
| 52 | const std::string &path, |
| 53 | const std::string &service); |
| 54 | virtual ~Proxy(); |
| 55 | |
| 56 | private: |
| 57 | // Signal callbacks inherited from Proxy |
| 58 | // handle signals |
| 59 | void ActivationStateChanged( |
| 60 | const uint32_t &activation_state, |
| 61 | const uint32_t &activation_error, |
| 62 | const DBusPropertiesMap &status_changes); |
| 63 | |
| 64 | // Method callbacks inherited from |
| 65 | // org::freedesktop::ModemManager1::Modem::ModemCdmaProxy |
| 66 | virtual void ActivateCallback(const ::DBus::Error& dberror, void *data); |
| 67 | virtual void ActivateManualCallback(const ::DBus::Error& dberror, |
| 68 | void *data); |
| 69 | ModemModemCdmaProxyDelegate *delegate_; |
| 70 | |
| 71 | DISALLOW_COPY_AND_ASSIGN(Proxy); |
| 72 | }; |
| 73 | |
| 74 | Proxy proxy_; |
| 75 | |
| 76 | DISALLOW_COPY_AND_ASSIGN(ModemModemCdmaProxy); |
| 77 | }; |
| 78 | |
| 79 | } // namespace mm1 |
| 80 | } // namespace shill |
| 81 | |
| 82 | #endif // SHILL_MM1_MODEM_MODEMCDMA_PROXY_ |