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