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

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.