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

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

Issue 1100483005: bluetooth: Refactor device/bluetooth for C++ Style: typedef ordering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typedefs for all of src/device/bluetooth Created 5 years, 8 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
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_GATT_DESCRIPTOR_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "device/bluetooth/bluetooth_export.h" 12 #include "device/bluetooth/bluetooth_export.h"
13 #include "device/bluetooth/bluetooth_gatt_characteristic.h" 13 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
14 #include "device/bluetooth/bluetooth_uuid.h" 14 #include "device/bluetooth/bluetooth_uuid.h"
15 15
16 namespace device { 16 namespace device {
17 17
18 // BluetoothGattDescriptor represents a local or remote GATT characteristic 18 // BluetoothGattDescriptor represents a local or remote GATT characteristic
19 // descriptor. A GATT characteristic descriptor provides further information 19 // descriptor. A GATT characteristic descriptor provides further information
20 // about a characteristic's value. They can be used to describe the 20 // about a characteristic's value. They can be used to describe the
21 // characteristic's features or to control certain behaviors. 21 // characteristic's features or to control certain behaviors.
22 class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptor { 22 class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptor {
23 public: 23 public:
24 // The ErrorCallback is used by methods to asynchronously report errors.
25 typedef base::Callback<void(BluetoothGattService::GattErrorCode)>
26 ErrorCallback;
27
28 // The ValueCallback is used to return the value of a remote characteristic
29 // descriptor upon a read request.
30 typedef base::Callback<void(const std::vector<uint8>&)> ValueCallback;
31
24 // The Bluetooth Specification declares several predefined descriptors that 32 // The Bluetooth Specification declares several predefined descriptors that
25 // profiles can use. The following are definitions for the list of UUIDs 33 // profiles can use. The following are definitions for the list of UUIDs
26 // and descriptions of the characteristic descriptors that they represent. 34 // and descriptions of the characteristic descriptors that they represent.
27 // Possible values for and further information on each descriptor can be found 35 // Possible values for and further information on each descriptor can be found
28 // in Core v4.0, Volume 3, Part G, Section 3.3.3. All of these descriptors are 36 // in Core v4.0, Volume 3, Part G, Section 3.3.3. All of these descriptors are
29 // optional and may not be present for a given characteristic. 37 // optional and may not be present for a given characteristic.
30 38
31 // The "Characteristic Extended Properties" descriptor. This defines 39 // The "Characteristic Extended Properties" descriptor. This defines
32 // additional "Characteristic Properties" which cannot fit into the allocated 40 // additional "Characteristic Properties" which cannot fit into the allocated
33 // single octet property field of a characteristic. The value is a bit field 41 // single octet property field of a characteristic. The value is a bit field
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // "Characteristic Presentation Format" descriptors belong to a 107 // "Characteristic Presentation Format" descriptors belong to a
100 // characteristic. 108 // characteristic.
101 // The API will construct a BluetoothGattDescriptor object for each instance 109 // The API will construct a BluetoothGattDescriptor object for each instance
102 // of "Characteristic Presentation Format" descriptor per instance of 110 // of "Characteristic Presentation Format" descriptor per instance of
103 // BluetoothGattCharacteristic that represents a remote characteristic. 111 // BluetoothGattCharacteristic that represents a remote characteristic.
104 // Similarly for local characteristics, implementations DO NOT need to create 112 // Similarly for local characteristics, implementations DO NOT need to create
105 // an instance of BluetoothGattDescriptor for this descriptor as this will be 113 // an instance of BluetoothGattDescriptor for this descriptor as this will be
106 // handled by the subsystem. 114 // handled by the subsystem.
107 static const BluetoothUUID& CharacteristicAggregateFormatUuid(); 115 static const BluetoothUUID& CharacteristicAggregateFormatUuid();
108 116
109 // The ErrorCallback is used by methods to asynchronously report errors.
110 typedef base::Callback<void(BluetoothGattService::GattErrorCode)>
111 ErrorCallback;
112
113 // The ValueCallback is used to return the value of a remote characteristic
114 // descriptor upon a read request.
115 typedef base::Callback<void(const std::vector<uint8>&)> ValueCallback;
116
117 // Constructs a BluetoothGattDescriptor that can be associated with a local 117 // Constructs a BluetoothGattDescriptor that can be associated with a local
118 // GATT characteristic when the adapter is in the peripheral role. To 118 // GATT characteristic when the adapter is in the peripheral role. To
119 // associate the returned descriptor with a characteristic, add it to a local 119 // associate the returned descriptor with a characteristic, add it to a local
120 // characteristic by calling BluetoothGattCharacteristic::AddDescriptor. 120 // characteristic by calling BluetoothGattCharacteristic::AddDescriptor.
121 // 121 //
122 // This method constructs a characteristic descriptor with UUID |uuid| and the 122 // This method constructs a characteristic descriptor with UUID |uuid| and the
123 // initial cached value |value|. |value| will be cached and returned for read 123 // initial cached value |value|. |value| will be cached and returned for read
124 // requests and automatically modified for write requests by default, unless 124 // requests and automatically modified for write requests by default, unless
125 // an instance of BluetoothGattService::Delegate has been provided to the 125 // an instance of BluetoothGattService::Delegate has been provided to the
126 // associated BluetoothGattService instance, in which case the delegate will 126 // associated BluetoothGattService instance, in which case the delegate will
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 BluetoothGattDescriptor(); 182 BluetoothGattDescriptor();
183 virtual ~BluetoothGattDescriptor(); 183 virtual ~BluetoothGattDescriptor();
184 184
185 private: 185 private:
186 DISALLOW_COPY_AND_ASSIGN(BluetoothGattDescriptor); 186 DISALLOW_COPY_AND_ASSIGN(BluetoothGattDescriptor);
187 }; 187 };
188 188
189 } // namespace device 189 } // namespace device
190 190
191 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_H_ 191 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_DESCRIPTOR_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device_win.h ('k') | device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698