OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_DESCRIPTOR_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_DESCRIPTOR_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "device/bluetooth/bluetooth_export.h" |
| 13 #include "device/bluetooth/bluetooth_gatt_descriptor.h" |
| 14 #include "device/bluetooth/bluetooth_local_gatt_characteristic.h" |
| 15 #include "device/bluetooth/bluetooth_uuid.h" |
| 16 |
| 17 namespace device { |
| 18 |
| 19 // BluetoothLocalGattDescriptor represents a local or remote GATT characteristic |
| 20 // descriptor. A GATT characteristic descriptor provides further information |
| 21 // about a characteristic's value. They can be used to describe the |
| 22 // characteristic's features or to control certain behaviors. |
| 23 // |
| 24 // Note: We use virtual inheritance on the GATT descriptor since it will be |
| 25 // inherited by platform specific versions of the GATT descriptor classes also. |
| 26 // The platform specific remote GATT descriptor classes will inherit both this |
| 27 // class and their GATT descriptor class, hence causing an inheritance diamond. |
| 28 class DEVICE_BLUETOOTH_EXPORT BluetoothLocalGattDescriptor |
| 29 : public virtual BluetoothGattDescriptor { |
| 30 public: |
| 31 // Constructs a BluetoothLocalGattDescriptor that can be associated with a |
| 32 // local |
| 33 // GATT characteristic when the adapter is in the peripheral role. To |
| 34 // associate the returned descriptor with a characteristic, provide an pointer |
| 35 // to that characteristic instance to the create function. |
| 36 // |
| 37 // This method constructs a characteristic descriptor with UUID |uuid| and the |
| 38 // initial cached value |value|. |value| will be cached and returned for read |
| 39 // requests and automatically modified for write requests by default, unless |
| 40 // an instance of BluetoothRemoteGattService::Delegate has been provided to |
| 41 // the |
| 42 // associated BluetoothRemoteGattService instance, in which case the delegate |
| 43 // will |
| 44 // handle the read and write requests. |
| 45 // |
| 46 // Currently, only custom UUIDs, |kCharacteristicDescriptionUuid|, and |
| 47 // |kCharacteristicPresentationFormat| are supported for locally hosted |
| 48 // descriptors. This method will return NULL if |uuid| is any one of the |
| 49 // unsupported predefined descriptor UUIDs. |
| 50 static BluetoothLocalGattDescriptor* Create( |
| 51 const BluetoothUUID& uuid, |
| 52 const std::vector<uint8_t>& value, |
| 53 BluetoothGattCharacteristic::Permissions permissions, |
| 54 BluetoothLocalGattCharacteristic* characteristic); |
| 55 |
| 56 protected: |
| 57 BluetoothLocalGattDescriptor(); |
| 58 ~BluetoothLocalGattDescriptor() override; |
| 59 |
| 60 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattDescriptor); |
| 62 }; |
| 63 |
| 64 } // namespace device |
| 65 |
| 66 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_DESCRIPTOR_H_ |
OLD | NEW |