Preliminary main mbed library for nexpaq development
features/FEATURE_BLE/ble/CharacteristicDescriptorDiscovery.h@1:d96dbedaebdb, 2016-11-04 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
nexpaq | 0:6c56fb4bc5f0 | 1 | /* mbed Microcontroller Library |
nexpaq | 0:6c56fb4bc5f0 | 2 | * Copyright (c) 2006-2015 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 __CHARACTERISTIC_DESCRIPTOR_DISCOVERY_H__ |
nexpaq | 0:6c56fb4bc5f0 | 18 | #define __CHARACTERISTIC_DESCRIPTOR_DISCOVERY_H__ |
nexpaq | 0:6c56fb4bc5f0 | 19 | |
nexpaq | 0:6c56fb4bc5f0 | 20 | #include "FunctionPointerWithContext.h" |
nexpaq | 0:6c56fb4bc5f0 | 21 | |
nexpaq | 0:6c56fb4bc5f0 | 22 | class DiscoveredCharacteristic; // forward declaration |
nexpaq | 0:6c56fb4bc5f0 | 23 | class DiscoveredCharacteristicDescriptor; // forward declaration |
nexpaq | 0:6c56fb4bc5f0 | 24 | |
nexpaq | 0:6c56fb4bc5f0 | 25 | /** |
nexpaq | 0:6c56fb4bc5f0 | 26 | * @brief Contain all definitions of callbacks and callbacks parameters types |
nexpaq | 0:6c56fb4bc5f0 | 27 | * related to characteristic descriptor discovery. |
nexpaq | 0:6c56fb4bc5f0 | 28 | * |
nexpaq | 0:6c56fb4bc5f0 | 29 | * @details This class act like a namespace for characteristic descriptor discovery |
nexpaq | 0:6c56fb4bc5f0 | 30 | * types. It act like ServiceDiscovery by providing callbacks and callbacks |
nexpaq | 0:6c56fb4bc5f0 | 31 | * parameters types related to the characteristic descriptor discovery process but |
nexpaq | 0:6c56fb4bc5f0 | 32 | * contrary to ServiceDiscovery class, it does not force the porter to use a |
nexpaq | 0:6c56fb4bc5f0 | 33 | * specific interface for the characteristic descriptor discovery process. |
nexpaq | 0:6c56fb4bc5f0 | 34 | */ |
nexpaq | 0:6c56fb4bc5f0 | 35 | class CharacteristicDescriptorDiscovery { |
nexpaq | 0:6c56fb4bc5f0 | 36 | public: |
nexpaq | 0:6c56fb4bc5f0 | 37 | /** |
nexpaq | 0:6c56fb4bc5f0 | 38 | * @brief Parameter type of CharacteristicDescriptorDiscovery::DiscoveryCallback_t. |
nexpaq | 0:6c56fb4bc5f0 | 39 | * @details Every time a characteristic descriptor has been discovered, the callback |
nexpaq | 0:6c56fb4bc5f0 | 40 | * registered for the discovery operation through GattClient::discoverCharacteristicDescriptors |
nexpaq | 0:6c56fb4bc5f0 | 41 | * or DiscoveredCharacteristic::discoverDescriptors will be called with this parameter. |
nexpaq | 0:6c56fb4bc5f0 | 42 | * |
nexpaq | 0:6c56fb4bc5f0 | 43 | */ |
nexpaq | 0:6c56fb4bc5f0 | 44 | struct DiscoveryCallbackParams_t { |
nexpaq | 0:6c56fb4bc5f0 | 45 | /** |
nexpaq | 0:6c56fb4bc5f0 | 46 | * The characteristic owning the DiscoveredCharacteristicDescriptor |
nexpaq | 0:6c56fb4bc5f0 | 47 | */ |
nexpaq | 0:6c56fb4bc5f0 | 48 | const DiscoveredCharacteristic& characteristic; |
nexpaq | 0:6c56fb4bc5f0 | 49 | |
nexpaq | 0:6c56fb4bc5f0 | 50 | /** |
nexpaq | 0:6c56fb4bc5f0 | 51 | * The characteristic descriptor discovered |
nexpaq | 0:6c56fb4bc5f0 | 52 | */ |
nexpaq | 0:6c56fb4bc5f0 | 53 | const DiscoveredCharacteristicDescriptor& descriptor; |
nexpaq | 0:6c56fb4bc5f0 | 54 | }; |
nexpaq | 0:6c56fb4bc5f0 | 55 | |
nexpaq | 0:6c56fb4bc5f0 | 56 | /** |
nexpaq | 0:6c56fb4bc5f0 | 57 | * @brief Parameter type of CharacteristicDescriptorDiscovery::TerminationCallback_t. |
nexpaq | 0:6c56fb4bc5f0 | 58 | * @details Once a characteristic descriptor discovery process terminate, the termination |
nexpaq | 0:6c56fb4bc5f0 | 59 | * callback registered for the discovery operation through |
nexpaq | 0:6c56fb4bc5f0 | 60 | * GattClient::discoverCharacteristicDescriptors or DiscoveredCharacteristic::discoverDescriptors |
nexpaq | 0:6c56fb4bc5f0 | 61 | * will be called with this parameter. |
nexpaq | 0:6c56fb4bc5f0 | 62 | */ |
nexpaq | 0:6c56fb4bc5f0 | 63 | struct TerminationCallbackParams_t { |
nexpaq | 0:6c56fb4bc5f0 | 64 | /** |
nexpaq | 0:6c56fb4bc5f0 | 65 | * The characteristic for which the descriptors has been discovered |
nexpaq | 0:6c56fb4bc5f0 | 66 | */ |
nexpaq | 0:6c56fb4bc5f0 | 67 | const DiscoveredCharacteristic& characteristic; |
nexpaq | 0:6c56fb4bc5f0 | 68 | |
nexpaq | 0:6c56fb4bc5f0 | 69 | /** |
nexpaq | 0:6c56fb4bc5f0 | 70 | * status of the discovery operation |
nexpaq | 0:6c56fb4bc5f0 | 71 | */ |
nexpaq | 0:6c56fb4bc5f0 | 72 | ble_error_t status; |
nexpaq | 0:6c56fb4bc5f0 | 73 | }; |
nexpaq | 0:6c56fb4bc5f0 | 74 | |
nexpaq | 0:6c56fb4bc5f0 | 75 | /** |
nexpaq | 0:6c56fb4bc5f0 | 76 | * @brief Callback type for when a matching characteristic descriptor is found during |
nexpaq | 0:6c56fb4bc5f0 | 77 | * characteristic descriptor discovery. |
nexpaq | 0:6c56fb4bc5f0 | 78 | * |
nexpaq | 0:6c56fb4bc5f0 | 79 | * @param param A pointer to a DiscoveryCallbackParams_t object which will remain |
nexpaq | 0:6c56fb4bc5f0 | 80 | * valid for the lifetime of the callback. Memory for this object is owned by |
nexpaq | 0:6c56fb4bc5f0 | 81 | * the BLE_API eventing framework. The application can safely make a persistent |
nexpaq | 0:6c56fb4bc5f0 | 82 | * shallow-copy of this object in order to work with the service beyond the |
nexpaq | 0:6c56fb4bc5f0 | 83 | * callback. |
nexpaq | 0:6c56fb4bc5f0 | 84 | */ |
nexpaq | 0:6c56fb4bc5f0 | 85 | typedef FunctionPointerWithContext<const DiscoveryCallbackParams_t*> DiscoveryCallback_t; |
nexpaq | 0:6c56fb4bc5f0 | 86 | |
nexpaq | 0:6c56fb4bc5f0 | 87 | /** |
nexpaq | 0:6c56fb4bc5f0 | 88 | * @brief Callback type for when characteristic descriptor discovery terminates. |
nexpaq | 0:6c56fb4bc5f0 | 89 | * |
nexpaq | 0:6c56fb4bc5f0 | 90 | * @param param A pointer to a TerminationCallbackParams_t object which will remain |
nexpaq | 0:6c56fb4bc5f0 | 91 | * valid for the lifetime of the callback. Memory for this object is owned by |
nexpaq | 0:6c56fb4bc5f0 | 92 | * the BLE_API eventing framework. The application can safely make a persistent |
nexpaq | 0:6c56fb4bc5f0 | 93 | * shallow-copy of this object in order to work with the service beyond the |
nexpaq | 0:6c56fb4bc5f0 | 94 | * callback. |
nexpaq | 0:6c56fb4bc5f0 | 95 | */ |
nexpaq | 0:6c56fb4bc5f0 | 96 | typedef FunctionPointerWithContext<const TerminationCallbackParams_t*> TerminationCallback_t; |
nexpaq | 0:6c56fb4bc5f0 | 97 | }; |
nexpaq | 0:6c56fb4bc5f0 | 98 | |
nexpaq | 0:6c56fb4bc5f0 | 99 | #endif // ifndef __CHARACTERISTIC_DESCRIPTOR_DISCOVERY_H__ |