Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
DiscoveredCharacteristicDescriptor.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__ 00018 #define MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__ 00019 00020 #include "UUID.h " 00021 #include "Gap.h" 00022 #include "GattAttribute.h" 00023 #include "GattClient.h" 00024 #include "CharacteristicDescriptorDiscovery.h" 00025 00026 /** 00027 * @addtogroup ble 00028 * @{ 00029 * @addtogroup gatt 00030 * @{ 00031 * @addtogroup client 00032 * @{ 00033 */ 00034 00035 /** 00036 * Representation of a characteristic descriptor discovered. 00037 * 00038 * Characteristic descriptors can be seen as the metadata of the characteristic. 00039 * They can contain things such as the unit of the characteristic value, extra 00040 * permission informations or the Client Configuration state in regard to 00041 * notification or indication. 00042 * 00043 * The descriptors of a characterstic are discovered by a Characteristic 00044 * Descriptor Discovery Procedure, which can be initiated by either 00045 * GattClient::discoverCharacteristicDescriptors() or 00046 * DiscoveredCharacteristic::discoverDescriptors(). 00047 * 00048 * The discovery procedure returns the UUID of the descriptor (its type) and its 00049 * handle. 00050 * 00051 * Read and write of the descriptor value can be initiated by 00052 * GattClient::read and GattClient::write. 00053 * 00054 * @todo read member function 00055 * @todo write member function 00056 * @todo enumeration of standard descriptors 00057 */ 00058 class DiscoveredCharacteristicDescriptor { 00059 00060 public: 00061 00062 /** 00063 * Construct a new instance of a DiscoveredCharacteristicDescriptor. 00064 * 00065 * @param[in] client The client that has discovered the descriptor. 00066 * @param[in] connectionHandle Handle of the connection to the GATT server 00067 * containing the descriptor. 00068 * @param[in] attributeHandle GATT attribute handle of the descriptor. 00069 * @param[in] uuid UUID of the descriptor. 00070 * 00071 * @note This constructor is not meant to be called directly by application 00072 * code. The Gattclient class generates descriptors discovered. 00073 */ 00074 DiscoveredCharacteristicDescriptor( 00075 GattClient *client, 00076 Gap::Handle_t connectionHandle, 00077 GattAttribute::Handle_t attributeHandle, 00078 const UUID &uuid 00079 ) : _client(client), 00080 _connectionHandle(connectionHandle), 00081 _uuid(uuid), 00082 _gattHandle(attributeHandle) { 00083 } 00084 00085 /** 00086 * Return the GattClient, which can operate on this descriptor. 00087 * 00088 * @return GattClient, which can operate on this descriptor. 00089 */ 00090 GattClient* getGattClient() 00091 { 00092 return _client; 00093 } 00094 00095 /** 00096 * Return the GattClient, which can operate on this descriptor. 00097 * 00098 * @return GattClient, which can operate on this descriptor. 00099 */ 00100 const GattClient* getGattClient() const 00101 { 00102 return _client; 00103 } 00104 00105 /** 00106 * Return the connection handle to the GattServer containing this 00107 * descriptor. 00108 * 00109 * @return the connection handle to the GattServer containing this 00110 * descriptor. 00111 */ 00112 Gap::Handle_t getConnectionHandle() const 00113 { 00114 return _connectionHandle; 00115 } 00116 00117 /** 00118 * Return the UUID of this descriptor. 00119 * 00120 * @return UUID of this descriptor. 00121 */ 00122 const UUID& getUUID(void) const 00123 { 00124 return _uuid; 00125 } 00126 00127 /** 00128 * Return the attribute handle of this descriptor. 00129 * 00130 * This attribute handle can be used to interact with the descriptor on its 00131 * gatt server. 00132 * 00133 * @return Attribute handle of the descriptor 00134 */ 00135 GattAttribute::Handle_t getAttributeHandle() const 00136 { 00137 return _gattHandle; 00138 } 00139 00140 private: 00141 GattClient *_client; 00142 Gap::Handle_t _connectionHandle; 00143 UUID _uuid; 00144 GattAttribute::Handle_t _gattHandle; 00145 }; 00146 00147 /** 00148 * @} 00149 * @} 00150 * @} 00151 */ 00152 00153 #endif /* MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__ */
Generated on Sun Jul 17 2022 08:25:21 by 1.7.2