BLE

Fork of BLE_API by Bluetooth Low Energy

Committer:
vcoubard
Date:
Tue Jan 12 19:47:52 2016 +0000
Revision:
1131:ff83f0020480
Parent:
1078:98d37e26903c
Synchronized with git rev e0f693ad
Author: Vincent Coubard
version v2.5.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vcoubard 1078:98d37e26903c 1 /* mbed Microcontroller Library
vcoubard 1078:98d37e26903c 2 * Copyright (c) 2006-2015 ARM Limited
vcoubard 1078:98d37e26903c 3 *
vcoubard 1078:98d37e26903c 4 * Licensed under the Apache License, Version 2.0 (the "License");
vcoubard 1078:98d37e26903c 5 * you may not use this file except in compliance with the License.
vcoubard 1078:98d37e26903c 6 * You may obtain a copy of the License at
vcoubard 1078:98d37e26903c 7 *
vcoubard 1078:98d37e26903c 8 * http://www.apache.org/licenses/LICENSE-2.0
vcoubard 1078:98d37e26903c 9 *
vcoubard 1078:98d37e26903c 10 * Unless required by applicable law or agreed to in writing, software
vcoubard 1078:98d37e26903c 11 * distributed under the License is distributed on an "AS IS" BASIS,
vcoubard 1078:98d37e26903c 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
vcoubard 1078:98d37e26903c 13 * See the License for the specific language governing permissions and
vcoubard 1078:98d37e26903c 14 * limitations under the License.
vcoubard 1078:98d37e26903c 15 */
vcoubard 1078:98d37e26903c 16
vcoubard 1078:98d37e26903c 17 #ifndef __CHARACTERISTIC_DESCRIPTOR_DISCOVERY_H__
vcoubard 1078:98d37e26903c 18 #define __CHARACTERISTIC_DESCRIPTOR_DISCOVERY_H__
vcoubard 1078:98d37e26903c 19
vcoubard 1078:98d37e26903c 20 #include "FunctionPointerWithContext.h"
vcoubard 1078:98d37e26903c 21
vcoubard 1078:98d37e26903c 22 class DiscoveredCharacteristic; // forward declaration
vcoubard 1078:98d37e26903c 23 class DiscoveredCharacteristicDescriptor; // forward declaration
vcoubard 1078:98d37e26903c 24
vcoubard 1078:98d37e26903c 25 /**
vcoubard 1078:98d37e26903c 26 * @brief Contain all definitions of callbacks and callbacks parameters types
vcoubard 1078:98d37e26903c 27 * related to characteristic descriptor discovery.
vcoubard 1078:98d37e26903c 28 *
vcoubard 1078:98d37e26903c 29 * @details This class act like a namespace for characteristic descriptor discovery
vcoubard 1078:98d37e26903c 30 * types. It act like ServiceDiscovery by providing callbacks and callbacks
vcoubard 1078:98d37e26903c 31 * parameters types related to the characteristic descriptor discovery process but
vcoubard 1078:98d37e26903c 32 * contrary to ServiceDiscovery class, it does not force the porter to use a
vcoubard 1078:98d37e26903c 33 * specific interface for the characteristic descriptor discovery process.
vcoubard 1078:98d37e26903c 34 */
vcoubard 1078:98d37e26903c 35 class CharacteristicDescriptorDiscovery {
vcoubard 1078:98d37e26903c 36 public:
vcoubard 1078:98d37e26903c 37 /**
vcoubard 1078:98d37e26903c 38 * @brief Parameter type of CharacteristicDescriptorDiscovery::DiscoveryCallback_t.
vcoubard 1078:98d37e26903c 39 * @detail Every time a characteristic descriptor has been discovered, the callback
vcoubard 1078:98d37e26903c 40 * registered for the discovery operation through GattClient::discoverCharacteristicDescriptors
vcoubard 1078:98d37e26903c 41 * or DiscoveredCharacteristic::discoverDescriptors will be called with this parameter.
vcoubard 1078:98d37e26903c 42 *
vcoubard 1078:98d37e26903c 43 */
vcoubard 1078:98d37e26903c 44 struct DiscoveryCallbackParams_t {
vcoubard 1078:98d37e26903c 45 /**
vcoubard 1078:98d37e26903c 46 * The characteristic owning the DiscoveredCharacteristicDescriptor
vcoubard 1078:98d37e26903c 47 */
vcoubard 1078:98d37e26903c 48 const DiscoveredCharacteristic& characteristic;
vcoubard 1078:98d37e26903c 49
vcoubard 1078:98d37e26903c 50 /**
vcoubard 1078:98d37e26903c 51 * The characteristic descriptor discovered
vcoubard 1078:98d37e26903c 52 */
vcoubard 1078:98d37e26903c 53 const DiscoveredCharacteristicDescriptor& descriptor;
vcoubard 1078:98d37e26903c 54 };
vcoubard 1078:98d37e26903c 55
vcoubard 1078:98d37e26903c 56 /**
vcoubard 1078:98d37e26903c 57 * @brief Parameter type of CharacteristicDescriptorDiscovery::TerminationCallback_t.
vcoubard 1078:98d37e26903c 58 * @details Once a characteristic descriptor discovery process terminate, the termination
vcoubard 1078:98d37e26903c 59 * callback registered for the discovery operation through
vcoubard 1078:98d37e26903c 60 * GattClient::discoverCharacteristicDescriptors or DiscoveredCharacteristic::discoverDescriptors
vcoubard 1078:98d37e26903c 61 * will be called with this parameter.
vcoubard 1078:98d37e26903c 62 */
vcoubard 1078:98d37e26903c 63 struct TerminationCallbackParams_t {
vcoubard 1078:98d37e26903c 64 /**
vcoubard 1078:98d37e26903c 65 * The characteristic for which the descriptors has been discovered
vcoubard 1078:98d37e26903c 66 */
vcoubard 1078:98d37e26903c 67 const DiscoveredCharacteristic& characteristic;
vcoubard 1078:98d37e26903c 68
vcoubard 1078:98d37e26903c 69 /**
vcoubard 1078:98d37e26903c 70 * status of the discovery operation
vcoubard 1078:98d37e26903c 71 */
vcoubard 1078:98d37e26903c 72 ble_error_t status;
vcoubard 1078:98d37e26903c 73 };
vcoubard 1078:98d37e26903c 74
vcoubard 1078:98d37e26903c 75 /**
vcoubard 1078:98d37e26903c 76 * @brief Callback type for when a matching characteristic descriptor is found during
vcoubard 1078:98d37e26903c 77 * characteristic descriptor discovery.
vcoubard 1078:98d37e26903c 78 *
vcoubard 1078:98d37e26903c 79 * @param param A pointer to a DiscoveryCallbackParams_t object which will remain
vcoubard 1078:98d37e26903c 80 * valid for the lifetime of the callback. Memory for this object is owned by
vcoubard 1078:98d37e26903c 81 * the BLE_API eventing framework. The application can safely make a persistent
vcoubard 1078:98d37e26903c 82 * shallow-copy of this object in order to work with the service beyond the
vcoubard 1078:98d37e26903c 83 * callback.
vcoubard 1078:98d37e26903c 84 */
vcoubard 1078:98d37e26903c 85 typedef FunctionPointerWithContext<const DiscoveryCallbackParams_t*> DiscoveryCallback_t;
vcoubard 1078:98d37e26903c 86
vcoubard 1078:98d37e26903c 87 /**
vcoubard 1078:98d37e26903c 88 * @brief Callback type for when characteristic descriptor discovery terminates.
vcoubard 1078:98d37e26903c 89 *
vcoubard 1078:98d37e26903c 90 * @param param A pointer to a TerminationCallbackParams_t object which will remain
vcoubard 1078:98d37e26903c 91 * valid for the lifetime of the callback. Memory for this object is owned by
vcoubard 1078:98d37e26903c 92 * the BLE_API eventing framework. The application can safely make a persistent
vcoubard 1078:98d37e26903c 93 * shallow-copy of this object in order to work with the service beyond the
vcoubard 1078:98d37e26903c 94 * callback.
vcoubard 1078:98d37e26903c 95 */
vcoubard 1078:98d37e26903c 96 typedef FunctionPointerWithContext<const TerminationCallbackParams_t*> TerminationCallback_t;
vcoubard 1078:98d37e26903c 97 };
vcoubard 1078:98d37e26903c 98
vcoubard 1078:98d37e26903c 99 #endif // ifndef __CHARACTERISTIC_DESCRIPTOR_DISCOVERY_H__