Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Side by Side Diff: chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h

Issue 309623002: device/bluetooth: Update GATT descriptor value D-Bus bindings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed clang error Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_ 6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 28 matching lines...) Expand all
39 39
40 // DBusClient override. 40 // DBusClient override.
41 virtual void Init(dbus::Bus* bus) OVERRIDE; 41 virtual void Init(dbus::Bus* bus) OVERRIDE;
42 42
43 // BluetoothGattDescriptorClient overrides. 43 // BluetoothGattDescriptorClient overrides.
44 virtual void AddObserver(Observer* observer) OVERRIDE; 44 virtual void AddObserver(Observer* observer) OVERRIDE;
45 virtual void RemoveObserver(Observer* observer) OVERRIDE; 45 virtual void RemoveObserver(Observer* observer) OVERRIDE;
46 virtual std::vector<dbus::ObjectPath> GetDescriptors() OVERRIDE; 46 virtual std::vector<dbus::ObjectPath> GetDescriptors() OVERRIDE;
47 virtual Properties* GetProperties(const dbus::ObjectPath& object_path) 47 virtual Properties* GetProperties(const dbus::ObjectPath& object_path)
48 OVERRIDE; 48 OVERRIDE;
49 virtual void ReadValue(const dbus::ObjectPath& object_path,
50 const ValueCallback& callback,
51 const ErrorCallback& error_callback) OVERRIDE;
52 virtual void WriteValue(const dbus::ObjectPath& object_path,
53 const std::vector<uint8>& value,
54 const base::Closure& callback,
55 const ErrorCallback& error_callback) OVERRIDE;
49 56
50 // Makes the descriptor with the UUID |uuid| visible under the characteristic 57 // Makes the descriptor with the UUID |uuid| visible under the characteristic
51 // with object path |characteristic_path|. Descriptor object paths are 58 // with object path |characteristic_path|. Descriptor object paths are
52 // hierarchical to their characteristics. |uuid| must belong to a descriptor 59 // hierarchical to their characteristics. |uuid| must belong to a descriptor
53 // for which there is a constant defined below, otherwise this method has no 60 // for which there is a constant defined below, otherwise this method has no
54 // effect. Returns the object path of the created descriptor. In the no-op 61 // effect. Returns the object path of the created descriptor. In the no-op
55 // case, returns an invalid path. 62 // case, returns an invalid path.
56 dbus::ObjectPath ExposeDescriptor(const dbus::ObjectPath& characteristic_path, 63 dbus::ObjectPath ExposeDescriptor(const dbus::ObjectPath& characteristic_path,
57 const std::string& uuid); 64 const std::string& uuid);
58 void HideDescriptor(const dbus::ObjectPath& descriptor_path); 65 void HideDescriptor(const dbus::ObjectPath& descriptor_path);
59 66
60 // Object path components and UUIDs of GATT characteristic descriptors. 67 // Object path components and UUIDs of GATT characteristic descriptors.
61 static const char kClientCharacteristicConfigurationPathComponent[]; 68 static const char kClientCharacteristicConfigurationPathComponent[];
62 static const char kClientCharacteristicConfigurationUUID[]; 69 static const char kClientCharacteristicConfigurationUUID[];
63 70
64 private: 71 private:
65 // Property callback passed when we create Properties structures. 72 // Property callback passed when we create Properties structures.
66 void OnPropertyChanged(const dbus::ObjectPath& object_path, 73 void OnPropertyChanged(const dbus::ObjectPath& object_path,
67 const std::string& property_name); 74 const std::string& property_name);
68 75
69 // Notifies observers. 76 // Notifies observers.
70 void NotifyDescriptorAdded(const dbus::ObjectPath& object_path); 77 void NotifyDescriptorAdded(const dbus::ObjectPath& object_path);
71 void NotifyDescriptorRemoved(const dbus::ObjectPath& object_path); 78 void NotifyDescriptorRemoved(const dbus::ObjectPath& object_path);
72 79
73 // Mapping from object paths to Properties structures. 80 // Mapping from object paths to Properties structures.
74 typedef std::map<dbus::ObjectPath, Properties*> PropertiesMap; 81 struct DescriptorData {
82 DescriptorData();
83 ~DescriptorData();
84
85 scoped_ptr<Properties> properties;
86 std::vector<uint8> value;
87 };
88 typedef std::map<dbus::ObjectPath, DescriptorData*> PropertiesMap;
75 PropertiesMap properties_; 89 PropertiesMap properties_;
76 90
77 // List of observers interested in event notifications from us. 91 // List of observers interested in event notifications from us.
78 ObserverList<Observer> observers_; 92 ObserverList<Observer> observers_;
79 93
80 // Weak pointer factory for generating 'this' pointers that might live longer 94 // Weak pointer factory for generating 'this' pointers that might live longer
81 // than we do. 95 // than we do.
82 // Note: This should remain the last member so it'll be destroyed and 96 // Note: This should remain the last member so it'll be destroyed and
83 // invalidate its weak pointers before any other members are destroyed. 97 // invalidate its weak pointers before any other members are destroyed.
84 base::WeakPtrFactory<FakeBluetoothGattDescriptorClient> 98 base::WeakPtrFactory<FakeBluetoothGattDescriptorClient>
85 weak_ptr_factory_; 99 weak_ptr_factory_;
86 100
87 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattDescriptorClient); 101 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattDescriptorClient);
88 }; 102 };
89 103
90 } // namespace chromeos 104 } // namespace chromeos
91 105
92 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_ 106 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/bluetooth_gatt_descriptor_client.cc ('k') | chromeos/dbus/fake_bluetooth_gatt_descriptor_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698