BA / SerialCom

Fork of OmniWheels by Gustav Atmel

Committer:
gustavatmel
Date:
Tue May 01 15:47:08 2018 +0000
Revision:
1:9c5af431a1f1
sdf

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gustavatmel 1:9c5af431a1f1 1 /* mbed Microcontroller Library
gustavatmel 1:9c5af431a1f1 2 * Copyright (c) 2006-2015 ARM Limited
gustavatmel 1:9c5af431a1f1 3 *
gustavatmel 1:9c5af431a1f1 4 * Licensed under the Apache License, Version 2.0 (the "License");
gustavatmel 1:9c5af431a1f1 5 * you may not use this file except in compliance with the License.
gustavatmel 1:9c5af431a1f1 6 * You may obtain a copy of the License at
gustavatmel 1:9c5af431a1f1 7 *
gustavatmel 1:9c5af431a1f1 8 * http://www.apache.org/licenses/LICENSE-2.0
gustavatmel 1:9c5af431a1f1 9 *
gustavatmel 1:9c5af431a1f1 10 * Unless required by applicable law or agreed to in writing, software
gustavatmel 1:9c5af431a1f1 11 * distributed under the License is distributed on an "AS IS" BASIS,
gustavatmel 1:9c5af431a1f1 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
gustavatmel 1:9c5af431a1f1 13 * See the License for the specific language governing permissions and
gustavatmel 1:9c5af431a1f1 14 * limitations under the License.
gustavatmel 1:9c5af431a1f1 15 */
gustavatmel 1:9c5af431a1f1 16
gustavatmel 1:9c5af431a1f1 17 #ifndef MBED_CHARACTERISTIC_DESCRIPTOR_DISCOVERY_H__
gustavatmel 1:9c5af431a1f1 18 #define MBED_CHARACTERISTIC_DESCRIPTOR_DISCOVERY_H__
gustavatmel 1:9c5af431a1f1 19
gustavatmel 1:9c5af431a1f1 20 #include "FunctionPointerWithContext.h"
gustavatmel 1:9c5af431a1f1 21
gustavatmel 1:9c5af431a1f1 22 class DiscoveredCharacteristic; // forward declaration
gustavatmel 1:9c5af431a1f1 23 class DiscoveredCharacteristicDescriptor; // forward declaration
gustavatmel 1:9c5af431a1f1 24
gustavatmel 1:9c5af431a1f1 25 /**
gustavatmel 1:9c5af431a1f1 26 * @addtogroup ble
gustavatmel 1:9c5af431a1f1 27 * @{
gustavatmel 1:9c5af431a1f1 28 * @addtogroup gatt
gustavatmel 1:9c5af431a1f1 29 * @{
gustavatmel 1:9c5af431a1f1 30 */
gustavatmel 1:9c5af431a1f1 31
gustavatmel 1:9c5af431a1f1 32 /**
gustavatmel 1:9c5af431a1f1 33 * Definitions of events and event handlers that the characteristic descriptor
gustavatmel 1:9c5af431a1f1 34 * discovery procedure uses.
gustavatmel 1:9c5af431a1f1 35 *
gustavatmel 1:9c5af431a1f1 36 * This class acts like a namespace for characteristic descriptor discovery
gustavatmel 1:9c5af431a1f1 37 * types. Like ServiceDiscovery, it provides callbacks and callbacks parameters
gustavatmel 1:9c5af431a1f1 38 * types related to the characteristic descriptor discovery process, but contrary
gustavatmel 1:9c5af431a1f1 39 * to the ServiceDiscovery class, it does not force the porter to use a specific
gustavatmel 1:9c5af431a1f1 40 * interface for the characteristic descriptor discovery process.
gustavatmel 1:9c5af431a1f1 41 */
gustavatmel 1:9c5af431a1f1 42 class CharacteristicDescriptorDiscovery {
gustavatmel 1:9c5af431a1f1 43 public:
gustavatmel 1:9c5af431a1f1 44 /**
gustavatmel 1:9c5af431a1f1 45 * Characteristic descriptor discovered event.
gustavatmel 1:9c5af431a1f1 46 *
gustavatmel 1:9c5af431a1f1 47 * When a characteristic descriptor has been discovered, the callback
gustavatmel 1:9c5af431a1f1 48 * registered for the discovery operation through
gustavatmel 1:9c5af431a1f1 49 * GattClient::discoverCharacteristicDescriptors or
gustavatmel 1:9c5af431a1f1 50 * DiscoveredCharacteristic::discoverDescriptors is called with an instance
gustavatmel 1:9c5af431a1f1 51 * of this type.
gustavatmel 1:9c5af431a1f1 52 *
gustavatmel 1:9c5af431a1f1 53 * The values reported to the user are the descriptor discovered and the
gustavatmel 1:9c5af431a1f1 54 * characteristic owning that descriptor.
gustavatmel 1:9c5af431a1f1 55 *
gustavatmel 1:9c5af431a1f1 56 * @see GattClient::discoverCharacteristicDescriptors
gustavatmel 1:9c5af431a1f1 57 * DiscoveredCharacteristic::discoverDescriptors
gustavatmel 1:9c5af431a1f1 58 */
gustavatmel 1:9c5af431a1f1 59 struct DiscoveryCallbackParams_t {
gustavatmel 1:9c5af431a1f1 60 /**
gustavatmel 1:9c5af431a1f1 61 * Characteristic owning the descriptor discovered.
gustavatmel 1:9c5af431a1f1 62 */
gustavatmel 1:9c5af431a1f1 63 const DiscoveredCharacteristic &characteristic;
gustavatmel 1:9c5af431a1f1 64
gustavatmel 1:9c5af431a1f1 65 /**
gustavatmel 1:9c5af431a1f1 66 * Characteristic descriptor discovered.
gustavatmel 1:9c5af431a1f1 67 */
gustavatmel 1:9c5af431a1f1 68 const DiscoveredCharacteristicDescriptor &descriptor;
gustavatmel 1:9c5af431a1f1 69 };
gustavatmel 1:9c5af431a1f1 70
gustavatmel 1:9c5af431a1f1 71 /**
gustavatmel 1:9c5af431a1f1 72 * Characteristic descriptor discovery ended event.
gustavatmel 1:9c5af431a1f1 73 *
gustavatmel 1:9c5af431a1f1 74 * When the characteristic descriptor discovery process ends, the
gustavatmel 1:9c5af431a1f1 75 * termination callback registered for the discovery operation through
gustavatmel 1:9c5af431a1f1 76 * GattClient::discoverCharacteristicDescriptors or
gustavatmel 1:9c5af431a1f1 77 * DiscoveredCharacteristic::discoverDescriptors will be called with an
gustavatmel 1:9c5af431a1f1 78 * instance of this type.
gustavatmel 1:9c5af431a1f1 79 *
gustavatmel 1:9c5af431a1f1 80 * @see GattClient::discoverCharacteristicDescriptors
gustavatmel 1:9c5af431a1f1 81 * DiscoveredCharacteristic::discoverDescriptors
gustavatmel 1:9c5af431a1f1 82 */
gustavatmel 1:9c5af431a1f1 83 struct TerminationCallbackParams_t {
gustavatmel 1:9c5af431a1f1 84 /**
gustavatmel 1:9c5af431a1f1 85 * Characteristic for which descriptors has been discovered.
gustavatmel 1:9c5af431a1f1 86 */
gustavatmel 1:9c5af431a1f1 87 const DiscoveredCharacteristic& characteristic;
gustavatmel 1:9c5af431a1f1 88
gustavatmel 1:9c5af431a1f1 89 /**
gustavatmel 1:9c5af431a1f1 90 * Status of the discovery operation.
gustavatmel 1:9c5af431a1f1 91 */
gustavatmel 1:9c5af431a1f1 92 ble_error_t status;
gustavatmel 1:9c5af431a1f1 93
gustavatmel 1:9c5af431a1f1 94 /**
gustavatmel 1:9c5af431a1f1 95 * Error code associated with the status if any.
gustavatmel 1:9c5af431a1f1 96 */
gustavatmel 1:9c5af431a1f1 97 uint8_t error_code;
gustavatmel 1:9c5af431a1f1 98 };
gustavatmel 1:9c5af431a1f1 99
gustavatmel 1:9c5af431a1f1 100 /**
gustavatmel 1:9c5af431a1f1 101 * Characteristic descriptor discovered event handler.
gustavatmel 1:9c5af431a1f1 102 *
gustavatmel 1:9c5af431a1f1 103 * As a parameter, it expects a pointer to a DiscoveryCallbackParams_t instance.
gustavatmel 1:9c5af431a1f1 104 *
gustavatmel 1:9c5af431a1f1 105 * @note The object passed in parameter will remain valid for the lifetime
gustavatmel 1:9c5af431a1f1 106 * of the callback. The BLE_API eventing framework owns memory for this
gustavatmel 1:9c5af431a1f1 107 * object. The application can safely make a persistent shallow-copy of
gustavatmel 1:9c5af431a1f1 108 * this object to work with the service beyond the callback.
gustavatmel 1:9c5af431a1f1 109 *
gustavatmel 1:9c5af431a1f1 110 * @see DiscoveryCallbackParams_t
gustavatmel 1:9c5af431a1f1 111 * GattClient::discoverCharacteristicDescriptors
gustavatmel 1:9c5af431a1f1 112 * DiscoveredCharacteristic::discoverDescriptors
gustavatmel 1:9c5af431a1f1 113 */
gustavatmel 1:9c5af431a1f1 114 typedef FunctionPointerWithContext<const DiscoveryCallbackParams_t*>
gustavatmel 1:9c5af431a1f1 115 DiscoveryCallback_t;
gustavatmel 1:9c5af431a1f1 116
gustavatmel 1:9c5af431a1f1 117 /**
gustavatmel 1:9c5af431a1f1 118 * Handler of Characteristic descriptor discovery ended event.
gustavatmel 1:9c5af431a1f1 119 *
gustavatmel 1:9c5af431a1f1 120 * As a parameter, it expects a pointer to a TerminationCallbackParams_t instance.
gustavatmel 1:9c5af431a1f1 121 *
gustavatmel 1:9c5af431a1f1 122 * @note The object passed in parameter will remain valid for the lifetime
gustavatmel 1:9c5af431a1f1 123 * of the callback. The BLE_API eventing framework owns the memory for this
gustavatmel 1:9c5af431a1f1 124 * object. The application can safely make a persistent shallow-copy of
gustavatmel 1:9c5af431a1f1 125 * this object to work with the service beyond the callback.
gustavatmel 1:9c5af431a1f1 126 *
gustavatmel 1:9c5af431a1f1 127 * @see TerminationCallbackParams_t
gustavatmel 1:9c5af431a1f1 128 * GattClient::discoverCharacteristicDescriptors
gustavatmel 1:9c5af431a1f1 129 * DiscoveredCharacteristic::discoverDescriptors
gustavatmel 1:9c5af431a1f1 130 */
gustavatmel 1:9c5af431a1f1 131 typedef FunctionPointerWithContext<const TerminationCallbackParams_t*>
gustavatmel 1:9c5af431a1f1 132 TerminationCallback_t;
gustavatmel 1:9c5af431a1f1 133 };
gustavatmel 1:9c5af431a1f1 134
gustavatmel 1:9c5af431a1f1 135 /**
gustavatmel 1:9c5af431a1f1 136 * @}
gustavatmel 1:9c5af431a1f1 137 * @}
gustavatmel 1:9c5af431a1f1 138 */
gustavatmel 1:9c5af431a1f1 139
gustavatmel 1:9c5af431a1f1 140 #endif // ifndef MBED_CHARACTERISTIC_DESCRIPTOR_DISCOVERY_H__