BLE lib

Fork of Nucleo_BLE_API by STM32 eKairn

Committer:
sjallouli
Date:
Fri Dec 19 18:54:46 2014 +0000
Revision:
0:289fd2dae405
BLE_API for Nucleo Bluetoothe Low Energy Shield

Who changed what in which revision?

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