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