Greg Steiert / pegasus_dev

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Nov 11 20:59:50 2016 +0000
Revision:
0:5c4d7b2438d3
Initial commit

Who changed what in which revision?

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