High level Bluetooth Low Energy API and radio abstraction layer

Dependencies:   nRF51822

Dependents:   LinkNode_LIS3DH

Fork of BLE_API by Bluetooth Low Energy

Committer:
rgrover1
Date:
Fri Jun 19 15:53:01 2015 +0100
Revision:
669:7179b4a5aa7d
Parent:
667:875aecb84719
Child:
670:5e4aecd9af5b
Synchronized with git rev 9bcd7433
Author: Rohit Grover
Rename BLEDevice as BLE. Retain an alias to BLEDevice for the sake of compatibility with old code.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rgrover1 260:ea7f9f14cc15 1 /* mbed Microcontroller Library
rgrover1 260:ea7f9f14cc15 2 * Copyright (c) 2006-2013 ARM Limited
rgrover1 260:ea7f9f14cc15 3 *
rgrover1 260:ea7f9f14cc15 4 * Licensed under the Apache License, Version 2.0 (the "License");
rgrover1 260:ea7f9f14cc15 5 * you may not use this file except in compliance with the License.
rgrover1 260:ea7f9f14cc15 6 * You may obtain a copy of the License at
rgrover1 260:ea7f9f14cc15 7 *
rgrover1 260:ea7f9f14cc15 8 * http://www.apache.org/licenses/LICENSE-2.0
rgrover1 260:ea7f9f14cc15 9 *
rgrover1 260:ea7f9f14cc15 10 * Unless required by applicable law or agreed to in writing, software
rgrover1 260:ea7f9f14cc15 11 * distributed under the License is distributed on an "AS IS" BASIS,
rgrover1 260:ea7f9f14cc15 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rgrover1 260:ea7f9f14cc15 13 * See the License for the specific language governing permissions and
rgrover1 260:ea7f9f14cc15 14 * limitations under the License.
rgrover1 260:ea7f9f14cc15 15 */
rgrover1 260:ea7f9f14cc15 16
rgrover1 260:ea7f9f14cc15 17 #ifndef __BLE_COMMON_H__
rgrover1 260:ea7f9f14cc15 18 #define __BLE_COMMON_H__
rgrover1 260:ea7f9f14cc15 19
rgrover1 260:ea7f9f14cc15 20 #ifdef __cplusplus
rgrover1 260:ea7f9f14cc15 21 extern "C" {
rgrover1 260:ea7f9f14cc15 22 #endif
rgrover1 260:ea7f9f14cc15 23
rgrover1 669:7179b4a5aa7d 24 #include <stdint.h>
rgrover1 669:7179b4a5aa7d 25 #include <stddef.h>
rgrover1 260:ea7f9f14cc15 26
rgrover1 260:ea7f9f14cc15 27 /** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs
rgrover1 260:ea7f9f14cc15 28 * @{ */
rgrover1 260:ea7f9f14cc15 29 /* Generic UUIDs, applicable to all services */
rgrover1 260:ea7f9f14cc15 30 enum {
rgrover1 260:ea7f9f14cc15 31 BLE_UUID_UNKNOWN = 0x0000, /**< Reserved UUID. */
rgrover1 260:ea7f9f14cc15 32 BLE_UUID_SERVICE_PRIMARY = 0x2800, /**< Primary Service. */
rgrover1 260:ea7f9f14cc15 33 BLE_UUID_SERVICE_SECONDARY = 0x2801, /**< Secondary Service. */
rgrover1 260:ea7f9f14cc15 34 BLE_UUID_SERVICE_INCLUDE = 0x2802, /**< Include. */
rgrover1 260:ea7f9f14cc15 35 BLE_UUID_CHARACTERISTIC = 0x2803, /**< Characteristic. */
rgrover1 260:ea7f9f14cc15 36 BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP = 0x2900, /**< Characteristic Extended Properties Descriptor. */
rgrover1 260:ea7f9f14cc15 37 BLE_UUID_DESCRIPTOR_CHAR_USER_DESC = 0x2901, /**< Characteristic User Description Descriptor. */
rgrover1 260:ea7f9f14cc15 38 BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG = 0x2902, /**< Client Characteristic Configuration Descriptor. */
rgrover1 260:ea7f9f14cc15 39 BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG = 0x2903, /**< Server Characteristic Configuration Descriptor. */
rgrover1 260:ea7f9f14cc15 40 BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT = 0x2904, /**< Characteristic Presentation Format Descriptor. */
rgrover1 260:ea7f9f14cc15 41 BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT = 0x2905, /**< Characteristic Aggregate Format Descriptor. */
rgrover1 260:ea7f9f14cc15 42
rgrover1 260:ea7f9f14cc15 43 /* GATT specific UUIDs */
rgrover1 260:ea7f9f14cc15 44 BLE_UUID_GATT = 0x1801, /**< Generic Attribute Profile. */
rgrover1 260:ea7f9f14cc15 45 BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED = 0x2A05, /**< Service Changed Characteristic. */
rgrover1 260:ea7f9f14cc15 46
rgrover1 260:ea7f9f14cc15 47 /* GAP specific UUIDs */
rgrover1 260:ea7f9f14cc15 48 BLE_UUID_GAP = 0x1800, /**< Generic Access Profile. */
rgrover1 260:ea7f9f14cc15 49 BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME = 0x2A00, /**< Device Name Characteristic. */
rgrover1 260:ea7f9f14cc15 50 BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE = 0x2A01, /**< Appearance Characteristic. */
rgrover1 260:ea7f9f14cc15 51 BLE_UUID_GAP_CHARACTERISTIC_PPF = 0x2A02, /**< Peripheral Privacy Flag Characteristic. */
rgrover1 260:ea7f9f14cc15 52 BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR = 0x2A03, /**< Reconnection Address Characteristic. */
rgrover1 260:ea7f9f14cc15 53 BLE_UUID_GAP_CHARACTERISTIC_PPCP = 0x2A04, /**< Peripheral Preferred Connection Parameters Characteristic. */
rgrover1 260:ea7f9f14cc15 54 };
rgrover1 260:ea7f9f14cc15 55 /** @} */
rgrover1 260:ea7f9f14cc15 56
rgrover1 260:ea7f9f14cc15 57 /** @defgroup BLE_APPEARANCES Bluetooth Appearance values
rgrover1 260:ea7f9f14cc15 58 * @note Retrieved from http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml
rgrover1 260:ea7f9f14cc15 59 * @{ */
rgrover1 260:ea7f9f14cc15 60 enum {
rgrover1 260:ea7f9f14cc15 61 BLE_APPEARANCE_UNKNOWN = 0, /**< Unknown. */
rgrover1 260:ea7f9f14cc15 62 BLE_APPEARANCE_GENERIC_PHONE = 64, /**< Generic Phone. */
rgrover1 260:ea7f9f14cc15 63 BLE_APPEARANCE_GENERIC_COMPUTER = 128, /**< Generic Computer. */
rgrover1 260:ea7f9f14cc15 64 BLE_APPEARANCE_GENERIC_WATCH = 192, /**< Generic Watch. */
rgrover1 260:ea7f9f14cc15 65 BLE_APPEARANCE_WATCH_SPORTS_WATCH = 193, /**< Watch: Sports Watch. */
rgrover1 260:ea7f9f14cc15 66 BLE_APPEARANCE_GENERIC_CLOCK = 256, /**< Generic Clock. */
rgrover1 260:ea7f9f14cc15 67 BLE_APPEARANCE_GENERIC_DISPLAY = 320, /**< Generic Display. */
rgrover1 260:ea7f9f14cc15 68 BLE_APPEARANCE_GENERIC_REMOTE_CONTROL = 384, /**< Generic Remote Control. */
rgrover1 260:ea7f9f14cc15 69 BLE_APPEARANCE_GENERIC_EYE_GLASSES = 448, /**< Generic Eye-glasses. */
rgrover1 260:ea7f9f14cc15 70 BLE_APPEARANCE_GENERIC_TAG = 512, /**< Generic Tag. */
rgrover1 260:ea7f9f14cc15 71 BLE_APPEARANCE_GENERIC_KEYRING = 576, /**< Generic Keyring. */
rgrover1 260:ea7f9f14cc15 72 BLE_APPEARANCE_GENERIC_MEDIA_PLAYER = 640, /**< Generic Media Player. */
rgrover1 260:ea7f9f14cc15 73 BLE_APPEARANCE_GENERIC_BARCODE_SCANNER = 704, /**< Generic Barcode Scanner. */
rgrover1 260:ea7f9f14cc15 74 BLE_APPEARANCE_GENERIC_THERMOMETER = 768, /**< Generic Thermometer. */
rgrover1 260:ea7f9f14cc15 75 BLE_APPEARANCE_THERMOMETER_EAR = 769, /**< Thermometer: Ear. */
rgrover1 260:ea7f9f14cc15 76 BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR = 832, /**< Generic Heart rate Sensor. */
rgrover1 260:ea7f9f14cc15 77 BLE_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT = 833, /**< Heart Rate Sensor: Heart Rate Belt. */
rgrover1 260:ea7f9f14cc15 78 BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE = 896, /**< Generic Blood Pressure. */
rgrover1 260:ea7f9f14cc15 79 BLE_APPEARANCE_BLOOD_PRESSURE_ARM = 897, /**< Blood Pressure: Arm. */
rgrover1 260:ea7f9f14cc15 80 BLE_APPEARANCE_BLOOD_PRESSURE_WRIST = 898, /**< Blood Pressure: Wrist. */
rgrover1 260:ea7f9f14cc15 81 BLE_APPEARANCE_GENERIC_HID = 960, /**< Human Interface Device (HID). */
rgrover1 260:ea7f9f14cc15 82 BLE_APPEARANCE_HID_KEYBOARD = 961, /**< Keyboard (HID Subtype). */
rgrover1 260:ea7f9f14cc15 83 BLE_APPEARANCE_HID_MOUSE = 962, /**< Mouse (HID Subtype). */
rgrover1 260:ea7f9f14cc15 84 BLE_APPEARANCE_HID_JOYSTICK = 963, /**< Joystiq (HID Subtype). */
rgrover1 260:ea7f9f14cc15 85 BLE_APPEARANCE_HID_GAMEPAD = 964, /**< Gamepad (HID Subtype). */
rgrover1 260:ea7f9f14cc15 86 BLE_APPEARANCE_HID_DIGITIZERSUBTYPE = 965, /**< Digitizer Tablet (HID Subtype). */
rgrover1 260:ea7f9f14cc15 87 BLE_APPEARANCE_HID_CARD_READER = 966, /**< Card Reader (HID Subtype). */
rgrover1 260:ea7f9f14cc15 88 BLE_APPEARANCE_HID_DIGITAL_PEN = 967, /**< Digital Pen (HID Subtype). */
rgrover1 260:ea7f9f14cc15 89 BLE_APPEARANCE_HID_BARCODE = 968, /**< Barcode Scanner (HID Subtype). */
rgrover1 260:ea7f9f14cc15 90 BLE_APPEARANCE_GENERIC_GLUCOSE_METER = 1024, /**< Generic Glucose Meter. */
rgrover1 260:ea7f9f14cc15 91 BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR = 1088, /**< Generic Running Walking Sensor. */
rgrover1 260:ea7f9f14cc15 92 BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE = 1089, /**< Running Walking Sensor: In-Shoe. */
rgrover1 260:ea7f9f14cc15 93 BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE = 1090, /**< Running Walking Sensor: On-Shoe. */
rgrover1 260:ea7f9f14cc15 94 BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP = 1091, /**< Running Walking Sensor: On-Hip. */
rgrover1 260:ea7f9f14cc15 95 BLE_APPEARANCE_GENERIC_CYCLING = 1152, /**< Generic Cycling. */
rgrover1 260:ea7f9f14cc15 96 BLE_APPEARANCE_CYCLING_CYCLING_COMPUTER = 1153, /**< Cycling: Cycling Computer. */
rgrover1 260:ea7f9f14cc15 97 BLE_APPEARANCE_CYCLING_SPEED_SENSOR = 1154, /**< Cycling: Speed Sensor. */
rgrover1 260:ea7f9f14cc15 98 BLE_APPEARANCE_CYCLING_CADENCE_SENSOR = 1155, /**< Cycling: Cadence Sensor. */
rgrover1 260:ea7f9f14cc15 99 BLE_APPEARANCE_CYCLING_POWER_SENSOR = 1156, /**< Cycling: Power Sensor. */
rgrover1 260:ea7f9f14cc15 100 BLE_APPEARANCE_CYCLING_SPEED_CADENCE_SENSOR = 1157, /**< Cycling: Speed and Cadence Sensor. */
rgrover1 260:ea7f9f14cc15 101 BLE_APPEARANCE_GENERIC_PULSE_OXIMETER = 3136, /**< Generic Pulse Oximeter. */
rgrover1 260:ea7f9f14cc15 102 BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP = 3137, /**< Fingertip (Pulse Oximeter subtype). */
rgrover1 260:ea7f9f14cc15 103 BLE_APPEARANCE_PULSE_OXIMETER_WRIST_WORN = 3138, /**< Wrist Worn(Pulse Oximeter subtype). */
rgrover1 260:ea7f9f14cc15 104 BLE_APPEARANCE_GENERIC_WEIGHT_SCALE = 3200, /**< Generic Weight Scale. */
rgrover1 260:ea7f9f14cc15 105 BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT = 5184, /**< Generic Outdoor Sports Activity. */
rgrover1 260:ea7f9f14cc15 106 BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_DISP = 5185, /**< Location Display Device (Outdoor Sports Activity subtype). */
rgrover1 260:ea7f9f14cc15 107 BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_DISP = 5186, /**< Location and Navigation Display Device (Outdoor Sports Activity subtype). */
rgrover1 260:ea7f9f14cc15 108 BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_POD = 5187, /**< Location Pod (Outdoor Sports Activity subtype). */
rgrover1 260:ea7f9f14cc15 109 BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_POD = 5188, /**< Location and Navigation Pod (Outdoor Sports Activity subtype). */
rgrover1 260:ea7f9f14cc15 110 };
rgrover1 260:ea7f9f14cc15 111 /** @} */
rgrover1 260:ea7f9f14cc15 112
rgrover1 260:ea7f9f14cc15 113 /**************************************************************************/
rgrover1 260:ea7f9f14cc15 114 /*!
rgrover1 260:ea7f9f14cc15 115 \brief Error codes for the BLE API
rgrover1 260:ea7f9f14cc15 116 */
rgrover1 260:ea7f9f14cc15 117 /**************************************************************************/
rgrover1 669:7179b4a5aa7d 118 typedef enum ble_error_e
rgrover1 669:7179b4a5aa7d 119 {
rgrover1 669:7179b4a5aa7d 120 BLE_ERROR_NONE = 0, /**< No error */
rgrover1 669:7179b4a5aa7d 121 BLE_ERROR_BUFFER_OVERFLOW = 1, /**< The requested action would cause a buffer overflow and has been aborted */
rgrover1 669:7179b4a5aa7d 122 BLE_ERROR_NOT_IMPLEMENTED = 2, /**< Requested a feature that isn't yet implement or isn't supported by the target HW */
rgrover1 669:7179b4a5aa7d 123 BLE_ERROR_PARAM_OUT_OF_RANGE = 3, /**< One of the supplied parameters is outside the valid range */
rgrover1 669:7179b4a5aa7d 124 BLE_ERROR_INVALID_PARAM = 4, /**< One of the supplied parameters is invalid */
rgrover1 669:7179b4a5aa7d 125 BLE_STACK_BUSY = 5, /**< The stack is busy */
rgrover1 669:7179b4a5aa7d 126 BLE_ERROR_INVALID_STATE = 6, /**< Invalid state. */
rgrover1 669:7179b4a5aa7d 127 BLE_ERROR_NO_MEM = 7, /**< Out of Memory */
rgrover1 669:7179b4a5aa7d 128 BLE_ERROR_UNSPECIFIED = 8, /**< Unknown error. */
rgrover1 669:7179b4a5aa7d 129 } ble_error_t;
rgrover1 260:ea7f9f14cc15 130
rgrover1 260:ea7f9f14cc15 131 #ifdef __cplusplus
rgrover1 260:ea7f9f14cc15 132 }
rgrover1 260:ea7f9f14cc15 133 #endif
rgrover1 260:ea7f9f14cc15 134
rgrover1 260:ea7f9f14cc15 135 #endif // ifndef __BLE_COMMON_H__