blob: 7b5bdecb12e43197a747118754c0b436406c9bf7 [file] [log] [blame]
Darin Petkove9d12e02011-07-27 15:09:37 -07001// Copyright (c) 2011 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_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
Darin Petkovc5f56562011-08-06 16:40:05 -070017// A proxy to 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
Darin Petkov580c7af2011-10-24 12:32:50 +020021 // |service|. Caught signals will be dispatched to |delegate|.
22 ModemProxy(ModemProxyDelegate *delegate,
Darin Petkovc5f56562011-08-06 16:40:05 -070023 DBus::Connection *connection,
Darin Petkove9d12e02011-07-27 15:09:37 -070024 const std::string &path,
25 const std::string &service);
26 virtual ~ModemProxy();
27
28 // Inherited from ModemProxyInterface.
29 virtual void Enable(const bool enable);
Darin Petkovceb68172011-07-29 14:47:48 -070030 virtual Info GetInfo();
Darin Petkove9d12e02011-07-27 15:09:37 -070031
32 private:
33 class Proxy : public org::freedesktop::ModemManager::Modem_proxy,
34 public DBus::ObjectProxy {
35 public:
Darin Petkov580c7af2011-10-24 12:32:50 +020036 Proxy(ModemProxyDelegate *delegate,
Darin Petkovc5f56562011-08-06 16:40:05 -070037 DBus::Connection *connection,
Darin Petkove9d12e02011-07-27 15:09:37 -070038 const std::string &path,
39 const std::string &service);
40 virtual ~Proxy();
41
42 private:
43 // Signal callbacks inherited from ModemManager::Modem_proxy.
Darin Petkov1ec741c2011-08-02 10:45:27 -070044 virtual void StateChanged(const uint32 &old,
45 const uint32 &_new,
Darin Petkove9d12e02011-07-27 15:09:37 -070046 const uint32 &reason);
47
Darin Petkov580c7af2011-10-24 12:32:50 +020048 ModemProxyDelegate *delegate_;
Darin Petkovc5f56562011-08-06 16:40:05 -070049
Darin Petkove9d12e02011-07-27 15:09:37 -070050 DISALLOW_COPY_AND_ASSIGN(Proxy);
51 };
52
53 Proxy proxy_;
54
55 DISALLOW_COPY_AND_ASSIGN(ModemProxy);
56};
57
58} // namespace shill
59
60#endif // SHILL_MODEM_PROXY_