| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium 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 CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_NODE_CLIENT_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_NODE_CLIENT_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/callback.h" | |
| 12 #include "base/observer_list.h" | |
| 13 #include "base/values.h" | |
| 14 #include "chrome/browser/chromeos/dbus/bluetooth_property.h" | |
| 15 #include "dbus/object_path.h" | |
| 16 | |
| 17 namespace dbus { | |
| 18 class Bus; | |
| 19 } // namespace dbus | |
| 20 | |
| 21 namespace chromeos { | |
| 22 | |
| 23 class BluetoothDeviceClient; | |
| 24 | |
| 25 // BluetoothNodeClient is used to represent persistent device nodes | |
| 26 // bound to bluetooth devices, such as RFCOMM TTY bindings to ttyX devices | |
| 27 // in Linux. | |
| 28 class BluetoothNodeClient { | |
| 29 public: | |
| 30 // Structure of properties associated with persistent device nodes. | |
| 31 struct Properties : public BluetoothPropertySet { | |
| 32 // The name of the device node under /dev. Read-only. | |
| 33 BluetoothProperty<std::string> name; | |
| 34 | |
| 35 // Object path of the device the node binding belongs to. Read-only. | |
| 36 BluetoothProperty<dbus::ObjectPath> device; | |
| 37 | |
| 38 Properties(dbus::ObjectProxy* object_proxy, | |
| 39 PropertyChangedCallback callback); | |
| 40 virtual ~Properties(); | |
| 41 }; | |
| 42 | |
| 43 // Interface for observing changes from a persistent device node binding. | |
| 44 class Observer { | |
| 45 public: | |
| 46 virtual ~Observer() {} | |
| 47 | |
| 48 // Called when the node binding with object path |object_path| has a | |
| 49 // change in value of the property named |property_name|. | |
| 50 virtual void NodePropertyChanged(const dbus::ObjectPath& object_path, | |
| 51 const std::string& property_name) {} | |
| 52 }; | |
| 53 | |
| 54 virtual ~BluetoothNodeClient(); | |
| 55 | |
| 56 // Adds and removes observers for events on all persistent device node | |
| 57 // bindings. Check the |object_path| parameter of observer methods to | |
| 58 // determine which device node binding is issuing the event. | |
| 59 virtual void AddObserver(Observer* observer) = 0; | |
| 60 virtual void RemoveObserver(Observer* observer) = 0; | |
| 61 | |
| 62 // Obtain the properties for the node binding with object path |object_path|, | |
| 63 // any values should be copied if needed. | |
| 64 virtual Properties* GetProperties(const dbus::ObjectPath& object_path) = 0; | |
| 65 | |
| 66 // Creates the instance. | |
| 67 static BluetoothNodeClient* Create(dbus::Bus* bus, | |
| 68 BluetoothDeviceClient* device_client); | |
| 69 | |
| 70 protected: | |
| 71 BluetoothNodeClient(); | |
| 72 | |
| 73 private: | |
| 74 DISALLOW_COPY_AND_ASSIGN(BluetoothNodeClient); | |
| 75 }; | |
| 76 | |
| 77 } // namespace chromeos | |
| 78 | |
| 79 #endif // CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_NODE_CLIENT_H_ | |
| OLD | NEW |