Darin Petkov | 63138a9 | 2012-02-06 14:09:15 +0100 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 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" |
Darin Petkov | 4a09b6b | 2011-07-19 12:52:06 -0700 | [diff] [blame] | 15 | #include "shill/dbus_bindings/flimflam-device.h" |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 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: |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 29 | static const char kPath[]; |
| 30 | |
Chris Masone | ec6b18b | 2011-06-08 14:09:10 -0700 | [diff] [blame] | 31 | DeviceDBusAdaptor(DBus::Connection* conn, Device *device); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 32 | virtual ~DeviceDBusAdaptor(); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 33 | |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 34 | // Implementation of DeviceAdaptorInterface. |
Chris Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 35 | virtual const std::string &GetRpcIdentifier(); |
| 36 | virtual const std::string &GetRpcConnectionIdentifier(); |
| 37 | virtual void UpdateEnabled(); |
| 38 | virtual void EmitBoolChanged(const std::string& name, bool value); |
| 39 | virtual void EmitUintChanged(const std::string& name, uint32 value); |
| 40 | virtual void EmitIntChanged(const std::string& name, int value); |
| 41 | virtual void EmitStringChanged(const std::string& name, |
| 42 | const std::string& value); |
Darin Petkov | 3cfbf21 | 2011-11-21 16:02:09 +0100 | [diff] [blame] | 43 | virtual void EmitStringmapsChanged(const std::string &name, |
| 44 | const Stringmaps &value); |
Darin Petkov | 63138a9 | 2012-02-06 14:09:15 +0100 | [diff] [blame] | 45 | virtual void EmitKeyValueStoreChanged(const std::string &name, |
| 46 | const KeyValueStore &value); |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 47 | |
| 48 | // Implementation of Device_adaptor. |
Darin Petkov | 9ae310f | 2011-08-30 15:41:13 -0700 | [diff] [blame] | 49 | virtual std::map<std::string, ::DBus::Variant> GetProperties( |
| 50 | ::DBus::Error &error); |
| 51 | virtual void SetProperty(const std::string& name, |
| 52 | const ::DBus::Variant& value, |
| 53 | ::DBus::Error &error); |
| 54 | virtual void ClearProperty(const std::string& , ::DBus::Error &error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 55 | virtual void Enable(::DBus::Error &error); |
| 56 | virtual void Disable(::DBus::Error &error); |
Darin Petkov | 9ae310f | 2011-08-30 15:41:13 -0700 | [diff] [blame] | 57 | virtual void ProposeScan(::DBus::Error &error); |
| 58 | virtual ::DBus::Path AddIPConfig(const std::string& , ::DBus::Error &error); |
| 59 | virtual void Register(const std::string &network_id, ::DBus::Error &error); |
Darin Petkov | e42e101 | 2011-08-31 12:35:04 -0700 | [diff] [blame] | 60 | virtual void RequirePin(const std::string &pin, |
| 61 | const bool &require, |
Darin Petkov | 9ae310f | 2011-08-30 15:41:13 -0700 | [diff] [blame] | 62 | ::DBus::Error &error); |
Darin Petkov | e42e101 | 2011-08-31 12:35:04 -0700 | [diff] [blame] | 63 | virtual void EnterPin(const std::string &pin, ::DBus::Error &error); |
| 64 | virtual void UnblockPin(const std::string &unblock_code, |
| 65 | const std::string &pin, |
Darin Petkov | 9ae310f | 2011-08-30 15:41:13 -0700 | [diff] [blame] | 66 | ::DBus::Error &error); |
Darin Petkov | e42e101 | 2011-08-31 12:35:04 -0700 | [diff] [blame] | 67 | virtual void ChangePin(const std::string &old_pin, |
| 68 | const std::string &new_pin, |
Darin Petkov | 9ae310f | 2011-08-30 15:41:13 -0700 | [diff] [blame] | 69 | ::DBus::Error &error); |
Ben Chan | ad663e1 | 2013-01-08 01:58:47 -0800 | [diff] [blame] | 70 | virtual void Reset(::DBus::Error &error); |
Paul Stewart | 6ff27f5 | 2012-07-11 06:51:41 -0700 | [diff] [blame] | 71 | virtual void ResetByteCounters(::DBus::Error &error); |
Darin Petkov | c37a9c4 | 2012-09-06 15:28:22 +0200 | [diff] [blame] | 72 | virtual void SetCarrier(const std::string &carrier, ::DBus::Error &error); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 73 | |
| 74 | private: |
Chris Masone | ec6b18b | 2011-06-08 14:09:10 -0700 | [diff] [blame] | 75 | Device *device_; |
Chris Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 76 | const std::string connection_name_; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 77 | DISALLOW_COPY_AND_ASSIGN(DeviceDBusAdaptor); |
| 78 | }; |
| 79 | |
| 80 | } // namespace shill |
| 81 | #endif // SHILL_DEVICE_DBUS_ADAPTOR_H_ |