High level Bluetooth Low Energy API and radio abstraction layer

Dependents:   BLE_ANCS_SDAPI BLE_temperature BLE_HeartRate BLE_ANCS_SDAPI_IRC ... more

Overview

The BLE_API is a high level abstraction for using Bluetooth Low Energy on multiple platforms. For details and examples using the BLE_API please see the BLE_API Summary Page. Or click on the API Documentation tab above.

Supported Services

Supported services can be found in the BLE_API/services folder.

Committer:
Vincent Coubard
Date:
Wed Sep 14 14:18:00 2016 +0100
Revision:
1208:65474dc93927
Parent:
1135:22aada733dbd
Sync with 8d97fced5440d78c9557693b6d1632f1ab5d77b7

2016-09-01 08:21:37+01:00: Vincent Coubard
version v2.7.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vcoubard 1131:692ddf04fc42 1 /* mbed Microcontroller Library
vcoubard 1131:692ddf04fc42 2 * Copyright (c) 2006-2013 ARM Limited
vcoubard 1131:692ddf04fc42 3 *
vcoubard 1131:692ddf04fc42 4 * Licensed under the Apache License, Version 2.0 (the "License");
vcoubard 1131:692ddf04fc42 5 * you may not use this file except in compliance with the License.
vcoubard 1131:692ddf04fc42 6 * You may obtain a copy of the License at
vcoubard 1131:692ddf04fc42 7 *
vcoubard 1131:692ddf04fc42 8 * http://www.apache.org/licenses/LICENSE-2.0
vcoubard 1131:692ddf04fc42 9 *
vcoubard 1131:692ddf04fc42 10 * Unless required by applicable law or agreed to in writing, software
vcoubard 1131:692ddf04fc42 11 * distributed under the License is distributed on an "AS IS" BASIS,
vcoubard 1131:692ddf04fc42 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
vcoubard 1131:692ddf04fc42 13 * See the License for the specific language governing permissions and
vcoubard 1131:692ddf04fc42 14 * limitations under the License.
vcoubard 1131:692ddf04fc42 15 */
vcoubard 1131:692ddf04fc42 16
vcoubard 1131:692ddf04fc42 17 #ifndef __BLE_COMMON_H__
vcoubard 1131:692ddf04fc42 18 #define __BLE_COMMON_H__
vcoubard 1131:692ddf04fc42 19
vcoubard 1131:692ddf04fc42 20 #ifdef __cplusplus
vcoubard 1131:692ddf04fc42 21 extern "C" {
vcoubard 1131:692ddf04fc42 22 #endif
vcoubard 1131:692ddf04fc42 23
vcoubard 1131:692ddf04fc42 24
vcoubard 1131:692ddf04fc42 25 /*! @brief Assigned values for BLE UUIDs. */
vcoubard 1131:692ddf04fc42 26 enum {
vcoubard 1131:692ddf04fc42 27 BLE_UUID_UNKNOWN = 0x0000, /**< Reserved UUID. */
vcoubard 1131:692ddf04fc42 28 BLE_UUID_SERVICE_PRIMARY = 0x2800, /**< Primary Service. */
vcoubard 1131:692ddf04fc42 29 BLE_UUID_SERVICE_SECONDARY = 0x2801, /**< Secondary Service. */
vcoubard 1131:692ddf04fc42 30 BLE_UUID_SERVICE_INCLUDE = 0x2802, /**< Include. */
vcoubard 1131:692ddf04fc42 31 BLE_UUID_CHARACTERISTIC = 0x2803, /**< Characteristic. */
vcoubard 1131:692ddf04fc42 32 BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP = 0x2900, /**< Characteristic Extended Properties Descriptor. */
vcoubard 1131:692ddf04fc42 33 BLE_UUID_DESCRIPTOR_CHAR_USER_DESC = 0x2901, /**< Characteristic User Description Descriptor. */
vcoubard 1131:692ddf04fc42 34 BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG = 0x2902, /**< Client Characteristic Configuration Descriptor. */
vcoubard 1131:692ddf04fc42 35 BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG = 0x2903, /**< Server Characteristic Configuration Descriptor. */
vcoubard 1131:692ddf04fc42 36 BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT = 0x2904, /**< Characteristic Presentation Format Descriptor. */
vcoubard 1131:692ddf04fc42 37 BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT = 0x2905, /**< Characteristic Aggregate Format Descriptor. */
vcoubard 1131:692ddf04fc42 38
vcoubard 1131:692ddf04fc42 39 /* GATT specific UUIDs */
vcoubard 1131:692ddf04fc42 40 BLE_UUID_GATT = 0x1801, /**< Generic Attribute Profile. */
vcoubard 1131:692ddf04fc42 41 BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED = 0x2A05, /**< Service Changed Characteristic. */
vcoubard 1131:692ddf04fc42 42
vcoubard 1131:692ddf04fc42 43 /* GAP specific UUIDs */
vcoubard 1131:692ddf04fc42 44 BLE_UUID_GAP = 0x1800, /**< Generic Access Profile. */
vcoubard 1131:692ddf04fc42 45 BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME = 0x2A00, /**< Device Name Characteristic. */
vcoubard 1131:692ddf04fc42 46 BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE = 0x2A01, /**< Appearance Characteristic. */
vcoubard 1131:692ddf04fc42 47 BLE_UUID_GAP_CHARACTERISTIC_PPF = 0x2A02, /**< Peripheral Privacy Flag Characteristic. */
vcoubard 1131:692ddf04fc42 48 BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR = 0x2A03, /**< Reconnection Address Characteristic. */
vcoubard 1131:692ddf04fc42 49 BLE_UUID_GAP_CHARACTERISTIC_PPCP = 0x2A04, /**< Peripheral Preferred Connection Parameters Characteristic. */
vcoubard 1131:692ddf04fc42 50 };
vcoubard 1131:692ddf04fc42 51
vcoubard 1131:692ddf04fc42 52 /*! @brief Error codes for the BLE API. */
vcoubard 1131:692ddf04fc42 53 enum ble_error_t {
vcoubard 1131:692ddf04fc42 54 BLE_ERROR_NONE = 0, /**< No error. */
vcoubard 1131:692ddf04fc42 55 BLE_ERROR_BUFFER_OVERFLOW = 1, /**< The requested action would cause a buffer overflow and has been aborted. */
vcoubard 1131:692ddf04fc42 56 BLE_ERROR_NOT_IMPLEMENTED = 2, /**< Requested a feature that isn't yet implemented or isn't supported by the target HW. */
vcoubard 1131:692ddf04fc42 57 BLE_ERROR_PARAM_OUT_OF_RANGE = 3, /**< One of the supplied parameters is outside the valid range. */
vcoubard 1131:692ddf04fc42 58 BLE_ERROR_INVALID_PARAM = 4, /**< One of the supplied parameters is invalid. */
vcoubard 1131:692ddf04fc42 59 BLE_STACK_BUSY = 5, /**< The stack is busy. */
vcoubard 1131:692ddf04fc42 60 BLE_ERROR_INVALID_STATE = 6, /**< Invalid state. */
vcoubard 1131:692ddf04fc42 61 BLE_ERROR_NO_MEM = 7, /**< Out of memory */
vcoubard 1131:692ddf04fc42 62 BLE_ERROR_OPERATION_NOT_PERMITTED = 8,
vcoubard 1131:692ddf04fc42 63 BLE_ERROR_INITIALIZATION_INCOMPLETE = 9,
vcoubard 1131:692ddf04fc42 64 BLE_ERROR_ALREADY_INITIALIZED = 10,
vcoubard 1131:692ddf04fc42 65 BLE_ERROR_UNSPECIFIED = 11, /**< Unknown error. */
vcoubard 1135:22aada733dbd 66 BLE_ERROR_INTERNAL_STACK_FAILURE = 12, /**< The platform-specific stack failed */
vcoubard 1131:692ddf04fc42 67 };
vcoubard 1131:692ddf04fc42 68
vcoubard 1131:692ddf04fc42 69 /** @brief Default MTU size. */
vcoubard 1131:692ddf04fc42 70 static const unsigned BLE_GATT_MTU_SIZE_DEFAULT = 23;
vcoubard 1131:692ddf04fc42 71
vcoubard 1131:692ddf04fc42 72 enum HVXType_t {
vcoubard 1131:692ddf04fc42 73 BLE_HVX_NOTIFICATION = 0x01, /**< Handle Value Notification. */
vcoubard 1131:692ddf04fc42 74 BLE_HVX_INDICATION = 0x02, /**< Handle Value Indication. */
vcoubard 1131:692ddf04fc42 75 };
vcoubard 1131:692ddf04fc42 76
vcoubard 1131:692ddf04fc42 77 #ifdef __cplusplus
vcoubard 1131:692ddf04fc42 78 }
vcoubard 1131:692ddf04fc42 79 #endif
vcoubard 1131:692ddf04fc42 80
rgrover1 710:b2e1a2660ec2 81 #endif // ifndef __BLE_COMMON_H__