Dependents:   sensomed

Committer:
switches
Date:
Tue Nov 08 18:27:11 2016 +0000
Revision:
0:0e018d759a2a
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:0e018d759a2a 1 /* mbed Microcontroller Library
switches 0:0e018d759a2a 2 * Copyright (c) 2006-2013 ARM Limited
switches 0:0e018d759a2a 3 *
switches 0:0e018d759a2a 4 * Licensed under the Apache License, Version 2.0 (the "License");
switches 0:0e018d759a2a 5 * you may not use this file except in compliance with the License.
switches 0:0e018d759a2a 6 * You may obtain a copy of the License at
switches 0:0e018d759a2a 7 *
switches 0:0e018d759a2a 8 * http://www.apache.org/licenses/LICENSE-2.0
switches 0:0e018d759a2a 9 *
switches 0:0e018d759a2a 10 * Unless required by applicable law or agreed to in writing, software
switches 0:0e018d759a2a 11 * distributed under the License is distributed on an "AS IS" BASIS,
switches 0:0e018d759a2a 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
switches 0:0e018d759a2a 13 * See the License for the specific language governing permissions and
switches 0:0e018d759a2a 14 * limitations under the License.
switches 0:0e018d759a2a 15 */
switches 0:0e018d759a2a 16
switches 0:0e018d759a2a 17 #ifndef __DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__
switches 0:0e018d759a2a 18 #define __DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__
switches 0:0e018d759a2a 19
switches 0:0e018d759a2a 20 #include "UUID.h"
switches 0:0e018d759a2a 21 #include "Gap.h"
switches 0:0e018d759a2a 22 #include "GattAttribute.h"
switches 0:0e018d759a2a 23 #include "GattClient.h"
switches 0:0e018d759a2a 24 #include "CharacteristicDescriptorDiscovery.h"
switches 0:0e018d759a2a 25
switches 0:0e018d759a2a 26 /**
switches 0:0e018d759a2a 27 * @brief Representation of a descriptor discovered during a GattClient
switches 0:0e018d759a2a 28 * discovery procedure (see GattClient::discoverCharacteristicDescriptors or
switches 0:0e018d759a2a 29 * DiscoveredCharacteristic::discoverDescriptors ).
switches 0:0e018d759a2a 30 *
switches 0:0e018d759a2a 31 * @details Provide detailed informations about a discovered characteristic descriptor
switches 0:0e018d759a2a 32 * like:
switches 0:0e018d759a2a 33 * - Its UUID (see #getUUID).
switches 0:0e018d759a2a 34 * - Its handle (see #getAttributeHandle)
switches 0:0e018d759a2a 35 * Basic read (see GattClient::read) and write (see GattClient::write) procedure from
switches 0:0e018d759a2a 36 * GattClient can be used access the value of the descriptor.
switches 0:0e018d759a2a 37 *
switches 0:0e018d759a2a 38 * @todo read member function
switches 0:0e018d759a2a 39 * @todo write member function
switches 0:0e018d759a2a 40 * @todo enumeration of standard descriptors
switches 0:0e018d759a2a 41 */
switches 0:0e018d759a2a 42 class DiscoveredCharacteristicDescriptor {
switches 0:0e018d759a2a 43
switches 0:0e018d759a2a 44 public:
switches 0:0e018d759a2a 45
switches 0:0e018d759a2a 46 /**
switches 0:0e018d759a2a 47 * @brief construct a new instance of a DiscoveredCharacteristicDescriptor
switches 0:0e018d759a2a 48 *
switches 0:0e018d759a2a 49 * @param client The client from where the descriptor has been discovered
switches 0:0e018d759a2a 50 * @param connectionHandle The connection handle on which the descriptor has
switches 0:0e018d759a2a 51 * been discovered
switches 0:0e018d759a2a 52 * @param attributeHandle The handle of the attribute containing this descriptor
switches 0:0e018d759a2a 53 * @param uuid The UUID of the descriptor
switches 0:0e018d759a2a 54 */
switches 0:0e018d759a2a 55 DiscoveredCharacteristicDescriptor(
switches 0:0e018d759a2a 56 GattClient* client, Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, const UUID& uuid) :
switches 0:0e018d759a2a 57 _client(client), _connectionHandle(connectionHandle), _uuid(uuid), _gattHandle(attributeHandle) {
switches 0:0e018d759a2a 58
switches 0:0e018d759a2a 59 }
switches 0:0e018d759a2a 60
switches 0:0e018d759a2a 61 /**
switches 0:0e018d759a2a 62 * @brief Return the GattClient which can operate on this descriptor.
switches 0:0e018d759a2a 63 * @return The GattClient which can operate on this descriptor.
switches 0:0e018d759a2a 64 */
switches 0:0e018d759a2a 65 GattClient* getGattClient() {
switches 0:0e018d759a2a 66 return _client;
switches 0:0e018d759a2a 67 }
switches 0:0e018d759a2a 68
switches 0:0e018d759a2a 69 /**
switches 0:0e018d759a2a 70 * @brief Return the GattClient which can operate on this descriptor.
switches 0:0e018d759a2a 71 * @return The GattClient which can operate on this descriptor.
switches 0:0e018d759a2a 72 */
switches 0:0e018d759a2a 73 const GattClient* getGattClient() const {
switches 0:0e018d759a2a 74 return _client;
switches 0:0e018d759a2a 75 }
switches 0:0e018d759a2a 76
switches 0:0e018d759a2a 77 /**
switches 0:0e018d759a2a 78 * @brief Return the connection handle to the GattServer which contain
switches 0:0e018d759a2a 79 * this descriptor.
switches 0:0e018d759a2a 80 * @return the connection handle to the GattServer which contain
switches 0:0e018d759a2a 81 * this descriptor.
switches 0:0e018d759a2a 82 */
switches 0:0e018d759a2a 83 Gap::Handle_t getConnectionHandle() const {
switches 0:0e018d759a2a 84 return _connectionHandle;
switches 0:0e018d759a2a 85 }
switches 0:0e018d759a2a 86
switches 0:0e018d759a2a 87 /**
switches 0:0e018d759a2a 88 * @brief Return the UUID of this descriptor
switches 0:0e018d759a2a 89 * @return the UUID of this descriptor
switches 0:0e018d759a2a 90 */
switches 0:0e018d759a2a 91 const UUID& getUUID(void) const {
switches 0:0e018d759a2a 92 return _uuid;
switches 0:0e018d759a2a 93 }
switches 0:0e018d759a2a 94
switches 0:0e018d759a2a 95 /**
switches 0:0e018d759a2a 96 * @brief Return the attribute handle to use to access to this descriptor
switches 0:0e018d759a2a 97 * on the gatt server.
switches 0:0e018d759a2a 98 * @return The attribute handle of the descriptor
switches 0:0e018d759a2a 99 */
switches 0:0e018d759a2a 100 GattAttribute::Handle_t getAttributeHandle() const {
switches 0:0e018d759a2a 101 return _gattHandle;
switches 0:0e018d759a2a 102 }
switches 0:0e018d759a2a 103
switches 0:0e018d759a2a 104 private:
switches 0:0e018d759a2a 105 GattClient *_client;
switches 0:0e018d759a2a 106 Gap::Handle_t _connectionHandle;
switches 0:0e018d759a2a 107 UUID _uuid;
switches 0:0e018d759a2a 108 GattAttribute::Handle_t _gattHandle;
switches 0:0e018d759a2a 109 };
switches 0:0e018d759a2a 110
switches 0:0e018d759a2a 111 #endif /*__DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__*/