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