High level Bluetooth Low Energy API and radio abstraction layer

Dependents:   BLE_ANCS_SDAPI BLE_temperature BLE_HeartRate BLE_ANCS_SDAPI_IRC ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DiscoveredCharacteristicDescriptor.h Source File

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 __DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__
00018 #define __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  * @brief Representation of a descriptor discovered during a GattClient
00028  * discovery procedure (see GattClient::discoverCharacteristicDescriptors or
00029  * DiscoveredCharacteristic::discoverDescriptors ).
00030  *
00031  * @details Provide detailed informations about a discovered characteristic descriptor
00032  * like:
00033  *     - Its UUID (see #getUUID).
00034  *     - Its handle (see #getAttributeHandle)
00035  * Basic read (see GattClient::read) and write (see GattClient::write) procedure from
00036  * GattClient can be used access the value of the descriptor.
00037  *
00038  * @todo read member function
00039  * @todo write member function
00040  * @todo enumeration of standard descriptors
00041  */
00042 class DiscoveredCharacteristicDescriptor {
00043 
00044 public:
00045 
00046     /**
00047      * @brief construct a new instance of a DiscoveredCharacteristicDescriptor
00048      *
00049      * @param client The client from where the descriptor has been discovered
00050      * @param connectionHandle The connection handle on which the descriptor has
00051      * been discovered
00052      * @param attributeHandle The handle of the attribute containing this descriptor
00053      * @param uuid The UUID of the descriptor
00054      */
00055     DiscoveredCharacteristicDescriptor(
00056         GattClient* client, Gap::Handle_t connectionHandle,  GattAttribute::Handle_t attributeHandle, const UUID& uuid) :
00057         _client(client), _connectionHandle(connectionHandle), _uuid(uuid), _gattHandle(attributeHandle) {
00058 
00059     }
00060 
00061     /**
00062      * @brief Return the GattClient which can operate on this descriptor.
00063      * @return The GattClient which can operate on this descriptor.
00064      */
00065     GattClient* getGattClient() {
00066         return _client;
00067     }
00068 
00069     /**
00070      * @brief Return the GattClient which can operate on this descriptor.
00071      * @return The GattClient which can operate on this descriptor.
00072      */
00073     const GattClient* getGattClient() const {
00074         return _client;
00075     }
00076 
00077     /**
00078      * @brief Return the connection handle to the GattServer which contain
00079      * this descriptor.
00080      * @return the connection handle to the GattServer which contain
00081      * this descriptor.
00082      */
00083     Gap::Handle_t getConnectionHandle() const {
00084         return _connectionHandle;
00085     }
00086 
00087     /**
00088      * @brief Return the UUID of this descriptor
00089      * @return the UUID of this descriptor
00090      */
00091     const UUID& getUUID(void) const {
00092         return _uuid;
00093     }
00094 
00095     /**
00096      * @brief Return the attribute handle to use to access to this descriptor
00097      * on the gatt server.
00098      * @return The attribute handle of the descriptor
00099      */
00100     GattAttribute::Handle_t getAttributeHandle() const {
00101         return _gattHandle;
00102     }
00103 
00104 private:
00105     GattClient  *_client;
00106     Gap::Handle_t _connectionHandle;
00107     UUID _uuid;
00108     GattAttribute::Handle_t _gattHandle;
00109 };
00110 
00111 #endif /*__DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__*/