Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
blecommon.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef MBED_BLE_COMMON_H__ 00018 #define MBED_BLE_COMMON_H__ 00019 00020 #ifdef __cplusplus 00021 extern "C" { 00022 #endif 00023 00024 /** 00025 * @addtogroup ble 00026 * @{ 00027 * @addtogroup common 00028 * @{ 00029 */ 00030 00031 /** 00032 * Assigned values for BLE UUIDs. 00033 */ 00034 enum { 00035 /** 00036 * Reserved UUID. 00037 */ 00038 BLE_UUID_UNKNOWN = 0x0000, 00039 00040 /** 00041 * Primary Service. 00042 */ 00043 BLE_UUID_SERVICE_PRIMARY = 0x2800, 00044 00045 /** 00046 * Secondary Service. 00047 */ 00048 BLE_UUID_SERVICE_SECONDARY = 0x2801, 00049 00050 /** 00051 * Included service. 00052 */ 00053 BLE_UUID_SERVICE_INCLUDE = 0x2802, 00054 00055 /** 00056 * Characteristic. 00057 */ 00058 BLE_UUID_CHARACTERISTIC = 0x2803, 00059 00060 /** 00061 * Characteristic Extended Properties Descriptor. 00062 */ 00063 BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP = 0x2900, 00064 00065 /** 00066 * Characteristic User Description Descriptor. 00067 */ 00068 BLE_UUID_DESCRIPTOR_CHAR_USER_DESC = 0x2901, 00069 00070 /** 00071 * Client Characteristic Configuration Descriptor. 00072 */ 00073 BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG = 0x2902, 00074 00075 /** 00076 * Server Characteristic Configuration Descriptor. 00077 */ 00078 BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG = 0x2903, 00079 00080 /** 00081 * Characteristic Presentation Format Descriptor. 00082 */ 00083 BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT = 0x2904, 00084 00085 /** 00086 * Characteristic Aggregate Format Descriptor. 00087 */ 00088 BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT = 0x2905, 00089 00090 /* GATT specific UUIDs */ 00091 /** 00092 * Generic Attribute Profile. 00093 */ 00094 BLE_UUID_GATT = 0x1801, 00095 00096 /** 00097 * Service Changed Characteristic. 00098 */ 00099 BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED = 0x2A05, 00100 00101 /* GAP specific UUIDs */ 00102 00103 /** 00104 * Generic Access Profile. 00105 */ 00106 BLE_UUID_GAP = 0x1800, 00107 00108 /** 00109 * Device Name Characteristic. 00110 */ 00111 BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME = 0x2A00, 00112 00113 /** 00114 * Appearance Characteristic. 00115 */ 00116 BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE = 0x2A01, 00117 00118 /** 00119 * Peripheral Privacy Flag Characteristic. 00120 */ 00121 BLE_UUID_GAP_CHARACTERISTIC_PPF = 0x2A02, 00122 00123 /** 00124 * Reconnection Address Characteristic. 00125 */ 00126 BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR = 0x2A03, 00127 00128 /** 00129 * Peripheral Preferred Connection Parameters Characteristic. 00130 */ 00131 BLE_UUID_GAP_CHARACTERISTIC_PPCP = 0x2A04, 00132 }; 00133 00134 /** 00135 * Error codes for the BLE API. 00136 * 00137 * The value 0 means that no error was reported; therefore, it allows an API 00138 * user to cleanly test for errors. 00139 * 00140 * @code 00141 * ble_error_t error = some_ble_api_function(); 00142 * if (error) { 00143 * // handle the error 00144 * } 00145 * @endcode 00146 */ 00147 enum ble_error_t { 00148 /** 00149 * No error. 00150 */ 00151 BLE_ERROR_NONE = 0, 00152 00153 /** 00154 * The requested action would cause a buffer overflow and has been aborted. 00155 */ 00156 BLE_ERROR_BUFFER_OVERFLOW = 1, 00157 00158 /** 00159 * Requested a feature that isn't yet implemented or isn't supported by the 00160 * target HW. 00161 */ 00162 BLE_ERROR_NOT_IMPLEMENTED = 2, 00163 00164 /** 00165 * One of the supplied parameters is outside the valid range. 00166 */ 00167 BLE_ERROR_PARAM_OUT_OF_RANGE = 3, 00168 00169 /** 00170 * One of the supplied parameters is invalid. 00171 */ 00172 BLE_ERROR_INVALID_PARAM = 4, 00173 00174 /** 00175 * The stack is busy. 00176 */ 00177 BLE_STACK_BUSY = 5, 00178 00179 /** 00180 * Invalid state. 00181 */ 00182 BLE_ERROR_INVALID_STATE = 6, 00183 00184 /** 00185 * Out of memory. 00186 */ 00187 BLE_ERROR_NO_MEM = 7, 00188 00189 /** 00190 * The operation requested is not permitted. 00191 */ 00192 BLE_ERROR_OPERATION_NOT_PERMITTED = 8, 00193 00194 /** 00195 * The BLE subsystem has not completed its initialization. 00196 */ 00197 BLE_ERROR_INITIALIZATION_INCOMPLETE = 9, 00198 00199 /** 00200 * The BLE system has already been initialized. 00201 */ 00202 BLE_ERROR_ALREADY_INITIALIZED = 10, 00203 00204 /** 00205 * Unknown error. 00206 */ 00207 BLE_ERROR_UNSPECIFIED = 11, 00208 00209 /** 00210 * The platform-specific stack failed. 00211 */ 00212 BLE_ERROR_INTERNAL_STACK_FAILURE = 12, 00213 00214 /** 00215 * Data not found or there is nothing to return. 00216 */ 00217 BLE_ERROR_NOT_FOUND = 13 00218 }; 00219 00220 /** 00221 * Default MTU size. 00222 */ 00223 static const unsigned BLE_GATT_MTU_SIZE_DEFAULT = 23; 00224 00225 /** 00226 * Handle Value Notification/Indication event. 00227 * 00228 * Emmitted when a notification or indication has been received from a GATT 00229 * server. 00230 */ 00231 enum HVXType_t { 00232 /** 00233 * Handle Value Notification. 00234 */ 00235 BLE_HVX_NOTIFICATION = 0x01, 00236 00237 /** 00238 * Handle Value Indication. 00239 */ 00240 BLE_HVX_INDICATION = 0x02, 00241 }; 00242 00243 /** 00244 * @} 00245 * @} 00246 */ 00247 00248 #ifdef __cplusplus 00249 } 00250 #endif 00251 00252 #endif // ifndef MBED_BLE_COMMON_H__
Generated on Tue Jul 12 2022 13:54:03 by
