Preliminary main mbed library for nexpaq development

Committer:
nexpaq
Date:
Fri Nov 04 20:54:50 2016 +0000
Revision:
1:d96dbedaebdb
Parent:
0:6c56fb4bc5f0
Removed extra directories for other platforms

Who changed what in which revision?

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