Mbed OS Reference
Loading...
Searching...
No Matches
common/blecommon.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_BLE_COMMON_H__
20#define MBED_BLE_COMMON_H__
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26/**
27 * @defgroup ble Bluetooth
28 * @ingroup connectivity-public-api
29 * @{
30 * @addtogroup common
31 * @{
32 */
33
34/**
35 * Assigned values for BLE UUIDs.
36 */
37enum {
38 /**
39 * Reserved UUID.
40 */
42
43 /**
44 * Primary Service.
45 */
47
48 /**
49 * Secondary Service.
50 */
52
53 /**
54 * Included service.
55 */
57
58 /**
59 * Characteristic.
60 */
62
63 /**
64 * Characteristic Extended Properties Descriptor.
65 */
67
68 /**
69 * Characteristic User Description Descriptor.
70 */
72
73 /**
74 * Client Characteristic Configuration Descriptor.
75 */
77
78 /**
79 * Server Characteristic Configuration Descriptor.
80 */
82
83 /**
84 * Characteristic Presentation Format Descriptor.
85 */
87
88 /**
89 * Characteristic Aggregate Format Descriptor.
90 */
92
93/* GATT specific UUIDs */
94 /**
95 * Generic Attribute Profile.
96 */
97 BLE_UUID_GATT = 0x1801,
98
99 /**
100 * Service Changed Characteristic.
101 */
103
104/* GAP specific UUIDs */
105
106 /**
107 * Generic Access Profile.
108 */
109 BLE_UUID_GAP = 0x1800,
110
111 /**
112 * Device Name Characteristic.
113 */
115
116 /**
117 * Appearance Characteristic.
118 */
120
121 /**
122 * Peripheral Privacy Flag Characteristic.
123 */
125
126 /**
127 * Reconnection Address Characteristic.
128 */
130
131 /**
132 * Peripheral Preferred Connection Parameters Characteristic.
133 */
135};
136
137/**
138 * Error codes for the BLE API.
139 *
140 * The value 0 means that no error was reported; therefore, it allows an API
141 * user to cleanly test for errors.
142 *
143 * @code
144 * ble_error_t error = some_ble_api_function();
145 * if (error) {
146 * // handle the error
147 * }
148 * @endcode
149 */
151 /**
152 * No error.
153 */
155
156 /**
157 * The requested action would cause a buffer overflow and has been aborted.
158 */
160
161 /**
162 * Requested a feature that isn't yet implemented or isn't supported by the
163 * target HW.
164 */
166
167 /**
168 * One of the supplied parameters is outside the valid range.
169 */
171
172 /**
173 * One of the supplied parameters is invalid.
174 */
176
177 /**
178 * The stack is busy.
179 */
181
182 /**
183 * Invalid state.
184 */
186
187 /**
188 * Out of memory.
189 */
191
192 /**
193 * The operation requested is not permitted.
194 */
196
197 /**
198 * The BLE subsystem has not completed its initialization.
199 */
201
202 /**
203 * The BLE system has already been initialized.
204 */
206
207 /**
208 * Unknown error.
209 */
211
212 /**
213 * The platform-specific stack failed.
214 */
216
217 /**
218 * Data not found or there is nothing to return.
219 */
221
222 /**
223 * Specified timeout expired.
224 */
226
227 /**
228 * Specified limit expired.
229 */
232
233/**
234 * Default MTU size.
235 */
236static const unsigned BLE_GATT_MTU_SIZE_DEFAULT = 23;
237
238/**
239 * Handle Value Notification/Indication event.
240 *
241 * Emmitted when a notification or indication has been received from a GATT
242 * server.
243 */
245 /**
246 * Handle Value Notification.
247 */
249
250 /**
251 * Handle Value Indication.
252 */
254};
255
256/**
257 * @}
258 * @}
259 */
260
261#ifdef __cplusplus
262}
263#endif
264
265#endif // ifndef MBED_BLE_COMMON_H__
ble_error_t
Error codes for the BLE API.
HVXType_t
Handle Value Notification/Indication event.
@ BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT
Characteristic Aggregate Format Descriptor.
@ BLE_UUID_DESCRIPTOR_CHAR_USER_DESC
Characteristic User Description Descriptor.
@ BLE_UUID_GAP
Generic Access Profile.
@ BLE_UUID_SERVICE_PRIMARY
Primary Service.
@ BLE_UUID_SERVICE_INCLUDE
Included service.
@ BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE
Appearance Characteristic.
@ BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED
Service Changed Characteristic.
@ BLE_UUID_GAP_CHARACTERISTIC_PPF
Peripheral Privacy Flag Characteristic.
@ BLE_UUID_SERVICE_SECONDARY
Secondary Service.
@ BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG
Server Characteristic Configuration Descriptor.
@ BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME
Device Name Characteristic.
@ BLE_UUID_CHARACTERISTIC
Characteristic.
@ BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR
Reconnection Address Characteristic.
@ BLE_UUID_GATT
Generic Attribute Profile.
@ BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT
Characteristic Presentation Format Descriptor.
@ BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP
Characteristic Extended Properties Descriptor.
@ BLE_UUID_UNKNOWN
Reserved UUID.
@ BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG
Client Characteristic Configuration Descriptor.
@ BLE_UUID_GAP_CHARACTERISTIC_PPCP
Peripheral Preferred Connection Parameters Characteristic.
@ BLE_ERROR_NOT_FOUND
Data not found or there is nothing to return.
@ BLE_ERROR_OPERATION_NOT_PERMITTED
The operation requested is not permitted.
@ BLE_ERROR_TIMEOUT
Specified timeout expired.
@ BLE_ERROR_PARAM_OUT_OF_RANGE
One of the supplied parameters is outside the valid range.
@ BLE_ERROR_LIMIT_REACHED
Specified limit expired.
@ BLE_ERROR_INTERNAL_STACK_FAILURE
The platform-specific stack failed.
@ BLE_STACK_BUSY
The stack is busy.
@ BLE_ERROR_NO_MEM
Out of memory.
@ BLE_ERROR_BUFFER_OVERFLOW
The requested action would cause a buffer overflow and has been aborted.
@ BLE_ERROR_NONE
No error.
@ BLE_ERROR_INITIALIZATION_INCOMPLETE
The BLE subsystem has not completed its initialization.
@ BLE_ERROR_UNSPECIFIED
Unknown error.
@ BLE_ERROR_INVALID_STATE
Invalid state.
@ BLE_ERROR_ALREADY_INITIALIZED
The BLE system has already been initialized.
@ BLE_ERROR_NOT_IMPLEMENTED
Requested a feature that isn't yet implemented or isn't supported by the target HW.
@ BLE_ERROR_INVALID_PARAM
One of the supplied parameters is invalid.
@ BLE_HVX_INDICATION
Handle Value Indication.
@ BLE_HVX_NOTIFICATION
Handle Value Notification.