Bike service

Fork of BLE_API by Bluetooth Low Energy

Committer:
vcoubard
Date:
Wed Apr 06 19:15:30 2016 +0100
Revision:
1180:4ab722f8dca0
Parent:
1157:e1ea38b576c6
Child:
1184:1589830dbdb7
Synchronized with git rev ca632aaf
Author: Andres Amaya Garcia
Update Gap state after advertising times out

The BLE API was not updating the Gap internal state when the advertising stops
because of a user timeout. This commit fixes the issue by updating the internal
state structure in Gap just before the registered callbacks are notified of the
advertising timeout.

Who changed what in which revision?

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