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

Side by Side Diff: device/bluetooth/bluetooth_remote_gatt_service_chromeos.h

Issue 264053004: device/bluetooth: Improvements to GATT descriptor access API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pull & rebase. Created 6 years, 7 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 DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "chromeos/dbus/bluetooth_gatt_characteristic_client.h" 14 #include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
15 #include "chromeos/dbus/bluetooth_gatt_service_client.h" 15 #include "chromeos/dbus/bluetooth_gatt_service_client.h"
16 #include "dbus/object_path.h" 16 #include "dbus/object_path.h"
17 #include "device/bluetooth/bluetooth_gatt_service.h" 17 #include "device/bluetooth/bluetooth_gatt_service.h"
18 #include "device/bluetooth/bluetooth_uuid.h" 18 #include "device/bluetooth/bluetooth_uuid.h"
19 19
20 namespace device { 20 namespace device {
21 21
22 class BluetoothGattCharacteristic; 22 class BluetoothGattCharacteristic;
23 23
24 } // namespace device 24 } // namespace device
25 25
26 namespace chromeos { 26 namespace chromeos {
27 27
28 class BluetoothDeviceChromeOS; 28 class BluetoothDeviceChromeOS;
29 class BluetoothRemoteGattCharacteristicChromeOS; 29 class BluetoothRemoteGattCharacteristicChromeOS;
30 class BluetoothRemoteGattDescriptorChromeOS;
30 31
31 // The BluetoothRemoteGattServiceChromeOS class implements BluetootGattService 32 // The BluetoothRemoteGattServiceChromeOS class implements BluetootGattService
32 // for remote GATT services on the the Chrome OS platform. 33 // for remote GATT services on the the Chrome OS platform.
33 class BluetoothRemoteGattServiceChromeOS 34 class BluetoothRemoteGattServiceChromeOS
34 : public device::BluetoothGattService, 35 : public device::BluetoothGattService,
35 public BluetoothGattServiceClient::Observer, 36 public BluetoothGattServiceClient::Observer,
36 public BluetoothGattCharacteristicClient::Observer { 37 public BluetoothGattCharacteristicClient::Observer {
37 public: 38 public:
38 // device::BluetoothGattService overrides. 39 // device::BluetoothGattService overrides.
39 virtual void AddObserver( 40 virtual void AddObserver(
(...skipping 21 matching lines...) Expand all
61 const ErrorCallback& error_callback) OVERRIDE; 62 const ErrorCallback& error_callback) OVERRIDE;
62 63
63 // Object path of the underlying service. 64 // Object path of the underlying service.
64 const dbus::ObjectPath& object_path() const { return object_path_; } 65 const dbus::ObjectPath& object_path() const { return object_path_; }
65 66
66 // Notifies its observers that the GATT service has changed. This is mainly 67 // Notifies its observers that the GATT service has changed. This is mainly
67 // used by BluetoothRemoteGattCharacteristicChromeOS instances to notify 68 // used by BluetoothRemoteGattCharacteristicChromeOS instances to notify
68 // service observers when characteristic descriptors get added and removed. 69 // service observers when characteristic descriptors get added and removed.
69 void NotifyServiceChanged(); 70 void NotifyServiceChanged();
70 71
72 // Notifies its observers that a descriptor |descriptor| belonging to
73 // characteristic |characteristic| has been added or removed. This is used
74 // by BluetoothRemoteGattCharacteristicChromeOS instances to notify service
75 // observers when characteristic descriptors get added and removed. If |added|
76 // is true, an "Added" event will be sent. Otherwise, a "Removed" event will
77 // be sent.
78 void NotifyDescriptorAddedOrRemoved(
79 BluetoothRemoteGattCharacteristicChromeOS* characteristic,
80 BluetoothRemoteGattDescriptorChromeOS* descriptor,
81 bool added);
82
83 // Notifies its observers that the value of a descriptor has changed. Called
84 // by BluetoothRemoteGattCharacteristicChromeOS instances to notify service
85 // observers when the value of one of their descriptors gets updated.
86 void NotifyDescriptorValueChanged(
87 BluetoothRemoteGattCharacteristicChromeOS* characteristic,
88 BluetoothRemoteGattDescriptorChromeOS* descriptor,
89 const std::vector<uint8>& value);
90
71 private: 91 private:
72 friend class BluetoothDeviceChromeOS; 92 friend class BluetoothDeviceChromeOS;
73 93
74 BluetoothRemoteGattServiceChromeOS(BluetoothDeviceChromeOS* device, 94 BluetoothRemoteGattServiceChromeOS(BluetoothDeviceChromeOS* device,
75 const dbus::ObjectPath& object_path); 95 const dbus::ObjectPath& object_path);
76 virtual ~BluetoothRemoteGattServiceChromeOS(); 96 virtual ~BluetoothRemoteGattServiceChromeOS();
77 97
78 // BluetoothGattServiceClient::Observer override. 98 // BluetoothGattServiceClient::Observer override.
79 virtual void GattServicePropertyChanged( 99 virtual void GattServicePropertyChanged(
80 const dbus::ObjectPath& object_path, 100 const dbus::ObjectPath& object_path,
(...skipping 28 matching lines...) Expand all
109 // Note: This should remain the last member so it'll be destroyed and 129 // Note: This should remain the last member so it'll be destroyed and
110 // invalidate its weak pointers before any other members are destroyed. 130 // invalidate its weak pointers before any other members are destroyed.
111 base::WeakPtrFactory<BluetoothRemoteGattServiceChromeOS> weak_ptr_factory_; 131 base::WeakPtrFactory<BluetoothRemoteGattServiceChromeOS> weak_ptr_factory_;
112 132
113 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceChromeOS); 133 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceChromeOS);
114 }; 134 };
115 135
116 } // namespace chromeos 136 } // namespace chromeos
117 137
118 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ 138 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698