Pinned to some recent date

Committer:
Simon Cooksey
Date:
Thu Nov 17 16:43:53 2016 +0000
Revision:
0:fb7af294d5d9
Initial commit

Who changed what in which revision?

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