Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 1 | // 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_DEVICE_DBUS_ADAPTOR_H_ |
| 6 | #define SHILL_DEVICE_DBUS_ADAPTOR_H_ |
| 7 | |
| 8 | #include <map> |
| 9 | #include <string> |
| 10 | |
| 11 | #include <base/basictypes.h> |
| 12 | |
| 13 | #include "shill/adaptor_interfaces.h" |
| 14 | #include "shill/dbus_adaptor.h" |
| 15 | #include "shill/flimflam-device.h" |
| 16 | |
| 17 | namespace shill { |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 18 | |
Chris Masone | ec6b18b | 2011-06-08 14:09:10 -0700 | [diff] [blame] | 19 | class Device; |
| 20 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 21 | // Subclass of DBusAdaptor for Device objects |
Chris Masone | ec6b18b | 2011-06-08 14:09:10 -0700 | [diff] [blame] | 22 | // There is a 1:1 mapping between Device and DeviceDBusAdaptor instances. |
| 23 | // Furthermore, the Device owns the DeviceDBusAdaptor and manages its lifetime, |
| 24 | // so we're OK with DeviceDBusAdaptor having a bare pointer to its owner device. |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 25 | class DeviceDBusAdaptor : public org::chromium::flimflam::Device_adaptor, |
| 26 | public DBusAdaptor, |
| 27 | public DeviceAdaptorInterface { |
| 28 | public: |
| 29 | static const char kInterfaceName[]; |
| 30 | static const char kPath[]; |
| 31 | |
Chris Masone | ec6b18b | 2011-06-08 14:09:10 -0700 | [diff] [blame] | 32 | DeviceDBusAdaptor(DBus::Connection* conn, Device *device); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 33 | virtual ~DeviceDBusAdaptor(); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 34 | |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 35 | // Implementation of DeviceAdaptorInterface. |
| 36 | void UpdateEnabled(); |
| 37 | void EmitBoolChanged(const std::string& name, bool value); |
| 38 | void EmitUintChanged(const std::string& name, uint32 value); |
| 39 | void EmitIntChanged(const std::string& name, int value); |
| 40 | void EmitStringChanged(const std::string& name, const std::string& value); |
| 41 | |
| 42 | // Implementation of Device_adaptor. |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 43 | std::map<std::string, ::DBus::Variant> GetProperties(::DBus::Error &error); |
| 44 | void SetProperty(const std::string& , |
| 45 | const ::DBus::Variant& , |
| 46 | ::DBus::Error &error); |
Chris Masone | ccc8881 | 2011-06-08 18:00:10 -0700 | [diff] [blame^] | 47 | void ClearProperty(const std::string& , ::DBus::Error &error); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 48 | void ProposeScan(::DBus::Error &error); |
| 49 | ::DBus::Path AddIPConfig(const std::string& , ::DBus::Error &error); |
Chris Masone | ccc8881 | 2011-06-08 18:00:10 -0700 | [diff] [blame^] | 50 | void Register(const std::string& , ::DBus::Error &error); |
| 51 | void RequirePin(const std::string& , const bool& , ::DBus::Error &error); |
| 52 | void EnterPin(const std::string& , ::DBus::Error &error); |
| 53 | void UnblockPin(const std::string& , |
| 54 | const std::string& , |
| 55 | ::DBus::Error &error); |
| 56 | void ChangePin(const std::string& , |
| 57 | const std::string& , |
| 58 | ::DBus::Error &error); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 59 | |
| 60 | private: |
Chris Masone | ec6b18b | 2011-06-08 14:09:10 -0700 | [diff] [blame] | 61 | Device *device_; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 62 | DISALLOW_COPY_AND_ASSIGN(DeviceDBusAdaptor); |
| 63 | }; |
| 64 | |
| 65 | } // namespace shill |
| 66 | #endif // SHILL_DEVICE_DBUS_ADAPTOR_H_ |