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