blob: 43baae709690022f82b4794c5e10dfa8c5108ed3 [file] [log] [blame]
Darin Petkov096b3472012-05-15 10:26:22 +02001// 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_WIMAX_DEVICE_PROXY_H_
6#define SHILL_WIMAX_DEVICE_PROXY_H_
7
8#include <base/callback.h>
9
10#include "shill/dbus_bindings/wimax_manager-device.h"
11#include "shill/wimax_device_proxy_interface.h"
12
13namespace shill {
14
15class WiMaxDeviceProxy : public WiMaxDeviceProxyInterface {
16 public:
17 // Constructs a WiMaxManager.Device DBus object proxy at |path|.
18 WiMaxDeviceProxy(DBus::Connection *connection,
19 const DBus::Path &path);
20 virtual ~WiMaxDeviceProxy();
21
22 // Inherited from WiMaxDeviceProxyInterface.
23 virtual void Enable(Error *error,
24 const ResultCallback &callback,
25 int timeout);
26 virtual void Disable(Error *error,
27 const ResultCallback &callback,
28 int timeout);
29 virtual void Connect(Error *error,
30 const ResultCallback &callback,
31 int timeout);
32 virtual void Disconnect(Error *error,
33 const ResultCallback &callback,
34 int timeout);
35 virtual uint8 Index(Error *error);
36 virtual std::string Name(Error *error);
37
38 private:
39 class Proxy : public org::chromium::WiMaxManager::Device_proxy,
40 public DBus::ObjectProxy {
41 public:
42 Proxy(DBus::Connection *connection,
43 const DBus::Path &path);
44 virtual ~Proxy();
45
46 private:
47 // Signal callbacks inherited from WiMaxManager::Device_proxy.
48 // [None]
49
50 // Method callbacks inherited from WiMaxManager::Device_proxy.
51 virtual void EnableCallback(const DBus::Error &error, void *data);
52 virtual void DisableCallback(const DBus::Error &error, void *data);
53 virtual void ConnectCallback(const DBus::Error &error, void *data);
54 virtual void DisconnectCallback(const DBus::Error &error, void *data);
55
56 static void HandleCallback(const DBus::Error &error, void *data);
57
58 DISALLOW_COPY_AND_ASSIGN(Proxy);
59 };
60
61 void Invoke(const base::Callback<void(void *, int)> &method,
62 Error *error,
63 const ResultCallback &callback,
64 int timeout);
65
66 static void FromDBusError(const DBus::Error &dbus_error, Error *error);
67
68 Proxy proxy_;
69
70 DISALLOW_COPY_AND_ASSIGN(WiMaxDeviceProxy);
71};
72
73} // namespace shill
74
75#endif // SHILL_WIMAX_DEVICE_PROXY_H_