1// 2// Copyright (C) 2015 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17#ifndef APMANAGER_DEVICE_DBUS_ADAPTOR_H_ 18#define APMANAGER_DEVICE_DBUS_ADAPTOR_H_ 19 20#include <base/macros.h> 21 22#include <dbus_bindings/org.chromium.apmanager.Device.h> 23 24#include "apmanager/device_adaptor_interface.h" 25 26namespace apmanager { 27 28class Device; 29 30class DeviceDBusAdaptor : public org::chromium::apmanager::DeviceInterface, 31 public DeviceAdaptorInterface { 32 public: 33 DeviceDBusAdaptor(const scoped_refptr<dbus::Bus>& bus, 34 brillo::dbus_utils::ExportedObjectManager* object_manager, 35 Device* device); 36 ~DeviceDBusAdaptor() override; 37 38 // Implementation of DeviceAdaptorInterface. 39 void SetDeviceName(const std::string& device_name) override; 40 std::string GetDeviceName() override; 41 void SetInUse(bool in_use) override; 42 bool GetInUse() override; 43 void SetPreferredApInterface(const std::string& interface_name) override; 44 std::string GetPreferredApInterface() override; 45 46 private: 47 org::chromium::apmanager::DeviceAdaptor adaptor_; 48 dbus::ObjectPath object_path_; 49 brillo::dbus_utils::DBusObject dbus_object_; 50 51 DISALLOW_COPY_AND_ASSIGN(DeviceDBusAdaptor); 52}; 53 54} // namespace apmanager 55 56#endif // APMANAGER_DEVICE_DBUS_ADAPTOR_H_ 57