blob: 1c9922d7e0c4036919a929f3baac55a9a4c8eb07 [file] [log] [blame]
Eric Shienbrood5de44ab2011-12-05 10:46:27 -05001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Darin Petkovbec79a22011-08-01 14:47:17 -07002// 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 Stefanoved2c28c2011-11-29 15:37:30 -08008#include <string>
9
Darin Petkovbec79a22011-08-01 14:47:17 -070010#include "shill/dbus_bindings/modem-cdma.h"
11#include "shill/dbus_properties.h"
12#include "shill/modem_cdma_proxy_interface.h"
13
14namespace shill {
15
16class ModemCDMAProxy : public ModemCDMAProxyInterface {
17 public:
Darin Petkovd9661952011-08-03 16:25:42 -070018 // Constructs a ModemManager.Modem.CDMA DBus object proxy at |path| owned by
Eric Shienbrood9a245532012-03-07 14:20:39 -050019 // |service|.
20 ModemCDMAProxy(DBus::Connection *connection,
Darin Petkovbec79a22011-08-01 14:47:17 -070021 const std::string &path,
22 const std::string &service);
23 virtual ~ModemCDMAProxy();
24
25 // Inherited from ModemCDMAProxyInterface.
Eric Shienbrood9a245532012-03-07 14:20:39 -050026 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 Petkov975b5e72011-08-30 11:48:08 -070034 virtual const std::string MEID();
Darin Petkovbec79a22011-08-01 14:47:17 -070035
Eric Shienbrood9a245532012-03-07 14:20:39 -050036 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 Petkovbec79a22011-08-01 14:47:17 -070047 public:
Eric Shienbrood9a245532012-03-07 14:20:39 -050048 Proxy(DBus::Connection *connection,
Darin Petkovbec79a22011-08-01 14:47:17 -070049 const std::string &path,
50 const std::string &service);
51 virtual ~Proxy();
52
Eric Shienbrood9a245532012-03-07 14:20:39 -050053 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 Petkovbec79a22011-08-01 14:47:17 -070060 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 Petkovd9661952011-08-03 16:25:42 -070067 virtual void RegistrationStateChanged(const uint32 &cdma_1x_state,
68 const uint32 &evdo_state);
69
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050070 // Method callbacks inherited from ModemManager::Modem::Cdma_proxy.
71 virtual void ActivateCallback(const uint32 &status,
72 const DBus::Error &dberror, void *data);
Eric Shienbrood9a245532012-03-07 14:20:39 -050073 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 Shienbrood5de44ab2011-12-05 10:46:27 -050080
Eric Shienbrood9a245532012-03-07 14:20:39 -050081 ActivationStateSignalCallback activation_state_callback_;
82 SignalQualitySignalCallback signal_quality_callback_;
83 RegistrationStateSignalCallback registration_state_callback_;
Darin Petkovbec79a22011-08-01 14:47:17 -070084
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_