mbed-os

Dependents:   cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more

Committer:
be_bryan
Date:
Mon Dec 11 17:54:04 2017 +0000
Revision:
0:b74591d5ab33
motor ++

Who changed what in which revision?

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