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