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
blecommon.h@3:46de446e82ed, 2013-12-11 (annotated)
- Committer:
- ktownsend
- Date:
- Wed Dec 11 22:15:59 2013 +0000
- Revision:
- 3:46de446e82ed
- Parent:
- 2:ffc5216bd2cc
- Child:
- 4:50a31ff5f974
Incremental changes for GAP Advertising API
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ktownsend | 0:ace2e8d3ce79 | 1 | #ifndef __BLE_COMMON_H__ |
| ktownsend | 0:ace2e8d3ce79 | 2 | #define __BLE_COMMON_H__ |
| ktownsend | 0:ace2e8d3ce79 | 3 | |
| ktownsend | 0:ace2e8d3ce79 | 4 | #include <stdint.h> |
| ktownsend | 0:ace2e8d3ce79 | 5 | |
| ktownsend | 0:ace2e8d3ce79 | 6 | typedef enum ble_error_e |
| ktownsend | 0:ace2e8d3ce79 | 7 | { |
| ktownsend | 3:46de446e82ed | 8 | BLE_ERROR_NONE = 0, |
| ktownsend | 3:46de446e82ed | 9 | BLE_ERROR_BUFFER_OVERFLOW = 1 |
| ktownsend | 0:ace2e8d3ce79 | 10 | } ble_error_t; |
| ktownsend | 0:ace2e8d3ce79 | 11 | |
| ktownsend | 3:46de446e82ed | 12 | /* Bluetooth Specification 4.0 (Vol. 3) Section 18.1 */ |
| ktownsend | 2:ffc5216bd2cc | 13 | typedef enum ble_gap_adv_flags_e |
| ktownsend | 2:ffc5216bd2cc | 14 | { |
| ktownsend | 3:46de446e82ed | 15 | BLE_GAP_ADV_FLAGS_LE_LIMITED_DISCOVERABLE = 0x01, |
| ktownsend | 3:46de446e82ed | 16 | BLE_GAP_ADV_FLAGS_LE_GENERAL_DISCOVERABLE = 0x02, |
| ktownsend | 3:46de446e82ed | 17 | BLE_GAP_ADV_FLAGS_BREDR_NOT_SUPPORTED = 0x04, |
| ktownsend | 3:46de446e82ed | 18 | BLE_GAP_ADV_FLAGS_SIMULTANEOUS_LE_BREDR_C = 0x08, |
| ktownsend | 3:46de446e82ed | 19 | BLE_GAP_ADV_FLAGS_SIMULTANEOUS_LE_BREDR_H = 0x10 |
| ktownsend | 2:ffc5216bd2cc | 20 | } ble_gap_adv_flags_t; |
| ktownsend | 2:ffc5216bd2cc | 21 | |
| ktownsend | 3:46de446e82ed | 22 | /* https://www.bluetooth.org/en-us/specification/assigned-numbers/generic-access-profile */ |
| ktownsend | 3:46de446e82ed | 23 | /* Bluetooth Specification 4.0 (Vol. 3) Section 11, 18 */ |
| ktownsend | 2:ffc5216bd2cc | 24 | typedef enum ble_gap_adv_datatype_e |
| ktownsend | 2:ffc5216bd2cc | 25 | { |
| ktownsend | 3:46de446e82ed | 26 | BLE_GAP_ADV_DATATYPE_FLAGS = 0x01, |
| ktownsend | 3:46de446e82ed | 27 | BLE_GAP_ADV_DATATYPE_INCOMPLETE_LIST_16BIT_SERVICE_IDS = 0x02, |
| ktownsend | 3:46de446e82ed | 28 | BLE_GAP_ADV_DATATYPE_COMPLETE_LIST_16BIT_SERVICE_IDS = 0x03, |
| ktownsend | 3:46de446e82ed | 29 | BLE_GAP_ADV_DATATYPE_INCOMPLETE_LIST_32BIT_SERVICE_IDS = 0x04, |
| ktownsend | 3:46de446e82ed | 30 | BLE_GAP_ADV_DATATYPE_COMPLETE_LIST_32BIT_SERVICE_IDS = 0x05, |
| ktownsend | 3:46de446e82ed | 31 | BLE_GAP_ADV_DATATYPE_INCOMPLETE_LIST_128BIT_SERVICE_IDS = 0x06, |
| ktownsend | 3:46de446e82ed | 32 | BLE_GAP_ADV_DATATYPE_COMPLETE_LIST_128BIT_SERVICE_IDS = 0x07, |
| ktownsend | 3:46de446e82ed | 33 | BLE_GAP_ADV_DATATYPE_SHORTENED_LOCAL_NAME = 0x08, |
| ktownsend | 3:46de446e82ed | 34 | BLE_GAP_ADV_DATATYPE_COMPLETE_LOCAL_NAME = 0x09, |
| ktownsend | 3:46de446e82ed | 35 | BLE_GAP_ADV_DATATYPE_TX_POWER_LEVEL = 0x0A, |
| ktownsend | 3:46de446e82ed | 36 | BLE_GAP_ADV_DATATYPE_DEVICE_ID = 0x10, |
| ktownsend | 3:46de446e82ed | 37 | BLE_GAP_ADV_DATATYPE_SLAVE_CONNECTION_INTERVAL_RANGE = 0x12, |
| ktownsend | 3:46de446e82ed | 38 | BLE_GAP_ADV_DATATYPE_SERVICE_DATA = 0x16, |
| ktownsend | 3:46de446e82ed | 39 | BLE_GAP_ADV_DATATYPE_APPEARANCE = 0x19, |
| ktownsend | 3:46de446e82ed | 40 | BLE_GAP_ADV_DATATYPE_ADVERTISING_INTERVAL = 0x1A, |
| ktownsend | 3:46de446e82ed | 41 | BLE_GAP_ADV_DATATYPE_MANUFACTURER_SPECIFIC_DATA = 0xFF |
| ktownsend | 2:ffc5216bd2cc | 42 | } ble_gap_adv_datatype_t; |
| ktownsend | 2:ffc5216bd2cc | 43 | |
| ktownsend | 0:ace2e8d3ce79 | 44 | // https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml |
| ktownsend | 0:ace2e8d3ce79 | 45 | typedef enum ble_gap_char_appearance_e |
| ktownsend | 0:ace2e8d3ce79 | 46 | { |
| ktownsend | 0:ace2e8d3ce79 | 47 | BLE_GAP_CHAR_APPEARANCE_UNKNOWN = 0, |
| ktownsend | 0:ace2e8d3ce79 | 48 | BLE_GAP_CHAR_APPEARANCE_GENERIC_PHONE = 64, |
| ktownsend | 0:ace2e8d3ce79 | 49 | BLE_GAP_CHAR_APPEARANCE_GENERIC_COMPUTER = 128, |
| ktownsend | 0:ace2e8d3ce79 | 50 | BLE_GAP_CHAR_APPEARANCE_GENERIC_WATCH = 192, |
| ktownsend | 0:ace2e8d3ce79 | 51 | BLE_GAP_CHAR_APPEARANCE_WATCH_SPORTS_WATCH = 193, |
| ktownsend | 0:ace2e8d3ce79 | 52 | BLE_GAP_CHAR_APPEARANCE_GENERIC_CLOCK = 256, |
| ktownsend | 0:ace2e8d3ce79 | 53 | BLE_GAP_CHAR_APPEARANCE_GENERIC_DISPLAY = 320, |
| ktownsend | 0:ace2e8d3ce79 | 54 | BLE_GAP_CHAR_APPEARANCE_GENERIC_REMOTE_CONTROL = 384, |
| ktownsend | 0:ace2e8d3ce79 | 55 | BLE_GAP_CHAR_APPEARANCE_GENERIC_EYE_GLASSES = 448, |
| ktownsend | 0:ace2e8d3ce79 | 56 | BLE_GAP_CHAR_APPEARANCE_GENERIC_TAG = 512, |
| ktownsend | 0:ace2e8d3ce79 | 57 | BLE_GAP_CHAR_APPEARANCE_GENERIC_KEYRING = 576, |
| ktownsend | 0:ace2e8d3ce79 | 58 | BLE_GAP_CHAR_APPEARANCE_GENERIC_MEDIA_PLAYER = 640, |
| ktownsend | 0:ace2e8d3ce79 | 59 | BLE_GAP_CHAR_APPEARANCE_GENERIC_BARCODE_SCANNER = 704, |
| ktownsend | 0:ace2e8d3ce79 | 60 | BLE_GAP_CHAR_APPEARANCE_GENERIC_THERMOMETER = 768, |
| ktownsend | 0:ace2e8d3ce79 | 61 | BLE_GAP_CHAR_APPEARANCE_THERMOMETER_EAR = 769, |
| ktownsend | 0:ace2e8d3ce79 | 62 | BLE_GAP_CHAR_APPEARANCE_GENERIC_HEART_RATE_SENSOR = 832, |
| ktownsend | 0:ace2e8d3ce79 | 63 | BLE_GAP_CHAR_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT = 833, |
| ktownsend | 0:ace2e8d3ce79 | 64 | BLE_GAP_CHAR_APPEARANCE_GENERIC_BLOOD_PRESSURE = 896, |
| ktownsend | 0:ace2e8d3ce79 | 65 | BLE_GAP_CHAR_APPEARANCE_BLOOD_PRESSURE_ARM = 897, |
| ktownsend | 3:46de446e82ed | 66 | BLE_GAP_CHAR_APPEARANCE_BLOOD_PRESSURE_WRIST = 898, |
| ktownsend | 0:ace2e8d3ce79 | 67 | BLE_GAP_CHAR_APPEARANCE_HUMAN_INTERFACE_DEVICE_HID = 960, |
| ktownsend | 0:ace2e8d3ce79 | 68 | BLE_GAP_CHAR_APPEARANCE_KEYBOARD = 961, |
| ktownsend | 0:ace2e8d3ce79 | 69 | BLE_GAP_CHAR_APPEARANCE_MOUSE = 962, |
| ktownsend | 0:ace2e8d3ce79 | 70 | BLE_GAP_CHAR_APPEARANCE_JOYSTICK = 963, |
| ktownsend | 0:ace2e8d3ce79 | 71 | BLE_GAP_CHAR_APPEARANCE_GAMEPAD = 964, |
| ktownsend | 0:ace2e8d3ce79 | 72 | BLE_GAP_CHAR_APPEARANCE_DIGITIZER_TABLET = 965, |
| ktownsend | 0:ace2e8d3ce79 | 73 | BLE_GAP_CHAR_APPEARANCE_CARD_READER = 966, |
| ktownsend | 0:ace2e8d3ce79 | 74 | BLE_GAP_CHAR_APPEARANCE_DIGITAL_PEN = 967, |
| ktownsend | 0:ace2e8d3ce79 | 75 | BLE_GAP_CHAR_APPEARANCE_BARCODE_SCANNER = 968, |
| ktownsend | 0:ace2e8d3ce79 | 76 | BLE_GAP_CHAR_APPEARANCE_GENERIC_GLUCOSE_METER = 1024, |
| ktownsend | 0:ace2e8d3ce79 | 77 | BLE_GAP_CHAR_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR = 1088, |
| ktownsend | 0:ace2e8d3ce79 | 78 | BLE_GAP_CHAR_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE = 1089, |
| ktownsend | 0:ace2e8d3ce79 | 79 | BLE_GAP_CHAR_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE = 1090, |
| ktownsend | 0:ace2e8d3ce79 | 80 | BLE_GAP_CHAR_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP = 1091, |
| ktownsend | 0:ace2e8d3ce79 | 81 | BLE_GAP_CHAR_APPEARANCE_GENERIC_CYCLING = 1152, |
| ktownsend | 0:ace2e8d3ce79 | 82 | BLE_GAP_CHAR_APPEARANCE_CYCLING_CYCLING_COMPUTER = 1153, |
| ktownsend | 0:ace2e8d3ce79 | 83 | BLE_GAP_CHAR_APPEARANCE_CYCLING_SPEED_SENSOR = 1154, |
| ktownsend | 0:ace2e8d3ce79 | 84 | BLE_GAP_CHAR_APPEARANCE_CYCLING_CADENCE_SENSOR = 1155, |
| ktownsend | 0:ace2e8d3ce79 | 85 | BLE_GAP_CHAR_APPEARANCE_CYCLING_POWER_SENSOR = 1156, |
| ktownsend | 0:ace2e8d3ce79 | 86 | BLE_GAP_CHAR_APPEARANCE_CYCLING_SPEED_AND_CADENCE_SENSOR = 1157, |
| ktownsend | 0:ace2e8d3ce79 | 87 | BLE_GAP_CHAR_APPEARANCE_PULSE_OXIMETER_GENERIC = 3136, |
| ktownsend | 2:ffc5216bd2cc | 88 | BLE_GAP_CHAR_APPEARANCE_PULSE_OXIMETER_FINGERTIP = 3137, |
| ktownsend | 2:ffc5216bd2cc | 89 | BLE_GAP_CHAR_APPEARANCE_PULSE_OXIMETER_WRIST_WORN = 3138, |
| ktownsend | 0:ace2e8d3ce79 | 90 | BLE_GAP_CHAR_APPEARANCE_OUTDOOR_GENERIC = 5184, |
| ktownsend | 0:ace2e8d3ce79 | 91 | BLE_GAP_CHAR_APPEARANCE_OUTDOOR_LOCATION_DISPLAY_DEVICE = 5185, |
| ktownsend | 0:ace2e8d3ce79 | 92 | BLE_GAP_CHAR_APPEARANCE_OUTDOOR_LOCATION_AND_NAVIGATION_DISPLAY_DEVICE = 5186, |
| ktownsend | 0:ace2e8d3ce79 | 93 | BLE_GAP_CHAR_APPEARANCE_OUTDOOR_LOCATION_POD = 5187, |
| ktownsend | 0:ace2e8d3ce79 | 94 | BLE_GAP_CHAR_APPEARANCE_OUTDOOR_LOCATION_AND_NAVIGATION_POD = 5188 |
| ktownsend | 0:ace2e8d3ce79 | 95 | } ble_gap_char_appearance_t; |
| ktownsend | 0:ace2e8d3ce79 | 96 | |
| ktownsend | 0:ace2e8d3ce79 | 97 | // https://developer.bluetooth.org/gatt/units/Pages/default.aspx |
| ktownsend | 0:ace2e8d3ce79 | 98 | typedef enum ble_gatt_unit_e |
| ktownsend | 0:ace2e8d3ce79 | 99 | { |
| ktownsend | 0:ace2e8d3ce79 | 100 | BLE_GATT_UNIT_NONE = 0x2700, |
| ktownsend | 0:ace2e8d3ce79 | 101 | BLE_GATT_UNIT_LENGTH_METRE = 0x2701, |
| ktownsend | 0:ace2e8d3ce79 | 102 | BLE_GATT_UNIT_MASS_KILOGRAM = 0x2702, |
| ktownsend | 0:ace2e8d3ce79 | 103 | BLE_GATT_UNIT_TIME_SECOND = 0x2703, |
| ktownsend | 0:ace2e8d3ce79 | 104 | BLE_GATT_UNIT_ELECTRIC_CURRENT_AMPERE = 0x2704, |
| ktownsend | 0:ace2e8d3ce79 | 105 | BLE_GATT_UNIT_THERMODYNAMIC_TEMPERATURE_KELVIN = 0x2705, |
| ktownsend | 0:ace2e8d3ce79 | 106 | BLE_GATT_UNIT_AMOUNT_OF_SUBSTANCE_MOLE = 0x2706, |
| ktownsend | 0:ace2e8d3ce79 | 107 | BLE_GATT_UNIT_LUMINOUS_INTENSITY_CANDELA = 0x2707, |
| ktownsend | 0:ace2e8d3ce79 | 108 | BLE_GATT_UNIT_AREA_SQUARE_METRES = 0x2710, |
| ktownsend | 0:ace2e8d3ce79 | 109 | BLE_GATT_UNIT_VOLUME_CUBIC_METRES = 0x2711, |
| ktownsend | 0:ace2e8d3ce79 | 110 | BLE_GATT_UNIT_VELOCITY_METRES_PER_SECOND = 0x2712, |
| ktownsend | 0:ace2e8d3ce79 | 111 | BLE_GATT_UNIT_ACCELERATION_METRES_PER_SECOND_SQUARED = 0x2713, |
| ktownsend | 0:ace2e8d3ce79 | 112 | BLE_GATT_UNIT_WAVENUMBER_RECIPROCAL_METRE = 0x2714, |
| ktownsend | 0:ace2e8d3ce79 | 113 | BLE_GATT_UNIT_DENSITY_KILOGRAM_PER_CUBIC_METRE = 0x2715, |
| ktownsend | 0:ace2e8d3ce79 | 114 | BLE_GATT_UNIT_SURFACE_DENSITY_KILOGRAM_PER_SQUARE_METRE = 0x2716, |
| ktownsend | 0:ace2e8d3ce79 | 115 | BLE_GATT_UNIT_SPECIFIC_VOLUME_CUBIC_METRE_PER_KILOGRAM = 0x2717, |
| ktownsend | 0:ace2e8d3ce79 | 116 | BLE_GATT_UNIT_CURRENT_DENSITY_AMPERE_PER_SQUARE_METRE = 0x2718, |
| ktownsend | 0:ace2e8d3ce79 | 117 | BLE_GATT_UNIT_MAGNETIC_FIELD_STRENGTH_AMPERE_PER_METRE = 0x2719, |
| ktownsend | 0:ace2e8d3ce79 | 118 | BLE_GATT_UNIT_AMOUNT_CONCENTRATION_MOLE_PER_CUBIC_METRE = 0x271A, |
| ktownsend | 0:ace2e8d3ce79 | 119 | BLE_GATT_UNIT_MASS_CONCENTRATION_KILOGRAM_PER_CUBIC_METRE = 0x271B, |
| ktownsend | 0:ace2e8d3ce79 | 120 | BLE_GATT_UNIT_LUMINANCE_CANDELA_PER_SQUARE_METRE = 0x271C, |
| ktownsend | 0:ace2e8d3ce79 | 121 | BLE_GATT_UNIT_REFRACTIVE_INDEX = 0x271D, |
| ktownsend | 0:ace2e8d3ce79 | 122 | BLE_GATT_UNIT_RELATIVE_PERMEABILITY = 0x271E, |
| ktownsend | 0:ace2e8d3ce79 | 123 | BLE_GATT_UNIT_PLANE_ANGLE_RADIAN = 0x2720, |
| ktownsend | 0:ace2e8d3ce79 | 124 | BLE_GATT_UNIT_SOLID_ANGLE_STERADIAN = 0x2721, |
| ktownsend | 0:ace2e8d3ce79 | 125 | BLE_GATT_UNIT_FREQUENCY_HERTZ = 0x2722, |
| ktownsend | 0:ace2e8d3ce79 | 126 | BLE_GATT_UNIT_FORCE_NEWTON = 0x2723, |
| ktownsend | 0:ace2e8d3ce79 | 127 | BLE_GATT_UNIT_PRESSURE_PASCAL = 0x2724, |
| ktownsend | 0:ace2e8d3ce79 | 128 | BLE_GATT_UNIT_ENERGY_JOULE = 0x2725, |
| ktownsend | 0:ace2e8d3ce79 | 129 | BLE_GATT_UNIT_POWER_WATT = 0x2726, |
| ktownsend | 0:ace2e8d3ce79 | 130 | BLE_GATT_UNIT_ELECTRIC_CHARGE_COULOMB = 0x2727, |
| ktownsend | 0:ace2e8d3ce79 | 131 | BLE_GATT_UNIT_ELECTRIC_POTENTIAL_DIFFERENCE_VOLT = 0x2728, |
| ktownsend | 0:ace2e8d3ce79 | 132 | BLE_GATT_UNIT_CAPACITANCE_FARAD = 0x2729, |
| ktownsend | 0:ace2e8d3ce79 | 133 | BLE_GATT_UNIT_ELECTRIC_RESISTANCE_OHM = 0x272A, |
| ktownsend | 0:ace2e8d3ce79 | 134 | BLE_GATT_UNIT_ELECTRIC_CONDUCTANCE_SIEMENS = 0x272B, |
| ktownsend | 0:ace2e8d3ce79 | 135 | BLE_GATT_UNIT_MAGNETIC_FLEX_WEBER = 0x272C, |
| ktownsend | 0:ace2e8d3ce79 | 136 | BLE_GATT_UNIT_MAGNETIC_FLEX_DENSITY_TESLA = 0x272D, |
| ktownsend | 0:ace2e8d3ce79 | 137 | BLE_GATT_UNIT_INDUCTANCE_HENRY = 0x272E, |
| ktownsend | 0:ace2e8d3ce79 | 138 | BLE_GATT_UNIT_THERMODYNAMIC_TEMPERATURE_DEGREE_CELSIUS = 0x272F, |
| ktownsend | 0:ace2e8d3ce79 | 139 | BLE_GATT_UNIT_LUMINOUS_FLUX_LUMEN = 0x2730, |
| ktownsend | 0:ace2e8d3ce79 | 140 | BLE_GATT_UNIT_ILLUMINANCE_LUX = 0x2731, |
| ktownsend | 0:ace2e8d3ce79 | 141 | BLE_GATT_UNIT_ACTIVITY_REFERRED_TO_A_RADIONUCLIDE_BECQUEREL = 0x2732, |
| ktownsend | 0:ace2e8d3ce79 | 142 | BLE_GATT_UNIT_ABSORBED_DOSE_GRAY = 0x2733, |
| ktownsend | 0:ace2e8d3ce79 | 143 | BLE_GATT_UNIT_DOSE_EQUIVALENT_SIEVERT = 0x2734, |
| ktownsend | 0:ace2e8d3ce79 | 144 | BLE_GATT_UNIT_CATALYTIC_ACTIVITY_KATAL = 0x2735, |
| ktownsend | 0:ace2e8d3ce79 | 145 | BLE_GATT_UNIT_DYNAMIC_VISCOSITY_PASCAL_SECOND = 0x2740, |
| ktownsend | 0:ace2e8d3ce79 | 146 | BLE_GATT_UNIT_MOMENT_OF_FORCE_NEWTON_METRE = 0x2741, |
| ktownsend | 0:ace2e8d3ce79 | 147 | BLE_GATT_UNIT_SURFACE_TENSION_NEWTON_PER_METRE = 0x2742, |
| ktownsend | 0:ace2e8d3ce79 | 148 | BLE_GATT_UNIT_ANGULAR_VELOCITY_RADIAN_PER_SECOND = 0x2743, |
| ktownsend | 0:ace2e8d3ce79 | 149 | BLE_GATT_UNIT_ANGULAR_ACCELERATION_RADIAN_PER_SECOND_SQUARED = 0x2744, |
| ktownsend | 0:ace2e8d3ce79 | 150 | BLE_GATT_UNIT_HEAT_FLUX_DENSITY_WATT_PER_SQUARE_METRE = 0x2745, |
| ktownsend | 0:ace2e8d3ce79 | 151 | BLE_GATT_UNIT_HEAT_CAPACITY_JOULE_PER_KELVIN = 0x2746, |
| ktownsend | 0:ace2e8d3ce79 | 152 | BLE_GATT_UNIT_SPECIFIC_HEAT_CAPACITY_JOULE_PER_KILOGRAM_KELVIN = 0x2747, |
| ktownsend | 0:ace2e8d3ce79 | 153 | BLE_GATT_UNIT_SPECIFIC_ENERGY_JOULE_PER_KILOGRAM = 0x2748, |
| ktownsend | 0:ace2e8d3ce79 | 154 | BLE_GATT_UNIT_THERMAL_CONDUCTIVITY_WATT_PER_METRE_KELVIN = 0x2749, |
| ktownsend | 0:ace2e8d3ce79 | 155 | BLE_GATT_UNIT_ENERGY_DENSITY_JOULE_PER_CUBIC_METRE = 0x274A, |
| ktownsend | 0:ace2e8d3ce79 | 156 | BLE_GATT_UNIT_ELECTRIC_FIELD_STRENGTH_VOLT_PER_METRE = 0x274B, |
| ktownsend | 0:ace2e8d3ce79 | 157 | BLE_GATT_UNIT_ELECTRIC_CHARGE_DENSITY_COULOMB_PER_CUBIC_METRE = 0x274C, |
| ktownsend | 0:ace2e8d3ce79 | 158 | BLE_GATT_UNIT_SURFACE_CHARGE_DENSITY_COULOMB_PER_SQUARE_METRE = 0x274D, |
| ktownsend | 0:ace2e8d3ce79 | 159 | BLE_GATT_UNIT_ELECTRIC_FLUX_DENSITY_COULOMB_PER_SQUARE_METRE = 0x274E, |
| ktownsend | 0:ace2e8d3ce79 | 160 | BLE_GATT_UNIT_PERMITTIVITY_FARAD_PER_METRE = 0x274F, |
| ktownsend | 0:ace2e8d3ce79 | 161 | BLE_GATT_UNIT_PERMEABILITY_HENRY_PER_METRE = 0x2750, |
| ktownsend | 0:ace2e8d3ce79 | 162 | BLE_GATT_UNIT_MOLAR_ENERGY_JOULE_PER_MOLE = 0x2751, |
| ktownsend | 0:ace2e8d3ce79 | 163 | BLE_GATT_UNIT_MOLAR_ENTROPY_JOULE_PER_MOLE_KELVIN = 0x2752, |
| ktownsend | 0:ace2e8d3ce79 | 164 | BLE_GATT_UNIT_EXPOSURE_COULOMB_PER_KILOGRAM = 0x2753, |
| ktownsend | 0:ace2e8d3ce79 | 165 | BLE_GATT_UNIT_ABSORBED_DOSE_RATE_GRAY_PER_SECOND = 0x2754, |
| ktownsend | 0:ace2e8d3ce79 | 166 | BLE_GATT_UNIT_RADIANT_INTENSITY_WATT_PER_STERADIAN = 0x2755, |
| ktownsend | 0:ace2e8d3ce79 | 167 | BLE_GATT_UNIT_RADIANCE_WATT_PER_SQUARE_METRE_STERADIAN = 0x2756, |
| ktownsend | 0:ace2e8d3ce79 | 168 | BLE_GATT_UNIT_CATALYTIC_ACTIVITY_CONCENTRATION_KATAL_PER_CUBIC_METRE = 0x2757, |
| ktownsend | 0:ace2e8d3ce79 | 169 | BLE_GATT_UNIT_TIME_MINUTE = 0x2760, |
| ktownsend | 0:ace2e8d3ce79 | 170 | BLE_GATT_UNIT_TIME_HOUR = 0x2761, |
| ktownsend | 0:ace2e8d3ce79 | 171 | BLE_GATT_UNIT_TIME_DAY = 0x2762, |
| ktownsend | 0:ace2e8d3ce79 | 172 | BLE_GATT_UNIT_PLANE_ANGLE_DEGREE = 0x2763, |
| ktownsend | 0:ace2e8d3ce79 | 173 | BLE_GATT_UNIT_PLANE_ANGLE_MINUTE = 0x2764, |
| ktownsend | 0:ace2e8d3ce79 | 174 | BLE_GATT_UNIT_PLANE_ANGLE_SECOND = 0x2765, |
| ktownsend | 0:ace2e8d3ce79 | 175 | BLE_GATT_UNIT_AREA_HECTARE = 0x2766, |
| ktownsend | 0:ace2e8d3ce79 | 176 | BLE_GATT_UNIT_VOLUME_LITRE = 0x2767, |
| ktownsend | 0:ace2e8d3ce79 | 177 | BLE_GATT_UNIT_MASS_TONNE = 0x2768, |
| ktownsend | 0:ace2e8d3ce79 | 178 | BLE_GATT_UNIT_PRESSURE_BAR = 0x2780, |
| ktownsend | 0:ace2e8d3ce79 | 179 | BLE_GATT_UNIT_PRESSURE_MILLIMETRE_OF_MERCURY = 0x2781, |
| ktownsend | 0:ace2e8d3ce79 | 180 | BLE_GATT_UNIT_LENGTH_ANGSTROM = 0x2782, |
| ktownsend | 0:ace2e8d3ce79 | 181 | BLE_GATT_UNIT_LENGTH_NAUTICAL_MILE = 0x2783, |
| ktownsend | 0:ace2e8d3ce79 | 182 | BLE_GATT_UNIT_AREA_BARN = 0x2784, |
| ktownsend | 0:ace2e8d3ce79 | 183 | BLE_GATT_UNIT_VELOCITY_KNOT = 0x2785, |
| ktownsend | 0:ace2e8d3ce79 | 184 | BLE_GATT_UNIT_LOGARITHMIC_RADIO_QUANTITY_NEPER = 0x2786, |
| ktownsend | 0:ace2e8d3ce79 | 185 | BLE_GATT_UNIT_LOGARITHMIC_RADIO_QUANTITY_BEL = 0x2787, |
| ktownsend | 0:ace2e8d3ce79 | 186 | BLE_GATT_UNIT_LENGTH_YARD = 0x27A0, |
| ktownsend | 0:ace2e8d3ce79 | 187 | BLE_GATT_UNIT_LENGTH_PARSEC = 0x27A1, |
| ktownsend | 0:ace2e8d3ce79 | 188 | BLE_GATT_UNIT_LENGTH_INCH = 0x27A2, |
| ktownsend | 0:ace2e8d3ce79 | 189 | BLE_GATT_UNIT_LENGTH_FOOT = 0x27A3, |
| ktownsend | 0:ace2e8d3ce79 | 190 | BLE_GATT_UNIT_LENGTH_MILE = 0x27A4, |
| ktownsend | 0:ace2e8d3ce79 | 191 | BLE_GATT_UNIT_PRESSURE_POUND_FORCE_PER_SQUARE_INCH = 0x27A5, |
| ktownsend | 0:ace2e8d3ce79 | 192 | BLE_GATT_UNIT_VELOCITY_KILOMETRE_PER_HOUR = 0x27A6, |
| ktownsend | 0:ace2e8d3ce79 | 193 | BLE_GATT_UNIT_VELOCITY_MILE_PER_HOUR = 0x27A7, |
| ktownsend | 0:ace2e8d3ce79 | 194 | BLE_GATT_UNIT_ANGULAR_VELOCITY_REVOLUTION_PER_MINUTE = 0x27A8, |
| ktownsend | 0:ace2e8d3ce79 | 195 | BLE_GATT_UNIT_ENERGY_GRAM_CALORIE = 0x27A9, |
| ktownsend | 0:ace2e8d3ce79 | 196 | BLE_GATT_UNIT_ENERGY_KILOGRAM_CALORIE = 0x27AA, |
| ktownsend | 0:ace2e8d3ce79 | 197 | BLE_GATT_UNIT_ENERGY_KILOWATT_HOUR = 0x27AB, |
| ktownsend | 0:ace2e8d3ce79 | 198 | BLE_GATT_UNIT_THERMODYNAMIC_TEMPERATURE_DEGREE_FAHRENHEIT = 0x27AC, |
| ktownsend | 0:ace2e8d3ce79 | 199 | BLE_GATT_UNIT_PERCENTAGE = 0x27AD, |
| ktownsend | 0:ace2e8d3ce79 | 200 | BLE_GATT_UNIT_PER_MILLE = 0x27AE, |
| ktownsend | 0:ace2e8d3ce79 | 201 | BLE_GATT_UNIT_PERIOD_BEATS_PER_MINUTE = 0x27AF, |
| ktownsend | 0:ace2e8d3ce79 | 202 | BLE_GATT_UNIT_ELECTRIC_CHARGE_AMPERE_HOURS = 0x27B0, |
| ktownsend | 0:ace2e8d3ce79 | 203 | BLE_GATT_UNIT_MASS_DENSITY_MILLIGRAM_PER_DECILITRE = 0x27B1, |
| ktownsend | 0:ace2e8d3ce79 | 204 | BLE_GATT_UNIT_MASS_DENSITY_MILLIMOLE_PER_LITRE = 0x27B2, |
| ktownsend | 0:ace2e8d3ce79 | 205 | BLE_GATT_UNIT_TIME_YEAR = 0x27B3, |
| ktownsend | 0:ace2e8d3ce79 | 206 | BLE_GATT_UNIT_TIME_MONTH = 0x27B4, |
| ktownsend | 0:ace2e8d3ce79 | 207 | BLE_GATT_UNIT_CONCENTRATION_COUNT_PER_CUBIC_METRE = 0x27B5, |
| ktownsend | 0:ace2e8d3ce79 | 208 | BLE_GATT_UNIT_IRRADIANCE_WATT_PER_SQUARE_METRE = 0x27B6 |
| ktownsend | 0:ace2e8d3ce79 | 209 | } ble_gatt_unit_t; |
| ktownsend | 0:ace2e8d3ce79 | 210 | |
| ktownsend | 0:ace2e8d3ce79 | 211 | // http://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml |
| ktownsend | 0:ace2e8d3ce79 | 212 | typedef enum ble_gatt_format_e |
| ktownsend | 0:ace2e8d3ce79 | 213 | { |
| ktownsend | 0:ace2e8d3ce79 | 214 | BLE_GATT_FORMAT_RFU = 0x00, /**< Reserved For Future Use. */ |
| ktownsend | 0:ace2e8d3ce79 | 215 | BLE_GATT_FORMAT_BOOLEAN = 0x01, /**< Boolean. */ |
| ktownsend | 0:ace2e8d3ce79 | 216 | BLE_GATT_FORMAT_2BIT = 0x02, /**< Unsigned 2-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 217 | BLE_GATT_FORMAT_NIBBLE = 0x03, /**< Unsigned 4-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 218 | BLE_GATT_FORMAT_UINT8 = 0x04, /**< Unsigned 8-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 219 | BLE_GATT_FORMAT_UINT12 = 0x05, /**< Unsigned 12-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 220 | BLE_GATT_FORMAT_UINT16 = 0x06, /**< Unsigned 16-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 221 | BLE_GATT_FORMAT_UINT24 = 0x07, /**< Unsigned 24-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 222 | BLE_GATT_FORMAT_UINT32 = 0x08, /**< Unsigned 32-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 223 | BLE_GATT_FORMAT_UINT48 = 0x09, /**< Unsigned 48-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 224 | BLE_GATT_FORMAT_UINT64 = 0x0A, /**< Unsigned 64-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 225 | BLE_GATT_FORMAT_UINT128 = 0x0B, /**< Unsigned 128-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 226 | BLE_GATT_FORMAT_SINT8 = 0x0C, /**< Signed 2-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 227 | BLE_GATT_FORMAT_SINT12 = 0x0D, /**< Signed 12-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 228 | BLE_GATT_FORMAT_SINT16 = 0x0E, /**< Signed 16-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 229 | BLE_GATT_FORMAT_SINT24 = 0x0F, /**< Signed 24-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 230 | BLE_GATT_FORMAT_SINT32 = 0x10, /**< Signed 32-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 231 | BLE_GATT_FORMAT_SINT48 = 0x11, /**< Signed 48-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 232 | BLE_GATT_FORMAT_SINT64 = 0x12, /**< Signed 64-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 233 | BLE_GATT_FORMAT_SINT128 = 0x13, /**< Signed 128-bit integer. */ |
| ktownsend | 0:ace2e8d3ce79 | 234 | BLE_GATT_FORMAT_FLOAT32 = 0x14, /**< IEEE-754 32-bit floating point. */ |
| ktownsend | 0:ace2e8d3ce79 | 235 | BLE_GATT_FORMAT_FLOAT64 = 0x15, /**< IEEE-754 64-bit floating point. */ |
| ktownsend | 0:ace2e8d3ce79 | 236 | BLE_GATT_FORMAT_SFLOAT = 0x16, /**< IEEE-11073 16-bit SFLOAT. */ |
| ktownsend | 0:ace2e8d3ce79 | 237 | BLE_GATT_FORMAT_FLOAT = 0x17, /**< IEEE-11073 32-bit FLOAT. */ |
| ktownsend | 0:ace2e8d3ce79 | 238 | BLE_GATT_FORMAT_DUINT16 = 0x18, /**< IEEE-20601 format. */ |
| ktownsend | 0:ace2e8d3ce79 | 239 | BLE_GATT_FORMAT_UTF8S = 0x19, /**< UTF-8 string. */ |
| ktownsend | 0:ace2e8d3ce79 | 240 | BLE_GATT_FORMAT_UTF16S = 0x1A, /**< UTF-16 string. */ |
| ktownsend | 2:ffc5216bd2cc | 241 | BLE_GATT_FORMAT_STRUCT = 0x1B /**< Opaque Structure. */ |
| ktownsend | 0:ace2e8d3ce79 | 242 | } ble_gatt_format_t; |
| ktownsend | 0:ace2e8d3ce79 | 243 | |
| ktownsend | 3:46de446e82ed | 244 | typedef enum ble_gatt_char_properties_e |
| ktownsend | 3:46de446e82ed | 245 | { |
| ktownsend | 3:46de446e82ed | 246 | BLE_GATT_CHAR_PROPERTIES_BROADCAST = 0x01, /**< Permits broadcasts of the Characteristic Value using Server Characteristic Configuration Descriptor. */ |
| ktownsend | 3:46de446e82ed | 247 | BLE_GATT_CHAR_PROPERTIES_READ = 0x02, /**< Permits reads of the Characteristic Value. */ |
| ktownsend | 3:46de446e82ed | 248 | BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE = 0x04, /**< Permits writes of the Characteristic Value without response. */ |
| ktownsend | 3:46de446e82ed | 249 | BLE_GATT_CHAR_PROPERTIES_WRITE = 0x08, /**< Permits writes of the Characteristic Value with response. */ |
| ktownsend | 3:46de446e82ed | 250 | BLE_GATT_CHAR_PROPERTIES_NOTIFY = 0x10, /**< Permits notifications of a Characteristic Value without acknowledgement. */ |
| ktownsend | 3:46de446e82ed | 251 | BLE_GATT_CHAR_PROPERTIES_INDICATE = 0x20, /**< Permits indications of a Characteristic Value with acknowledgement. */ |
| ktownsend | 3:46de446e82ed | 252 | BLE_GATT_CHAR_PROPERTIES_AUTHENTICATED_SIGNED_WRITES = 0x40, /**< Permits signed writes to the Characteristic Value. */ |
| ktownsend | 3:46de446e82ed | 253 | BLE_GATT_CHAR_PROPERTIES_EXTENDED_PROPERTIES = 0x80 /**< Additional characteristic properties are defined in the Characteristic Extended Properties Descriptor */ |
| ktownsend | 3:46de446e82ed | 254 | } ble_gatt_char_properties_t; |
| ktownsend | 3:46de446e82ed | 255 | |
| ktownsend | 0:ace2e8d3ce79 | 256 | struct UTF8String |
| ktownsend | 0:ace2e8d3ce79 | 257 | { |
| ktownsend | 0:ace2e8d3ce79 | 258 | uint16_t length; /**< String length. */ |
| ktownsend | 2:ffc5216bd2cc | 259 | uint8_t str[32]; /**< String data. */ |
| ktownsend | 0:ace2e8d3ce79 | 260 | }; |
| ktownsend | 0:ace2e8d3ce79 | 261 | |
| ktownsend | 0:ace2e8d3ce79 | 262 | struct UTF16String |
| ktownsend | 0:ace2e8d3ce79 | 263 | { |
| ktownsend | 0:ace2e8d3ce79 | 264 | uint16_t length; /**< String length. */ |
| ktownsend | 0:ace2e8d3ce79 | 265 | uint16_t str[32]; /**< String data. */ |
| ktownsend | 0:ace2e8d3ce79 | 266 | }; |
| ktownsend | 0:ace2e8d3ce79 | 267 | |
| ktownsend | 0:ace2e8d3ce79 | 268 | struct SecurityMode |
| ktownsend | 0:ace2e8d3ce79 | 269 | { |
| ktownsend | 0:ace2e8d3ce79 | 270 | uint8_t mode; /**< Security Mode (1 or 2), 0 for no permissions at all. */ |
| ktownsend | 0:ace2e8d3ce79 | 271 | uint8_t level; /**< Level (1, 2 or 3), 0 for no permissions at all. */ |
| ktownsend | 0:ace2e8d3ce79 | 272 | }; |
| ktownsend | 0:ace2e8d3ce79 | 273 | |
| ktownsend | 0:ace2e8d3ce79 | 274 | // See https://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml |
| ktownsend | 2:ffc5216bd2cc | 275 | typedef struct PresentationFormat |
| ktownsend | 0:ace2e8d3ce79 | 276 | { |
| ktownsend | 2:ffc5216bd2cc | 277 | uint8_t gatt_format; /**< Format of the value, see @ref ble_gatt_format_t. */ |
| ktownsend | 0:ace2e8d3ce79 | 278 | int8_t exponent; /**< Exponent for integer data types. */ |
| ktownsend | 2:ffc5216bd2cc | 279 | uint16_t gatt_unit; /**< UUID from Bluetooth Assigned Numbers, see @ref ble_gatt_unit_t. */ |
| ktownsend | 2:ffc5216bd2cc | 280 | uint8_t gatt_namespace; /**< Namespace from Bluetooth Assigned Numbers, normally '1', see @ref BLE_GATT_CPF_NAMESPACES. */ |
| ktownsend | 2:ffc5216bd2cc | 281 | uint16_t gatt_nsdesc; /**< Namespace description from Bluetooth Assigned Numbers, normally '0', see @ref BLE_GATT_CPF_NAMESPACES. */ |
| ktownsend | 2:ffc5216bd2cc | 282 | } presentation_format_t; |
| ktownsend | 0:ace2e8d3ce79 | 283 | |
| ktownsend | 0:ace2e8d3ce79 | 284 | #endif |
