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 | |
Paul Stewart | 28fbfdf | 2011-05-31 09:37:38 -0700 | [diff] [blame] | 5 | #include "shill/device.h" |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 6 | #include "shill/device_dbus_adaptor.h" |
| 7 | |
| 8 | #include <map> |
| 9 | #include <string> |
| 10 | |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 11 | #include "shill/device.h" |
Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame^] | 12 | #include "shill/error.h" |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 13 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 14 | using std::map; |
| 15 | using std::string; |
| 16 | |
| 17 | namespace shill { |
| 18 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 19 | // static |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 20 | const char DeviceDBusAdaptor::kInterfaceName[] = SHILL_INTERFACE; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 21 | // static |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 22 | const char DeviceDBusAdaptor::kPath[] = "/device/"; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 23 | |
Chris Masone | ec6b18b | 2011-06-08 14:09:10 -0700 | [diff] [blame] | 24 | DeviceDBusAdaptor::DeviceDBusAdaptor(DBus::Connection* conn, Device *device) |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 25 | : DBusAdaptor(conn, kPath + device->UniqueName()), |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 26 | device_(device) { |
| 27 | } |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 28 | |
Chris Masone | ec6b18b | 2011-06-08 14:09:10 -0700 | [diff] [blame] | 29 | DeviceDBusAdaptor::~DeviceDBusAdaptor() { |
| 30 | device_ = NULL; |
| 31 | } |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 32 | |
| 33 | void DeviceDBusAdaptor::UpdateEnabled() {} |
| 34 | |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 35 | void DeviceDBusAdaptor::EmitBoolChanged(const std::string& name, bool value) { |
| 36 | PropertyChanged(name, DBusAdaptor::BoolToVariant(value)); |
| 37 | } |
| 38 | |
| 39 | void DeviceDBusAdaptor::EmitUintChanged(const std::string& name, uint32 value) { |
Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame^] | 40 | PropertyChanged(name, DBusAdaptor::Uint32ToVariant(value)); |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | void DeviceDBusAdaptor::EmitIntChanged(const std::string& name, int value) { |
Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame^] | 44 | PropertyChanged(name, DBusAdaptor::Int32ToVariant(value)); |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | void DeviceDBusAdaptor::EmitStringChanged(const std::string& name, |
| 48 | const std::string& value) { |
| 49 | PropertyChanged(name, DBusAdaptor::StringToVariant(value)); |
| 50 | } |
| 51 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 52 | map<string, ::DBus::Variant> DeviceDBusAdaptor::GetProperties( |
| 53 | ::DBus::Error &error) { |
| 54 | return map<string, ::DBus::Variant>(); |
| 55 | } |
| 56 | |
Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame^] | 57 | void DeviceDBusAdaptor::SetProperty(const string& name, |
| 58 | const ::DBus::Variant& value, |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 59 | ::DBus::Error &error) { |
Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame^] | 60 | DBusAdaptor::DispatchOnType(device_, name, value, error); |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 61 | } |
| 62 | |
Chris Masone | ccc8881 | 2011-06-08 18:00:10 -0700 | [diff] [blame] | 63 | void DeviceDBusAdaptor::ClearProperty(const std::string& , |
| 64 | ::DBus::Error &error) { |
| 65 | } |
| 66 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 67 | void DeviceDBusAdaptor::ProposeScan(::DBus::Error &error) { |
| 68 | } |
| 69 | |
| 70 | ::DBus::Path DeviceDBusAdaptor::AddIPConfig(const string& , |
| 71 | ::DBus::Error &error) { |
| 72 | return ::DBus::Path(); |
| 73 | } |
| 74 | |
Chris Masone | ccc8881 | 2011-06-08 18:00:10 -0700 | [diff] [blame] | 75 | void DeviceDBusAdaptor::Register(const std::string& , ::DBus::Error &error) { |
| 76 | } |
| 77 | |
| 78 | void DeviceDBusAdaptor::RequirePin(const std::string& , |
| 79 | const bool& , |
| 80 | ::DBus::Error &error) { |
| 81 | } |
| 82 | |
| 83 | void DeviceDBusAdaptor::EnterPin(const std::string& , ::DBus::Error &error) { |
| 84 | } |
| 85 | |
| 86 | void DeviceDBusAdaptor::UnblockPin(const std::string& , |
| 87 | const std::string& , |
| 88 | ::DBus::Error &error) { |
| 89 | } |
| 90 | |
| 91 | void DeviceDBusAdaptor::ChangePin(const std::string& , |
| 92 | const std::string& , |
| 93 | ::DBus::Error &error) { |
| 94 | } |
| 95 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 96 | } // namespace shill |