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