blob: 10a046eab7dc8f1e1a848ef6c5086e967609bdc2 [file] [log] [blame]
Darin Petkovfb0625e2012-01-16 13:05:56 +01001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Darin Petkove9d12e02011-07-27 15:09:37 -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_PROXY_
6#define SHILL_MODEM_PROXY_
7
Hristo Stefanoved2c28c2011-11-29 15:37:30 -08008#include <string>
9
Darin Petkove9d12e02011-07-27 15:09:37 -070010#include <base/basictypes.h>
11
12#include "shill/dbus_bindings/modem.h"
13#include "shill/modem_proxy_interface.h"
14
15namespace shill {
16
mukesh agrawalf407d592013-07-31 11:37:57 -070017// A proxy to (old) ModemManager.Modem.
Darin Petkove9d12e02011-07-27 15:09:37 -070018class ModemProxy : public ModemProxyInterface {
19 public:
Darin Petkovc5f56562011-08-06 16:40:05 -070020 // Constructs a ModemManager.Modem DBus object proxy at |path| owned by
Eric Shienbrood9a245532012-03-07 14:20:39 -050021 // |service|.
22 ModemProxy(DBus::Connection *connection,
Darin Petkove9d12e02011-07-27 15:09:37 -070023 const std::string &path,
24 const std::string &service);
25 virtual ~ModemProxy();
26
27 // Inherited from ModemProxyInterface.
Eric Shienbrood9a245532012-03-07 14:20:39 -050028 virtual void Enable(bool enable, Error *error,
29 const ResultCallback &callback, int timeout);
30 virtual void Disconnect(Error *error, const ResultCallback &callback,
31 int timeout);
32 virtual void GetModemInfo(Error *error, const ModemInfoCallback &callback,
33 int timeout);
34
35 virtual void set_state_changed_callback(
36 const ModemStateChangedSignalCallback &callback);
Darin Petkove9d12e02011-07-27 15:09:37 -070037
38 private:
39 class Proxy : public org::freedesktop::ModemManager::Modem_proxy,
40 public DBus::ObjectProxy {
41 public:
Eric Shienbrood9a245532012-03-07 14:20:39 -050042 Proxy(DBus::Connection *connection,
Darin Petkove9d12e02011-07-27 15:09:37 -070043 const std::string &path,
44 const std::string &service);
45 virtual ~Proxy();
46
Eric Shienbrood9a245532012-03-07 14:20:39 -050047 void set_state_changed_callback(
48 const ModemStateChangedSignalCallback &callback);
49
Darin Petkove9d12e02011-07-27 15:09:37 -070050 private:
51 // Signal callbacks inherited from ModemManager::Modem_proxy.
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050052 virtual void StateChanged(
53 const uint32 &old, const uint32 &_new, const uint32 &reason);
54
55 // Method callbacks inherited from ModemManager::Modem_proxy.
56 virtual void EnableCallback(const DBus::Error &dberror, void *data);
57 virtual void GetInfoCallback(const ModemHardwareInfo &info,
58 const DBus::Error &dberror, void *data);
59 virtual void DisconnectCallback(const DBus::Error &dberror, void *data);
Darin Petkove9d12e02011-07-27 15:09:37 -070060
Eric Shienbrood9a245532012-03-07 14:20:39 -050061 ModemStateChangedSignalCallback state_changed_callback_;
Darin Petkovc5f56562011-08-06 16:40:05 -070062
Darin Petkove9d12e02011-07-27 15:09:37 -070063 DISALLOW_COPY_AND_ASSIGN(Proxy);
64 };
65
66 Proxy proxy_;
67
68 DISALLOW_COPY_AND_ASSIGN(ModemProxy);
69};
70
71} // namespace shill
72
73#endif // SHILL_MODEM_PROXY_