blob: ed1240e93608e3a2e6502a2d0b26f6e143c93b88 [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 Shienbrood5de44ab2011-12-05 10:46:27 -050019 // |service|. Caught signals and asynchronous method replies will be
20 // dispatched to |delegate|.
Darin Petkov580c7af2011-10-24 12:32:50 +020021 ModemCDMAProxy(ModemCDMAProxyDelegate *delegate,
Darin Petkovd9661952011-08-03 16:25:42 -070022 DBus::Connection *connection,
Darin Petkovbec79a22011-08-01 14:47:17 -070023 const std::string &path,
24 const std::string &service);
25 virtual ~ModemCDMAProxy();
26
27 // Inherited from ModemCDMAProxyInterface.
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050028 virtual void Activate(const std::string &carrier,
29 AsyncCallHandler *call_handler, int timeout);
Darin Petkovbec79a22011-08-01 14:47:17 -070030 virtual void GetRegistrationState(uint32 *cdma_1x_state, uint32 *evdo_state);
Darin Petkovd9661952011-08-03 16:25:42 -070031 virtual uint32 GetSignalQuality();
Darin Petkov975b5e72011-08-30 11:48:08 -070032 virtual const std::string MEID();
Darin Petkovbec79a22011-08-01 14:47:17 -070033
34 private:
35 class Proxy : public org::freedesktop::ModemManager::Modem::Cdma_proxy,
36 public DBus::ObjectProxy {
37 public:
Darin Petkov580c7af2011-10-24 12:32:50 +020038 Proxy(ModemCDMAProxyDelegate *delegate,
Darin Petkovd9661952011-08-03 16:25:42 -070039 DBus::Connection *connection,
Darin Petkovbec79a22011-08-01 14:47:17 -070040 const std::string &path,
41 const std::string &service);
42 virtual ~Proxy();
43
44 private:
45 // Signal callbacks inherited from ModemManager::Modem::Cdma_proxy.
46 virtual void ActivationStateChanged(
47 const uint32 &activation_state,
48 const uint32 &activation_error,
49 const DBusPropertiesMap &status_changes);
50 virtual void SignalQuality(const uint32 &quality);
Darin Petkovd9661952011-08-03 16:25:42 -070051 virtual void RegistrationStateChanged(const uint32 &cdma_1x_state,
52 const uint32 &evdo_state);
53
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050054 // Method callbacks inherited from ModemManager::Modem::Cdma_proxy.
55 virtual void ActivateCallback(const uint32 &status,
56 const DBus::Error &dberror, void *data);
57
Darin Petkov580c7af2011-10-24 12:32:50 +020058 ModemCDMAProxyDelegate *delegate_;
Darin Petkovbec79a22011-08-01 14:47:17 -070059
60 DISALLOW_COPY_AND_ASSIGN(Proxy);
61 };
62
63 Proxy proxy_;
64
65 DISALLOW_COPY_AND_ASSIGN(ModemCDMAProxy);
66};
67
68} // namespace shill
69
70#endif // SHILL_MODEM_CDMA_PROXY_