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 { |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 15 | namespace mm1 { |
| 16 | |
| 17 | class ModemModemCdmaProxy : public ModemModemCdmaProxyInterface { |
| 18 | public: |
| 19 | // Constructs a org.freedesktop.ModemManager1.Modem.ModemCdma DBus |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 20 | // object proxy at |path| owned by |service|. |
| 21 | ModemModemCdmaProxy(DBus::Connection *connection, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 22 | const std::string &path, |
| 23 | const std::string &service); |
| 24 | virtual ~ModemModemCdmaProxy(); |
| 25 | |
| 26 | // Inherited methods from ModemModemCdmaProxyInterface. |
| 27 | virtual void Activate(const std::string &carrier, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 28 | Error *error, |
| 29 | const ResultCallback &callback, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 30 | int timeout); |
| 31 | virtual void ActivateManual( |
| 32 | const DBusPropertiesMap &properties, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 33 | Error *error, |
| 34 | const ResultCallback &callback, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 35 | int timeout); |
| 36 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 37 | virtual void set_activation_state_callback( |
| 38 | const ActivationStateSignalCallback &callback); |
| 39 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 40 | // Inherited properties from ModemCdmaProxyInterface. |
| 41 | virtual std::string Meid(); |
| 42 | virtual std::string Esn(); |
| 43 | virtual uint32_t Sid(); |
| 44 | virtual uint32_t Nid(); |
| 45 | virtual uint32_t Cdma1xRegistrationState(); |
| 46 | virtual uint32_t EvdoRegistrationState(); |
| 47 | |
| 48 | private: |
| 49 | class Proxy : public org::freedesktop::ModemManager1::Modem::ModemCdma_proxy, |
| 50 | public DBus::ObjectProxy { |
| 51 | public: |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 52 | Proxy(DBus::Connection *connection, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 53 | const std::string &path, |
| 54 | const std::string &service); |
| 55 | virtual ~Proxy(); |
| 56 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 57 | virtual void set_activation_state_callback( |
| 58 | const ActivationStateSignalCallback &callback); |
| 59 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 60 | private: |
| 61 | // Signal callbacks inherited from Proxy |
| 62 | // handle signals |
| 63 | void ActivationStateChanged( |
| 64 | const uint32_t &activation_state, |
| 65 | const uint32_t &activation_error, |
| 66 | const DBusPropertiesMap &status_changes); |
| 67 | |
| 68 | // Method callbacks inherited from |
| 69 | // org::freedesktop::ModemManager1::Modem::ModemCdmaProxy |
| 70 | virtual void ActivateCallback(const ::DBus::Error& dberror, void *data); |
| 71 | virtual void ActivateManualCallback(const ::DBus::Error& dberror, |
| 72 | void *data); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 73 | ActivationStateSignalCallback activation_state_callback_; |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 74 | |
| 75 | DISALLOW_COPY_AND_ASSIGN(Proxy); |
| 76 | }; |
| 77 | |
| 78 | Proxy proxy_; |
| 79 | |
| 80 | DISALLOW_COPY_AND_ASSIGN(ModemModemCdmaProxy); |
| 81 | }; |
| 82 | |
| 83 | } // namespace mm1 |
| 84 | } // namespace shill |
| 85 | |
| 86 | #endif // SHILL_MM1_MODEM_MODEMCDMA_PROXY_ |