Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 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_CDMA_PROXY_ |
| 6 | #define SHILL_MODEM_CDMA_PROXY_ |
| 7 | |
Hristo Stefanov | ed2c28c | 2011-11-29 15:37:30 -0800 | [diff] [blame] | 8 | #include <string> |
| 9 | |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 10 | #include "shill/dbus_bindings/modem-cdma.h" |
| 11 | #include "shill/dbus_properties.h" |
| 12 | #include "shill/modem_cdma_proxy_interface.h" |
| 13 | |
| 14 | namespace shill { |
| 15 | |
| 16 | class ModemCDMAProxy : public ModemCDMAProxyInterface { |
| 17 | public: |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 18 | // Constructs a ModemManager.Modem.CDMA DBus object proxy at |path| owned by |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 19 | // |service|. |
| 20 | ModemCDMAProxy(DBus::Connection *connection, |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 21 | const std::string &path, |
| 22 | const std::string &service); |
| 23 | virtual ~ModemCDMAProxy(); |
| 24 | |
| 25 | // Inherited from ModemCDMAProxyInterface. |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 26 | virtual void Activate(const std::string &carrier, Error *error, |
| 27 | const ActivationResultCallback &callback, int timeout); |
| 28 | virtual void GetRegistrationState(Error *error, |
| 29 | const RegistrationStateCallback &callback, |
| 30 | int timeout); |
| 31 | virtual void GetSignalQuality(Error *error, |
| 32 | const SignalQualityCallback &callback, |
| 33 | int timeout); |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 34 | virtual const std::string MEID(); |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 35 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 36 | virtual void set_activation_state_callback( |
| 37 | const ActivationStateSignalCallback &callback); |
| 38 | virtual void set_signal_quality_callback( |
| 39 | const SignalQualitySignalCallback &callback); |
| 40 | virtual void set_registration_state_callback( |
| 41 | const RegistrationStateSignalCallback &callback); |
| 42 | |
| 43 | public: |
| 44 | class Proxy |
| 45 | : public org::freedesktop::ModemManager::Modem::Cdma_proxy, |
| 46 | public DBus::ObjectProxy { |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 47 | public: |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 48 | Proxy(DBus::Connection *connection, |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 49 | const std::string &path, |
| 50 | const std::string &service); |
| 51 | virtual ~Proxy(); |
| 52 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 53 | void set_activation_state_callback( |
| 54 | const ActivationStateSignalCallback &callback); |
| 55 | void set_signal_quality_callback( |
| 56 | const SignalQualitySignalCallback &callback); |
| 57 | void set_registration_state_callback( |
| 58 | const RegistrationStateSignalCallback &callback); |
| 59 | |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 60 | private: |
| 61 | // Signal callbacks inherited from ModemManager::Modem::Cdma_proxy. |
| 62 | virtual void ActivationStateChanged( |
| 63 | const uint32 &activation_state, |
| 64 | const uint32 &activation_error, |
| 65 | const DBusPropertiesMap &status_changes); |
| 66 | virtual void SignalQuality(const uint32 &quality); |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 67 | virtual void RegistrationStateChanged(const uint32 &cdma_1x_state, |
| 68 | const uint32 &evdo_state); |
| 69 | |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 70 | // Method callbacks inherited from ModemManager::Modem::Cdma_proxy. |
| 71 | virtual void ActivateCallback(const uint32 &status, |
| 72 | const DBus::Error &dberror, void *data); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 73 | virtual void GetRegistrationStateCallback(const uint32 &state_1x, |
| 74 | const uint32 &state_evdo, |
| 75 | const DBus::Error &error, |
| 76 | void *data); |
| 77 | virtual void GetSignalQualityCallback(const uint32 &quality, |
| 78 | const DBus::Error &dberror, |
| 79 | void *data); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 80 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 81 | ActivationStateSignalCallback activation_state_callback_; |
| 82 | SignalQualitySignalCallback signal_quality_callback_; |
| 83 | RegistrationStateSignalCallback registration_state_callback_; |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 84 | |
| 85 | DISALLOW_COPY_AND_ASSIGN(Proxy); |
| 86 | }; |
| 87 | |
| 88 | Proxy proxy_; |
| 89 | |
| 90 | DISALLOW_COPY_AND_ASSIGN(ModemCDMAProxy); |
| 91 | }; |
| 92 | |
| 93 | } // namespace shill |
| 94 | |
| 95 | #endif // SHILL_MODEM_CDMA_PROXY_ |