mbed-os

Dependents:   cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more

Committer:
be_bryan
Date:
Mon Dec 11 17:54:04 2017 +0000
Revision:
0:b74591d5ab33
motor ++

Who changed what in which revision?

UserRevisionLine numberNew contents of line
be_bryan 0:b74591d5ab33 1 /* mbed Microcontroller Library
be_bryan 0:b74591d5ab33 2 * Copyright (c) 2006-2013 ARM Limited
be_bryan 0:b74591d5ab33 3 *
be_bryan 0:b74591d5ab33 4 * Licensed under the Apache License, Version 2.0 (the "License");
be_bryan 0:b74591d5ab33 5 * you may not use this file except in compliance with the License.
be_bryan 0:b74591d5ab33 6 * You may obtain a copy of the License at
be_bryan 0:b74591d5ab33 7 *
be_bryan 0:b74591d5ab33 8 * http://www.apache.org/licenses/LICENSE-2.0
be_bryan 0:b74591d5ab33 9 *
be_bryan 0:b74591d5ab33 10 * Unless required by applicable law or agreed to in writing, software
be_bryan 0:b74591d5ab33 11 * distributed under the License is distributed on an "AS IS" BASIS,
be_bryan 0:b74591d5ab33 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
be_bryan 0:b74591d5ab33 13 * See the License for the specific language governing permissions and
be_bryan 0:b74591d5ab33 14 * limitations under the License.
be_bryan 0:b74591d5ab33 15 */
be_bryan 0:b74591d5ab33 16
be_bryan 0:b74591d5ab33 17 #ifndef MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__
be_bryan 0:b74591d5ab33 18 #define MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__
be_bryan 0:b74591d5ab33 19
be_bryan 0:b74591d5ab33 20 #include "UUID.h"
be_bryan 0:b74591d5ab33 21 #include "Gap.h"
be_bryan 0:b74591d5ab33 22 #include "GattAttribute.h"
be_bryan 0:b74591d5ab33 23 #include "GattClient.h"
be_bryan 0:b74591d5ab33 24 #include "CharacteristicDescriptorDiscovery.h"
be_bryan 0:b74591d5ab33 25
be_bryan 0:b74591d5ab33 26 /**
be_bryan 0:b74591d5ab33 27 * @addtogroup ble
be_bryan 0:b74591d5ab33 28 * @{
be_bryan 0:b74591d5ab33 29 * @addtogroup gatt
be_bryan 0:b74591d5ab33 30 * @{
be_bryan 0:b74591d5ab33 31 * @addtogroup client
be_bryan 0:b74591d5ab33 32 * @{
be_bryan 0:b74591d5ab33 33 */
be_bryan 0:b74591d5ab33 34
be_bryan 0:b74591d5ab33 35 /**
be_bryan 0:b74591d5ab33 36 * Representation of a characteristic descriptor discovered.
be_bryan 0:b74591d5ab33 37 *
be_bryan 0:b74591d5ab33 38 * Characteristic descriptors can be seen as the metadata of the characteristic.
be_bryan 0:b74591d5ab33 39 * They can contain things such as the unit of the characteristic value, extra
be_bryan 0:b74591d5ab33 40 * permission informations or the Client Configuration state in regard to
be_bryan 0:b74591d5ab33 41 * notification or indication.
be_bryan 0:b74591d5ab33 42 *
be_bryan 0:b74591d5ab33 43 * The descriptors of a characterstic are discovered by a Characteristic
be_bryan 0:b74591d5ab33 44 * Descriptor Discovery Procedure, which can be initiated by either
be_bryan 0:b74591d5ab33 45 * GattClient::discoverCharacteristicDescriptors() or
be_bryan 0:b74591d5ab33 46 * DiscoveredCharacteristic::discoverDescriptors().
be_bryan 0:b74591d5ab33 47 *
be_bryan 0:b74591d5ab33 48 * The discovery procedure returns the UUID of the descriptor (its type) and its
be_bryan 0:b74591d5ab33 49 * handle.
be_bryan 0:b74591d5ab33 50 *
be_bryan 0:b74591d5ab33 51 * Read and write of the descriptor value can be initiated by
be_bryan 0:b74591d5ab33 52 * GattClient::read and GattClient::write.
be_bryan 0:b74591d5ab33 53 *
be_bryan 0:b74591d5ab33 54 * @todo read member function
be_bryan 0:b74591d5ab33 55 * @todo write member function
be_bryan 0:b74591d5ab33 56 * @todo enumeration of standard descriptors
be_bryan 0:b74591d5ab33 57 */
be_bryan 0:b74591d5ab33 58 class DiscoveredCharacteristicDescriptor {
be_bryan 0:b74591d5ab33 59
be_bryan 0:b74591d5ab33 60 public:
be_bryan 0:b74591d5ab33 61
be_bryan 0:b74591d5ab33 62 /**
be_bryan 0:b74591d5ab33 63 * Construct a new instance of a DiscoveredCharacteristicDescriptor.
be_bryan 0:b74591d5ab33 64 *
be_bryan 0:b74591d5ab33 65 * @param[in] client The client that has discovered the descriptor.
be_bryan 0:b74591d5ab33 66 * @param[in] connectionHandle Handle of the connection to the GATT server
be_bryan 0:b74591d5ab33 67 * containing the descriptor.
be_bryan 0:b74591d5ab33 68 * @param[in] attributeHandle GATT attribute handle of the descriptor.
be_bryan 0:b74591d5ab33 69 * @param[in] uuid UUID of the descriptor.
be_bryan 0:b74591d5ab33 70 *
be_bryan 0:b74591d5ab33 71 * @note This constructor is not meant to be called directly by application
be_bryan 0:b74591d5ab33 72 * code. The Gattclient class generates descriptors discovered.
be_bryan 0:b74591d5ab33 73 */
be_bryan 0:b74591d5ab33 74 DiscoveredCharacteristicDescriptor(
be_bryan 0:b74591d5ab33 75 GattClient *client,
be_bryan 0:b74591d5ab33 76 Gap::Handle_t connectionHandle,
be_bryan 0:b74591d5ab33 77 GattAttribute::Handle_t attributeHandle,
be_bryan 0:b74591d5ab33 78 const UUID &uuid
be_bryan 0:b74591d5ab33 79 ) : _client(client),
be_bryan 0:b74591d5ab33 80 _connectionHandle(connectionHandle),
be_bryan 0:b74591d5ab33 81 _uuid(uuid),
be_bryan 0:b74591d5ab33 82 _gattHandle(attributeHandle) {
be_bryan 0:b74591d5ab33 83 }
be_bryan 0:b74591d5ab33 84
be_bryan 0:b74591d5ab33 85 /**
be_bryan 0:b74591d5ab33 86 * Return the GattClient, which can operate on this descriptor.
be_bryan 0:b74591d5ab33 87 *
be_bryan 0:b74591d5ab33 88 * @return GattClient, which can operate on this descriptor.
be_bryan 0:b74591d5ab33 89 */
be_bryan 0:b74591d5ab33 90 GattClient* getGattClient()
be_bryan 0:b74591d5ab33 91 {
be_bryan 0:b74591d5ab33 92 return _client;
be_bryan 0:b74591d5ab33 93 }
be_bryan 0:b74591d5ab33 94
be_bryan 0:b74591d5ab33 95 /**
be_bryan 0:b74591d5ab33 96 * Return the GattClient, which can operate on this descriptor.
be_bryan 0:b74591d5ab33 97 *
be_bryan 0:b74591d5ab33 98 * @return GattClient, which can operate on this descriptor.
be_bryan 0:b74591d5ab33 99 */
be_bryan 0:b74591d5ab33 100 const GattClient* getGattClient() const
be_bryan 0:b74591d5ab33 101 {
be_bryan 0:b74591d5ab33 102 return _client;
be_bryan 0:b74591d5ab33 103 }
be_bryan 0:b74591d5ab33 104
be_bryan 0:b74591d5ab33 105 /**
be_bryan 0:b74591d5ab33 106 * Return the connection handle to the GattServer containing this
be_bryan 0:b74591d5ab33 107 * descriptor.
be_bryan 0:b74591d5ab33 108 *
be_bryan 0:b74591d5ab33 109 * @return the connection handle to the GattServer containing this
be_bryan 0:b74591d5ab33 110 * descriptor.
be_bryan 0:b74591d5ab33 111 */
be_bryan 0:b74591d5ab33 112 Gap::Handle_t getConnectionHandle() const
be_bryan 0:b74591d5ab33 113 {
be_bryan 0:b74591d5ab33 114 return _connectionHandle;
be_bryan 0:b74591d5ab33 115 }
be_bryan 0:b74591d5ab33 116
be_bryan 0:b74591d5ab33 117 /**
be_bryan 0:b74591d5ab33 118 * Return the UUID of this descriptor.
be_bryan 0:b74591d5ab33 119 *
be_bryan 0:b74591d5ab33 120 * @return UUID of this descriptor.
be_bryan 0:b74591d5ab33 121 */
be_bryan 0:b74591d5ab33 122 const UUID& getUUID(void) const
be_bryan 0:b74591d5ab33 123 {
be_bryan 0:b74591d5ab33 124 return _uuid;
be_bryan 0:b74591d5ab33 125 }
be_bryan 0:b74591d5ab33 126
be_bryan 0:b74591d5ab33 127 /**
be_bryan 0:b74591d5ab33 128 * Return the attribute handle of this descriptor.
be_bryan 0:b74591d5ab33 129 *
be_bryan 0:b74591d5ab33 130 * This attribute handle can be used to interact with the descriptor on its
be_bryan 0:b74591d5ab33 131 * gatt server.
be_bryan 0:b74591d5ab33 132 *
be_bryan 0:b74591d5ab33 133 * @return Attribute handle of the descriptor
be_bryan 0:b74591d5ab33 134 */
be_bryan 0:b74591d5ab33 135 GattAttribute::Handle_t getAttributeHandle() const
be_bryan 0:b74591d5ab33 136 {
be_bryan 0:b74591d5ab33 137 return _gattHandle;
be_bryan 0:b74591d5ab33 138 }
be_bryan 0:b74591d5ab33 139
be_bryan 0:b74591d5ab33 140 private:
be_bryan 0:b74591d5ab33 141 GattClient *_client;
be_bryan 0:b74591d5ab33 142 Gap::Handle_t _connectionHandle;
be_bryan 0:b74591d5ab33 143 UUID _uuid;
be_bryan 0:b74591d5ab33 144 GattAttribute::Handle_t _gattHandle;
be_bryan 0:b74591d5ab33 145 };
be_bryan 0:b74591d5ab33 146
be_bryan 0:b74591d5ab33 147 /**
be_bryan 0:b74591d5ab33 148 * @}
be_bryan 0:b74591d5ab33 149 * @}
be_bryan 0:b74591d5ab33 150 * @}
be_bryan 0:b74591d5ab33 151 */
be_bryan 0:b74591d5ab33 152
be_bryan 0:b74591d5ab33 153 #endif /* MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__ */