Mbed OS Reference
Loading...
Searching...
No Matches
gatt/DiscoveredCharacteristicDescriptor.h
1/* mbed Microcontroller Library
2 * Copyright (c) 2006-2020 ARM Limited
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#ifndef MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__
20#define MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__
21
22#include "ble/Gap.h"
23#include "ble/common/UUID.h"
24#include "ble/gatt/GattAttribute.h"
25#include "ble/gatt/CharacteristicDescriptorDiscovery.h"
26
27namespace ble {
28class GattClient;
29}
30
31/**
32 * @addtogroup ble
33 * @{
34 * @addtogroup gatt
35 * @{
36 * @addtogroup client
37 * @{
38 */
39
40/**
41 * Representation of a characteristic descriptor discovered.
42 *
43 * Characteristic descriptors can be seen as the metadata of the characteristic.
44 * They can contain things such as the unit of the characteristic value, extra
45 * permission informations or the Client Configuration state in regard to
46 * notification or indication.
47 *
48 * The descriptors of a characterstic are discovered by a Characteristic
49 * Descriptor Discovery Procedure, which can be initiated by either
50 * ble::GattClient::discoverCharacteristicDescriptors() or
51 * DiscoveredCharacteristic::discoverDescriptors().
52 *
53 * The discovery procedure returns the UUID of the descriptor (its type) and its
54 * handle.
55 *
56 * Read and write of the descriptor value can be initiated by
57 * ble::GattClient::read and ble::GattClient::write.
58 *
59 * @todo read member function
60 * @todo write member function
61 * @todo enumeration of standard descriptors
62 */
64
65public:
66
67 /**
68 * Construct a new instance of a DiscoveredCharacteristicDescriptor.
69 *
70 * @param[in] client The client that has discovered the descriptor.
71 * @param[in] connectionHandle Handle of the connection to the GATT server
72 * containing the descriptor.
73 * @param[in] attributeHandle GATT attribute handle of the descriptor.
74 * @param[in] uuid UUID of the descriptor.
75 *
76 * @note This constructor is not meant to be called directly by application
77 * code. The ble::GattClient class generates descriptors discovered.
78 */
80 ble::GattClient *client,
81 ble::connection_handle_t connectionHandle,
82 GattAttribute::Handle_t attributeHandle,
83 const UUID &uuid
84 ) : _client(client),
85 _connectionHandle(connectionHandle),
86 _uuid(uuid),
87 _gattHandle(attributeHandle) {
88 }
89
90 /**
91 * Return the ble::GattClient, which can operate on this descriptor.
92 *
93 * @return ble::GattClient, which can operate on this descriptor.
94 */
96 {
97 return _client;
98 }
99
100 /**
101 * Return the ble::GattClient, which can operate on this descriptor.
102 *
103 * @return ble::GattClient, which can operate on this descriptor.
104 */
106 {
107 return _client;
108 }
109
110 /**
111 * Return the connection handle to the GattServer containing this
112 * descriptor.
113 *
114 * @return the connection handle to the GattServer containing this
115 * descriptor.
116 */
118 {
119 return _connectionHandle;
120 }
121
122 /**
123 * Return the UUID of this descriptor.
124 *
125 * @return UUID of this descriptor.
126 */
127 const UUID& getUUID() const
128 {
129 return _uuid;
130 }
131
132 /**
133 * Return the attribute handle of this descriptor.
134 *
135 * This attribute handle can be used to interact with the descriptor on its
136 * gatt server.
137 *
138 * @return Attribute handle of the descriptor
139 */
141 {
142 return _gattHandle;
143 }
144
145private:
146 ble::GattClient *_client;
147 ble::connection_handle_t _connectionHandle;
148 UUID _uuid;
149 GattAttribute::Handle_t _gattHandle;
150};
151
152/**
153 * @}
154 * @}
155 * @}
156 */
157
158#endif /* MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__ */
Representation of a characteristic descriptor discovered.
ble::connection_handle_t getConnectionHandle() const
Return the connection handle to the GattServer containing this descriptor.
GattAttribute::Handle_t getAttributeHandle() const
Return the attribute handle of this descriptor.
const ble::GattClient * getGattClient() const
Return the ble::GattClient, which can operate on this descriptor.
ble::GattClient * getGattClient()
Return the ble::GattClient, which can operate on this descriptor.
DiscoveredCharacteristicDescriptor(ble::GattClient *client, ble::connection_handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, const UUID &uuid)
Construct a new instance of a DiscoveredCharacteristicDescriptor.
const UUID & getUUID() const
Return the UUID of this descriptor.
ble::attribute_handle_t Handle_t
Representation of an attribute handle.
Representation of a Universally Unique Identifier (UUID).
Definition: common/UUID.h:76
Define procedures required for interacting with a distant GATT server.
Definition: GattClient.h:97
Entry namespace for all BLE API definitions.
uintptr_t connection_handle_t
Opaque reference to a connection.