Updated
Fork of BLE_API by
ble/blecommon.h@1104:0244fbb0324e, 2016-01-11 (annotated)
- Committer:
- vcoubard
- Date:
- Mon Jan 11 08:51:56 2016 +0000
- Revision:
- 1104:0244fbb0324e
- Parent:
- 1100:c3d484a482d8
- Child:
- 1106:1a25c4e7407a
Synchronized with git rev 02ca65bc
Author: Andres Amaya Garcia
Make update adv payload replace previous data
Accumulate and update advertising payload now differ in their implementations.
Accumulate updates the previous value, if it is UUID then the previously added
values are kept and the new one is simple appended. In contrast, update
replaces the previous value in all cases.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rgrover1 | 710:b2e1a2660ec2 | 1 | /* mbed Microcontroller Library |
rgrover1 | 710:b2e1a2660ec2 | 2 | * Copyright (c) 2006-2013 ARM Limited |
rgrover1 | 710:b2e1a2660ec2 | 3 | * |
rgrover1 | 710:b2e1a2660ec2 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
rgrover1 | 710:b2e1a2660ec2 | 5 | * you may not use this file except in compliance with the License. |
rgrover1 | 710:b2e1a2660ec2 | 6 | * You may obtain a copy of the License at |
rgrover1 | 710:b2e1a2660ec2 | 7 | * |
rgrover1 | 710:b2e1a2660ec2 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
rgrover1 | 710:b2e1a2660ec2 | 9 | * |
rgrover1 | 710:b2e1a2660ec2 | 10 | * Unless required by applicable law or agreed to in writing, software |
rgrover1 | 710:b2e1a2660ec2 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
rgrover1 | 710:b2e1a2660ec2 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
rgrover1 | 710:b2e1a2660ec2 | 13 | * See the License for the specific language governing permissions and |
rgrover1 | 710:b2e1a2660ec2 | 14 | * limitations under the License. |
rgrover1 | 710:b2e1a2660ec2 | 15 | */ |
rgrover1 | 710:b2e1a2660ec2 | 16 | |
rgrover1 | 710:b2e1a2660ec2 | 17 | #ifndef __BLE_COMMON_H__ |
rgrover1 | 710:b2e1a2660ec2 | 18 | #define __BLE_COMMON_H__ |
rgrover1 | 710:b2e1a2660ec2 | 19 | |
rgrover1 | 710:b2e1a2660ec2 | 20 | #ifdef __cplusplus |
rgrover1 | 710:b2e1a2660ec2 | 21 | extern "C" { |
rgrover1 | 710:b2e1a2660ec2 | 22 | #endif |
rgrover1 | 710:b2e1a2660ec2 | 23 | |
rgrover1 | 710:b2e1a2660ec2 | 24 | |
vcoubard | 1053:ec4a5b9b254e | 25 | /*! @brief Assigned values for BLE UUIDs. */ |
rgrover1 | 710:b2e1a2660ec2 | 26 | enum { |
rgrover1 | 710:b2e1a2660ec2 | 27 | BLE_UUID_UNKNOWN = 0x0000, /**< Reserved UUID. */ |
rgrover1 | 710:b2e1a2660ec2 | 28 | BLE_UUID_SERVICE_PRIMARY = 0x2800, /**< Primary Service. */ |
rgrover1 | 710:b2e1a2660ec2 | 29 | BLE_UUID_SERVICE_SECONDARY = 0x2801, /**< Secondary Service. */ |
rgrover1 | 710:b2e1a2660ec2 | 30 | BLE_UUID_SERVICE_INCLUDE = 0x2802, /**< Include. */ |
rgrover1 | 710:b2e1a2660ec2 | 31 | BLE_UUID_CHARACTERISTIC = 0x2803, /**< Characteristic. */ |
rgrover1 | 710:b2e1a2660ec2 | 32 | BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP = 0x2900, /**< Characteristic Extended Properties Descriptor. */ |
rgrover1 | 710:b2e1a2660ec2 | 33 | BLE_UUID_DESCRIPTOR_CHAR_USER_DESC = 0x2901, /**< Characteristic User Description Descriptor. */ |
rgrover1 | 710:b2e1a2660ec2 | 34 | BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG = 0x2902, /**< Client Characteristic Configuration Descriptor. */ |
rgrover1 | 710:b2e1a2660ec2 | 35 | BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG = 0x2903, /**< Server Characteristic Configuration Descriptor. */ |
rgrover1 | 710:b2e1a2660ec2 | 36 | BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT = 0x2904, /**< Characteristic Presentation Format Descriptor. */ |
rgrover1 | 710:b2e1a2660ec2 | 37 | BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT = 0x2905, /**< Characteristic Aggregate Format Descriptor. */ |
rgrover1 | 710:b2e1a2660ec2 | 38 | |
rgrover1 | 710:b2e1a2660ec2 | 39 | /* GATT specific UUIDs */ |
rgrover1 | 710:b2e1a2660ec2 | 40 | BLE_UUID_GATT = 0x1801, /**< Generic Attribute Profile. */ |
rgrover1 | 710:b2e1a2660ec2 | 41 | BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED = 0x2A05, /**< Service Changed Characteristic. */ |
rgrover1 | 710:b2e1a2660ec2 | 42 | |
rgrover1 | 710:b2e1a2660ec2 | 43 | /* GAP specific UUIDs */ |
rgrover1 | 710:b2e1a2660ec2 | 44 | BLE_UUID_GAP = 0x1800, /**< Generic Access Profile. */ |
rgrover1 | 710:b2e1a2660ec2 | 45 | BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME = 0x2A00, /**< Device Name Characteristic. */ |
rgrover1 | 710:b2e1a2660ec2 | 46 | BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE = 0x2A01, /**< Appearance Characteristic. */ |
rgrover1 | 710:b2e1a2660ec2 | 47 | BLE_UUID_GAP_CHARACTERISTIC_PPF = 0x2A02, /**< Peripheral Privacy Flag Characteristic. */ |
rgrover1 | 710:b2e1a2660ec2 | 48 | BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR = 0x2A03, /**< Reconnection Address Characteristic. */ |
rgrover1 | 710:b2e1a2660ec2 | 49 | BLE_UUID_GAP_CHARACTERISTIC_PPCP = 0x2A04, /**< Peripheral Preferred Connection Parameters Characteristic. */ |
rgrover1 | 710:b2e1a2660ec2 | 50 | }; |
rgrover1 | 710:b2e1a2660ec2 | 51 | |
vcoubard | 1053:ec4a5b9b254e | 52 | /*! @brief Error codes for the BLE API. */ |
rgrover1 | 710:b2e1a2660ec2 | 53 | enum ble_error_t { |
vcoubard | 1048:efb29faf12fc | 54 | BLE_ERROR_NONE = 0, /**< No error. */ |
vcoubard | 1048:efb29faf12fc | 55 | BLE_ERROR_BUFFER_OVERFLOW = 1, /**< The requested action would cause a buffer overflow and has been aborted. */ |
vcoubard | 1048:efb29faf12fc | 56 | BLE_ERROR_NOT_IMPLEMENTED = 2, /**< Requested a feature that isn't yet implemented or isn't supported by the target HW. */ |
vcoubard | 1048:efb29faf12fc | 57 | BLE_ERROR_PARAM_OUT_OF_RANGE = 3, /**< One of the supplied parameters is outside the valid range. */ |
vcoubard | 1048:efb29faf12fc | 58 | BLE_ERROR_INVALID_PARAM = 4, /**< One of the supplied parameters is invalid. */ |
vcoubard | 1048:efb29faf12fc | 59 | BLE_STACK_BUSY = 5, /**< The stack is busy. */ |
rgrover1 | 891:96514cb1c4c1 | 60 | BLE_ERROR_INVALID_STATE = 6, /**< Invalid state. */ |
vcoubard | 1048:efb29faf12fc | 61 | BLE_ERROR_NO_MEM = 7, /**< Out of memory */ |
rgrover1 | 891:96514cb1c4c1 | 62 | BLE_ERROR_OPERATION_NOT_PERMITTED = 8, |
rgrover1 | 891:96514cb1c4c1 | 63 | BLE_ERROR_INITIALIZATION_INCOMPLETE = 9, |
rgrover1 | 891:96514cb1c4c1 | 64 | BLE_ERROR_ALREADY_INITIALIZED = 10, |
rgrover1 | 891:96514cb1c4c1 | 65 | BLE_ERROR_UNSPECIFIED = 11, /**< Unknown error. */ |
rgrover1 | 710:b2e1a2660ec2 | 66 | }; |
rgrover1 | 710:b2e1a2660ec2 | 67 | |
rgrover1 | 728:997ba5e7b3b6 | 68 | /** @brief Default MTU size. */ |
rgrover1 | 728:997ba5e7b3b6 | 69 | static const unsigned BLE_GATT_MTU_SIZE_DEFAULT = 23; |
rgrover1 | 728:997ba5e7b3b6 | 70 | |
rgrover1 | 737:79d95f9b93be | 71 | enum HVXType_t { |
rgrover1 | 737:79d95f9b93be | 72 | BLE_HVX_NOTIFICATION = 0x01, /**< Handle Value Notification. */ |
rgrover1 | 737:79d95f9b93be | 73 | BLE_HVX_INDICATION = 0x02, /**< Handle Value Indication. */ |
rgrover1 | 737:79d95f9b93be | 74 | }; |
rgrover1 | 737:79d95f9b93be | 75 | |
rgrover1 | 710:b2e1a2660ec2 | 76 | #ifdef __cplusplus |
rgrover1 | 710:b2e1a2660ec2 | 77 | } |
rgrover1 | 710:b2e1a2660ec2 | 78 | #endif |
rgrover1 | 710:b2e1a2660ec2 | 79 | |
rgrover1 | 710:b2e1a2660ec2 | 80 | #endif // ifndef __BLE_COMMON_H__ |