ble

Dependencies:   HC_SR04_Ultrasonic_Library Servo mbed

Fork of FIP_REV1 by Robotique FIP

Committer:
julientiron
Date:
Tue May 19 16:43:59 2015 +0000
Revision:
0:3d641e170a74
BLE;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
julientiron 0:3d641e170a74 1 /* mbed Microcontroller Library
julientiron 0:3d641e170a74 2 * Copyright (c) 2006-2013 ARM Limited
julientiron 0:3d641e170a74 3 *
julientiron 0:3d641e170a74 4 * Licensed under the Apache License, Version 2.0 (the "License");
julientiron 0:3d641e170a74 5 * you may not use this file except in compliance with the License.
julientiron 0:3d641e170a74 6 * You may obtain a copy of the License at
julientiron 0:3d641e170a74 7 *
julientiron 0:3d641e170a74 8 * http://www.apache.org/licenses/LICENSE-2.0
julientiron 0:3d641e170a74 9 *
julientiron 0:3d641e170a74 10 * Unless required by applicable law or agreed to in writing, software
julientiron 0:3d641e170a74 11 * distributed under the License is distributed on an "AS IS" BASIS,
julientiron 0:3d641e170a74 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
julientiron 0:3d641e170a74 13 * See the License for the specific language governing permissions and
julientiron 0:3d641e170a74 14 * limitations under the License.
julientiron 0:3d641e170a74 15 */
julientiron 0:3d641e170a74 16
julientiron 0:3d641e170a74 17
julientiron 0:3d641e170a74 18 #ifndef __GATT_CHARACTERISTIC_H__
julientiron 0:3d641e170a74 19 #define __GATT_CHARACTERISTIC_H__
julientiron 0:3d641e170a74 20
julientiron 0:3d641e170a74 21 #include "blecommon.h"
julientiron 0:3d641e170a74 22 #include "UUID.h"
julientiron 0:3d641e170a74 23
julientiron 0:3d641e170a74 24 /**************************************************************************/
julientiron 0:3d641e170a74 25 /*!
julientiron 0:3d641e170a74 26 \brief GATT characteristic
julientiron 0:3d641e170a74 27 */
julientiron 0:3d641e170a74 28 /**************************************************************************/
julientiron 0:3d641e170a74 29 class GattCharacteristic
julientiron 0:3d641e170a74 30 {
julientiron 0:3d641e170a74 31 public:
julientiron 0:3d641e170a74 32 enum {
julientiron 0:3d641e170a74 33 UUID_BATTERY_LEVEL_STATE_CHAR = 0x2A1B,
julientiron 0:3d641e170a74 34 UUID_BATTERY_POWER_STATE_CHAR = 0x2A1A,
julientiron 0:3d641e170a74 35 UUID_REMOVABLE_CHAR = 0x2A3A,
julientiron 0:3d641e170a74 36 UUID_SERVICE_REQUIRED_CHAR = 0x2A3B,
julientiron 0:3d641e170a74 37 UUID_ALERT_CATEGORY_ID_CHAR = 0x2A43,
julientiron 0:3d641e170a74 38 UUID_ALERT_CATEGORY_ID_BIT_MASK_CHAR = 0x2A42,
julientiron 0:3d641e170a74 39 UUID_ALERT_LEVEL_CHAR = 0x2A06,
julientiron 0:3d641e170a74 40 UUID_ALERT_NOTIFICATION_CONTROL_POINT_CHAR = 0x2A44,
julientiron 0:3d641e170a74 41 UUID_ALERT_STATUS_CHAR = 0x2A3F,
julientiron 0:3d641e170a74 42 UUID_BATTERY_LEVEL_CHAR = 0x2A19,
julientiron 0:3d641e170a74 43 UUID_BLOOD_PRESSURE_FEATURE_CHAR = 0x2A49,
julientiron 0:3d641e170a74 44 UUID_BLOOD_PRESSURE_MEASUREMENT_CHAR = 0x2A35,
julientiron 0:3d641e170a74 45 UUID_BODY_SENSOR_LOCATION_CHAR = 0x2A38,
julientiron 0:3d641e170a74 46 UUID_BOOT_KEYBOARD_INPUT_REPORT_CHAR = 0x2A22,
julientiron 0:3d641e170a74 47 UUID_BOOT_KEYBOARD_OUTPUT_REPORT_CHAR = 0x2A32,
julientiron 0:3d641e170a74 48 UUID_BOOT_MOUSE_INPUT_REPORT_CHAR = 0x2A33,
julientiron 0:3d641e170a74 49 UUID_CURRENT_TIME_CHAR = 0x2A2B,
julientiron 0:3d641e170a74 50 UUID_DATE_TIME_CHAR = 0x2A08,
julientiron 0:3d641e170a74 51 UUID_DAY_DATE_TIME_CHAR = 0x2A0A,
julientiron 0:3d641e170a74 52 UUID_DAY_OF_WEEK_CHAR = 0x2A09,
julientiron 0:3d641e170a74 53 UUID_DST_OFFSET_CHAR = 0x2A0D,
julientiron 0:3d641e170a74 54 UUID_EXACT_TIME_256_CHAR = 0x2A0C,
julientiron 0:3d641e170a74 55 UUID_FIRMWARE_REVISION_STRING_CHAR = 0x2A26,
julientiron 0:3d641e170a74 56 UUID_GLUCOSE_FEATURE_CHAR = 0x2A51,
julientiron 0:3d641e170a74 57 UUID_GLUCOSE_MEASUREMENT_CHAR = 0x2A18,
julientiron 0:3d641e170a74 58 UUID_GLUCOSE_MEASUREMENT_CONTEXT_CHAR = 0x2A34,
julientiron 0:3d641e170a74 59 UUID_HARDWARE_REVISION_STRING_CHAR = 0x2A27,
julientiron 0:3d641e170a74 60 UUID_HEART_RATE_CONTROL_POINT_CHAR = 0x2A39,
julientiron 0:3d641e170a74 61 UUID_HEART_RATE_MEASUREMENT_CHAR = 0x2A37,
julientiron 0:3d641e170a74 62 UUID_HID_CONTROL_POINT_CHAR = 0x2A4C,
julientiron 0:3d641e170a74 63 UUID_HID_INFORMATION_CHAR = 0x2A4A,
julientiron 0:3d641e170a74 64 UUID_IEEE_REGULATORY_CERTIFICATION_DATA_LIST_CHAR = 0x2A2A,
julientiron 0:3d641e170a74 65 UUID_INTERMEDIATE_CUFF_PRESSURE_CHAR = 0x2A36,
julientiron 0:3d641e170a74 66 UUID_INTERMEDIATE_TEMPERATURE_CHAR = 0x2A1E,
julientiron 0:3d641e170a74 67 UUID_LOCAL_TIME_INFORMATION_CHAR = 0x2A0F,
julientiron 0:3d641e170a74 68 UUID_MANUFACTURER_NAME_STRING_CHAR = 0x2A29,
julientiron 0:3d641e170a74 69 UUID_MEASUREMENT_INTERVAL_CHAR = 0x2A21,
julientiron 0:3d641e170a74 70 UUID_MODEL_NUMBER_STRING_CHAR = 0x2A24,
julientiron 0:3d641e170a74 71 UUID_UNREAD_ALERT_CHAR = 0x2A45,
julientiron 0:3d641e170a74 72 UUID_NEW_ALERT_CHAR = 0x2A46,
julientiron 0:3d641e170a74 73 UUID_PNP_ID_CHAR = 0x2A50,
julientiron 0:3d641e170a74 74 UUID_PROTOCOL_MODE_CHAR = 0x2A4E,
julientiron 0:3d641e170a74 75 UUID_RECORD_ACCESS_CONTROL_POINT_CHAR = 0x2A52,
julientiron 0:3d641e170a74 76 UUID_REFERENCE_TIME_INFORMATION_CHAR = 0x2A14,
julientiron 0:3d641e170a74 77 UUID_REPORT_CHAR = 0x2A4D,
julientiron 0:3d641e170a74 78 UUID_REPORT_MAP_CHAR = 0x2A4B,
julientiron 0:3d641e170a74 79 UUID_RINGER_CONTROL_POINT_CHAR = 0x2A40,
julientiron 0:3d641e170a74 80 UUID_RINGER_SETTING_CHAR = 0x2A41,
julientiron 0:3d641e170a74 81 UUID_SCAN_INTERVAL_WINDOW_CHAR = 0x2A4F,
julientiron 0:3d641e170a74 82 UUID_SCAN_REFRESH_CHAR = 0x2A31,
julientiron 0:3d641e170a74 83 UUID_SERIAL_NUMBER_STRING_CHAR = 0x2A25,
julientiron 0:3d641e170a74 84 UUID_SOFTWARE_REVISION_STRING_CHAR = 0x2A28,
julientiron 0:3d641e170a74 85 UUID_SUPPORTED_NEW_ALERT_CATEGORY_CHAR = 0x2A47,
julientiron 0:3d641e170a74 86 UUID_SUPPORTED_UNREAD_ALERT_CATEGORY_CHAR = 0x2A48,
julientiron 0:3d641e170a74 87 UUID_SYSTEM_ID_CHAR = 0x2A23,
julientiron 0:3d641e170a74 88 UUID_TEMPERATURE_MEASUREMENT_CHAR = 0x2A1C,
julientiron 0:3d641e170a74 89 UUID_TEMPERATURE_TYPE_CHAR = 0x2A1D,
julientiron 0:3d641e170a74 90 UUID_TIME_ACCURACY_CHAR = 0x2A12,
julientiron 0:3d641e170a74 91 UUID_TIME_SOURCE_CHAR = 0x2A13,
julientiron 0:3d641e170a74 92 UUID_TIME_UPDATE_CONTROL_POINT_CHAR = 0x2A16,
julientiron 0:3d641e170a74 93 UUID_TIME_UPDATE_STATE_CHAR = 0x2A17,
julientiron 0:3d641e170a74 94 UUID_TIME_WITH_DST_CHAR = 0x2A11,
julientiron 0:3d641e170a74 95 UUID_TIME_ZONE_CHAR = 0x2A0E,
julientiron 0:3d641e170a74 96 UUID_TX_POWER_LEVEL_CHAR = 0x2A07,
julientiron 0:3d641e170a74 97 UUID_CSC_FEATURE_CHAR = 0x2A5C,
julientiron 0:3d641e170a74 98 UUID_CSC_MEASUREMENT_CHAR = 0x2A5B,
julientiron 0:3d641e170a74 99 UUID_RSC_FEATURE_CHAR = 0x2A54,
julientiron 0:3d641e170a74 100 UUID_RSC_MEASUREMENT_CHAR = 0x2A53,
julientiron 0:3d641e170a74 101 };
julientiron 0:3d641e170a74 102
julientiron 0:3d641e170a74 103 /**************************************************************************/
julientiron 0:3d641e170a74 104 /*!
julientiron 0:3d641e170a74 105 \brief Standard GATT characteristic presentation format unit types.
julientiron 0:3d641e170a74 106 These unit types are used to decribe what the raw numeric
julientiron 0:3d641e170a74 107 data in a characteristic actually represents.
julientiron 0:3d641e170a74 108
julientiron 0:3d641e170a74 109 \note See https://developer.bluetooth.org/gatt/units/Pages/default.aspx
julientiron 0:3d641e170a74 110 */
julientiron 0:3d641e170a74 111 /**************************************************************************/
julientiron 0:3d641e170a74 112 typedef enum ble_gatt_unit_e {
julientiron 0:3d641e170a74 113 BLE_GATT_UNIT_NONE = 0x2700, /**< No specified unit type */
julientiron 0:3d641e170a74 114 BLE_GATT_UNIT_LENGTH_METRE = 0x2701, /**< Length, Metre */
julientiron 0:3d641e170a74 115 BLE_GATT_UNIT_MASS_KILOGRAM = 0x2702, /**< Mass, Kilogram */
julientiron 0:3d641e170a74 116 BLE_GATT_UNIT_TIME_SECOND = 0x2703, /**< Time, Second */
julientiron 0:3d641e170a74 117 BLE_GATT_UNIT_ELECTRIC_CURRENT_AMPERE = 0x2704, /**< Electric Current, Ampere */
julientiron 0:3d641e170a74 118 BLE_GATT_UNIT_THERMODYNAMIC_TEMPERATURE_KELVIN = 0x2705, /**< Thermodynamic Temperature, Kelvin */
julientiron 0:3d641e170a74 119 BLE_GATT_UNIT_AMOUNT_OF_SUBSTANCE_MOLE = 0x2706, /**< Amount of Substance, Mole */
julientiron 0:3d641e170a74 120 BLE_GATT_UNIT_LUMINOUS_INTENSITY_CANDELA = 0x2707, /**< Luminous Intensity, Candela */
julientiron 0:3d641e170a74 121 BLE_GATT_UNIT_AREA_SQUARE_METRES = 0x2710, /**< Area, Square Metres */
julientiron 0:3d641e170a74 122 BLE_GATT_UNIT_VOLUME_CUBIC_METRES = 0x2711, /**< Volume, Cubic Metres*/
julientiron 0:3d641e170a74 123 BLE_GATT_UNIT_VELOCITY_METRES_PER_SECOND = 0x2712, /**< Velocity, Metres per Second*/
julientiron 0:3d641e170a74 124 BLE_GATT_UNIT_ACCELERATION_METRES_PER_SECOND_SQUARED = 0x2713, /**< Acceleration, Metres per Second Squared */
julientiron 0:3d641e170a74 125 BLE_GATT_UNIT_WAVENUMBER_RECIPROCAL_METRE = 0x2714, /**< Wave Number Reciprocal, Metre */
julientiron 0:3d641e170a74 126 BLE_GATT_UNIT_DENSITY_KILOGRAM_PER_CUBIC_METRE = 0x2715, /**< Density, Kilogram per Cubic Metre */
julientiron 0:3d641e170a74 127 BLE_GATT_UNIT_SURFACE_DENSITY_KILOGRAM_PER_SQUARE_METRE = 0x2716, /**< */
julientiron 0:3d641e170a74 128 BLE_GATT_UNIT_SPECIFIC_VOLUME_CUBIC_METRE_PER_KILOGRAM = 0x2717, /**< */
julientiron 0:3d641e170a74 129 BLE_GATT_UNIT_CURRENT_DENSITY_AMPERE_PER_SQUARE_METRE = 0x2718, /**< */
julientiron 0:3d641e170a74 130 BLE_GATT_UNIT_MAGNETIC_FIELD_STRENGTH_AMPERE_PER_METRE = 0x2719, /**< Magnetic Field Strength, Ampere per Metre */
julientiron 0:3d641e170a74 131 BLE_GATT_UNIT_AMOUNT_CONCENTRATION_MOLE_PER_CUBIC_METRE = 0x271A, /**< */
julientiron 0:3d641e170a74 132 BLE_GATT_UNIT_MASS_CONCENTRATION_KILOGRAM_PER_CUBIC_METRE = 0x271B, /**< */
julientiron 0:3d641e170a74 133 BLE_GATT_UNIT_LUMINANCE_CANDELA_PER_SQUARE_METRE = 0x271C, /**< */
julientiron 0:3d641e170a74 134 BLE_GATT_UNIT_REFRACTIVE_INDEX = 0x271D, /**< */
julientiron 0:3d641e170a74 135 BLE_GATT_UNIT_RELATIVE_PERMEABILITY = 0x271E, /**< */
julientiron 0:3d641e170a74 136 BLE_GATT_UNIT_PLANE_ANGLE_RADIAN = 0x2720, /**< */
julientiron 0:3d641e170a74 137 BLE_GATT_UNIT_SOLID_ANGLE_STERADIAN = 0x2721, /**< */
julientiron 0:3d641e170a74 138 BLE_GATT_UNIT_FREQUENCY_HERTZ = 0x2722, /**< Frequency, Hertz */
julientiron 0:3d641e170a74 139 BLE_GATT_UNIT_FORCE_NEWTON = 0x2723, /**< Force, Newton */
julientiron 0:3d641e170a74 140 BLE_GATT_UNIT_PRESSURE_PASCAL = 0x2724, /**< Pressure, Pascal */
julientiron 0:3d641e170a74 141 BLE_GATT_UNIT_ENERGY_JOULE = 0x2725, /**< Energy, Joule */
julientiron 0:3d641e170a74 142 BLE_GATT_UNIT_POWER_WATT = 0x2726, /**< Power, Watt */
julientiron 0:3d641e170a74 143 BLE_GATT_UNIT_ELECTRIC_CHARGE_COULOMB = 0x2727, /**< Electrical Charge, Coulomb */
julientiron 0:3d641e170a74 144 BLE_GATT_UNIT_ELECTRIC_POTENTIAL_DIFFERENCE_VOLT = 0x2728, /**< Electrical Potential Difference, Voltage */
julientiron 0:3d641e170a74 145 BLE_GATT_UNIT_CAPACITANCE_FARAD = 0x2729, /**< */
julientiron 0:3d641e170a74 146 BLE_GATT_UNIT_ELECTRIC_RESISTANCE_OHM = 0x272A, /**< */
julientiron 0:3d641e170a74 147 BLE_GATT_UNIT_ELECTRIC_CONDUCTANCE_SIEMENS = 0x272B, /**< */
julientiron 0:3d641e170a74 148 BLE_GATT_UNIT_MAGNETIC_FLEX_WEBER = 0x272C, /**< */
julientiron 0:3d641e170a74 149 BLE_GATT_UNIT_MAGNETIC_FLEX_DENSITY_TESLA = 0x272D, /**< */
julientiron 0:3d641e170a74 150 BLE_GATT_UNIT_INDUCTANCE_HENRY = 0x272E, /**< */
julientiron 0:3d641e170a74 151 BLE_GATT_UNIT_THERMODYNAMIC_TEMPERATURE_DEGREE_CELSIUS = 0x272F, /**< */
julientiron 0:3d641e170a74 152 BLE_GATT_UNIT_LUMINOUS_FLUX_LUMEN = 0x2730, /**< */
julientiron 0:3d641e170a74 153 BLE_GATT_UNIT_ILLUMINANCE_LUX = 0x2731, /**< */
julientiron 0:3d641e170a74 154 BLE_GATT_UNIT_ACTIVITY_REFERRED_TO_A_RADIONUCLIDE_BECQUEREL = 0x2732, /**< */
julientiron 0:3d641e170a74 155 BLE_GATT_UNIT_ABSORBED_DOSE_GRAY = 0x2733, /**< */
julientiron 0:3d641e170a74 156 BLE_GATT_UNIT_DOSE_EQUIVALENT_SIEVERT = 0x2734, /**< */
julientiron 0:3d641e170a74 157 BLE_GATT_UNIT_CATALYTIC_ACTIVITY_KATAL = 0x2735, /**< */
julientiron 0:3d641e170a74 158 BLE_GATT_UNIT_DYNAMIC_VISCOSITY_PASCAL_SECOND = 0x2740, /**< */
julientiron 0:3d641e170a74 159 BLE_GATT_UNIT_MOMENT_OF_FORCE_NEWTON_METRE = 0x2741, /**< */
julientiron 0:3d641e170a74 160 BLE_GATT_UNIT_SURFACE_TENSION_NEWTON_PER_METRE = 0x2742, /**< */
julientiron 0:3d641e170a74 161 BLE_GATT_UNIT_ANGULAR_VELOCITY_RADIAN_PER_SECOND = 0x2743, /**< */
julientiron 0:3d641e170a74 162 BLE_GATT_UNIT_ANGULAR_ACCELERATION_RADIAN_PER_SECOND_SQUARED = 0x2744, /**< */
julientiron 0:3d641e170a74 163 BLE_GATT_UNIT_HEAT_FLUX_DENSITY_WATT_PER_SQUARE_METRE = 0x2745, /**< */
julientiron 0:3d641e170a74 164 BLE_GATT_UNIT_HEAT_CAPACITY_JOULE_PER_KELVIN = 0x2746, /**< */
julientiron 0:3d641e170a74 165 BLE_GATT_UNIT_SPECIFIC_HEAT_CAPACITY_JOULE_PER_KILOGRAM_KELVIN = 0x2747, /**< */
julientiron 0:3d641e170a74 166 BLE_GATT_UNIT_SPECIFIC_ENERGY_JOULE_PER_KILOGRAM = 0x2748, /**< */
julientiron 0:3d641e170a74 167 BLE_GATT_UNIT_THERMAL_CONDUCTIVITY_WATT_PER_METRE_KELVIN = 0x2749, /**< */
julientiron 0:3d641e170a74 168 BLE_GATT_UNIT_ENERGY_DENSITY_JOULE_PER_CUBIC_METRE = 0x274A, /**< */
julientiron 0:3d641e170a74 169 BLE_GATT_UNIT_ELECTRIC_FIELD_STRENGTH_VOLT_PER_METRE = 0x274B, /**< */
julientiron 0:3d641e170a74 170 BLE_GATT_UNIT_ELECTRIC_CHARGE_DENSITY_COULOMB_PER_CUBIC_METRE = 0x274C, /**< */
julientiron 0:3d641e170a74 171 BLE_GATT_UNIT_SURFACE_CHARGE_DENSITY_COULOMB_PER_SQUARE_METRE = 0x274D, /**< */
julientiron 0:3d641e170a74 172 BLE_GATT_UNIT_ELECTRIC_FLUX_DENSITY_COULOMB_PER_SQUARE_METRE = 0x274E, /**< */
julientiron 0:3d641e170a74 173 BLE_GATT_UNIT_PERMITTIVITY_FARAD_PER_METRE = 0x274F, /**< */
julientiron 0:3d641e170a74 174 BLE_GATT_UNIT_PERMEABILITY_HENRY_PER_METRE = 0x2750, /**< */
julientiron 0:3d641e170a74 175 BLE_GATT_UNIT_MOLAR_ENERGY_JOULE_PER_MOLE = 0x2751, /**< */
julientiron 0:3d641e170a74 176 BLE_GATT_UNIT_MOLAR_ENTROPY_JOULE_PER_MOLE_KELVIN = 0x2752, /**< */
julientiron 0:3d641e170a74 177 BLE_GATT_UNIT_EXPOSURE_COULOMB_PER_KILOGRAM = 0x2753, /**< */
julientiron 0:3d641e170a74 178 BLE_GATT_UNIT_ABSORBED_DOSE_RATE_GRAY_PER_SECOND = 0x2754, /**< */
julientiron 0:3d641e170a74 179 BLE_GATT_UNIT_RADIANT_INTENSITY_WATT_PER_STERADIAN = 0x2755, /**< */
julientiron 0:3d641e170a74 180 BLE_GATT_UNIT_RADIANCE_WATT_PER_SQUARE_METRE_STERADIAN = 0x2756, /**< */
julientiron 0:3d641e170a74 181 BLE_GATT_UNIT_CATALYTIC_ACTIVITY_CONCENTRATION_KATAL_PER_CUBIC_METRE = 0x2757, /**< */
julientiron 0:3d641e170a74 182 BLE_GATT_UNIT_TIME_MINUTE = 0x2760, /**< Time, Minute */
julientiron 0:3d641e170a74 183 BLE_GATT_UNIT_TIME_HOUR = 0x2761, /**< Time, Hour */
julientiron 0:3d641e170a74 184 BLE_GATT_UNIT_TIME_DAY = 0x2762, /**< Time, Day */
julientiron 0:3d641e170a74 185 BLE_GATT_UNIT_PLANE_ANGLE_DEGREE = 0x2763, /**< */
julientiron 0:3d641e170a74 186 BLE_GATT_UNIT_PLANE_ANGLE_MINUTE = 0x2764, /**< */
julientiron 0:3d641e170a74 187 BLE_GATT_UNIT_PLANE_ANGLE_SECOND = 0x2765, /**< */
julientiron 0:3d641e170a74 188 BLE_GATT_UNIT_AREA_HECTARE = 0x2766, /**< */
julientiron 0:3d641e170a74 189 BLE_GATT_UNIT_VOLUME_LITRE = 0x2767, /**< */
julientiron 0:3d641e170a74 190 BLE_GATT_UNIT_MASS_TONNE = 0x2768, /**< */
julientiron 0:3d641e170a74 191 BLE_GATT_UNIT_PRESSURE_BAR = 0x2780, /**< Pressure, Bar */
julientiron 0:3d641e170a74 192 BLE_GATT_UNIT_PRESSURE_MILLIMETRE_OF_MERCURY = 0x2781, /**< Pressure, Millimetre of Mercury */
julientiron 0:3d641e170a74 193 BLE_GATT_UNIT_LENGTH_ANGSTROM = 0x2782, /**< */
julientiron 0:3d641e170a74 194 BLE_GATT_UNIT_LENGTH_NAUTICAL_MILE = 0x2783, /**< */
julientiron 0:3d641e170a74 195 BLE_GATT_UNIT_AREA_BARN = 0x2784, /**< */
julientiron 0:3d641e170a74 196 BLE_GATT_UNIT_VELOCITY_KNOT = 0x2785, /**< */
julientiron 0:3d641e170a74 197 BLE_GATT_UNIT_LOGARITHMIC_RADIO_QUANTITY_NEPER = 0x2786, /**< */
julientiron 0:3d641e170a74 198 BLE_GATT_UNIT_LOGARITHMIC_RADIO_QUANTITY_BEL = 0x2787, /**< */
julientiron 0:3d641e170a74 199 BLE_GATT_UNIT_LENGTH_YARD = 0x27A0, /**< Length, Yard */
julientiron 0:3d641e170a74 200 BLE_GATT_UNIT_LENGTH_PARSEC = 0x27A1, /**< Length, Parsec */
julientiron 0:3d641e170a74 201 BLE_GATT_UNIT_LENGTH_INCH = 0x27A2, /**< Length, Inch */
julientiron 0:3d641e170a74 202 BLE_GATT_UNIT_LENGTH_FOOT = 0x27A3, /**< Length, Foot */
julientiron 0:3d641e170a74 203 BLE_GATT_UNIT_LENGTH_MILE = 0x27A4, /**< Length, Mile */
julientiron 0:3d641e170a74 204 BLE_GATT_UNIT_PRESSURE_POUND_FORCE_PER_SQUARE_INCH = 0x27A5, /**< */
julientiron 0:3d641e170a74 205 BLE_GATT_UNIT_VELOCITY_KILOMETRE_PER_HOUR = 0x27A6, /**< Velocity, Kilometre per Hour */
julientiron 0:3d641e170a74 206 BLE_GATT_UNIT_VELOCITY_MILE_PER_HOUR = 0x27A7, /**< Velocity, Mile per Hour */
julientiron 0:3d641e170a74 207 BLE_GATT_UNIT_ANGULAR_VELOCITY_REVOLUTION_PER_MINUTE = 0x27A8, /**< Angular Velocity, Revolution per Minute */
julientiron 0:3d641e170a74 208 BLE_GATT_UNIT_ENERGY_GRAM_CALORIE = 0x27A9, /**< Energy, Gram Calorie */
julientiron 0:3d641e170a74 209 BLE_GATT_UNIT_ENERGY_KILOGRAM_CALORIE = 0x27AA, /**< Energy, Kilogram Calorie */
julientiron 0:3d641e170a74 210 BLE_GATT_UNIT_ENERGY_KILOWATT_HOUR = 0x27AB, /**< Energy, Killowatt Hour */
julientiron 0:3d641e170a74 211 BLE_GATT_UNIT_THERMODYNAMIC_TEMPERATURE_DEGREE_FAHRENHEIT = 0x27AC, /**< */
julientiron 0:3d641e170a74 212 BLE_GATT_UNIT_PERCENTAGE = 0x27AD, /**< Percentage */
julientiron 0:3d641e170a74 213 BLE_GATT_UNIT_PER_MILLE = 0x27AE, /**< */
julientiron 0:3d641e170a74 214 BLE_GATT_UNIT_PERIOD_BEATS_PER_MINUTE = 0x27AF, /**< */
julientiron 0:3d641e170a74 215 BLE_GATT_UNIT_ELECTRIC_CHARGE_AMPERE_HOURS = 0x27B0, /**< */
julientiron 0:3d641e170a74 216 BLE_GATT_UNIT_MASS_DENSITY_MILLIGRAM_PER_DECILITRE = 0x27B1, /**< */
julientiron 0:3d641e170a74 217 BLE_GATT_UNIT_MASS_DENSITY_MILLIMOLE_PER_LITRE = 0x27B2, /**< */
julientiron 0:3d641e170a74 218 BLE_GATT_UNIT_TIME_YEAR = 0x27B3, /**< Time, Year */
julientiron 0:3d641e170a74 219 BLE_GATT_UNIT_TIME_MONTH = 0x27B4, /**< Time, Month */
julientiron 0:3d641e170a74 220 BLE_GATT_UNIT_CONCENTRATION_COUNT_PER_CUBIC_METRE = 0x27B5, /**< */
julientiron 0:3d641e170a74 221 BLE_GATT_UNIT_IRRADIANCE_WATT_PER_SQUARE_METRE = 0x27B6 /**< */
julientiron 0:3d641e170a74 222 } ble_gatt_unit_t;
julientiron 0:3d641e170a74 223
julientiron 0:3d641e170a74 224 /**************************************************************************/
julientiron 0:3d641e170a74 225 /*!
julientiron 0:3d641e170a74 226 \brief Standard GATT number types
julientiron 0:3d641e170a74 227
julientiron 0:3d641e170a74 228 \note See Bluetooth Specification 4.0 (Vol. 3), Part G, Section 3.3.3.5.2
julientiron 0:3d641e170a74 229 \note See http://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml
julientiron 0:3d641e170a74 230 */
julientiron 0:3d641e170a74 231 /**************************************************************************/
julientiron 0:3d641e170a74 232 typedef enum ble_gatt_format_e {
julientiron 0:3d641e170a74 233 BLE_GATT_FORMAT_RFU = 0x00, /**< Reserved For Future Use. */
julientiron 0:3d641e170a74 234 BLE_GATT_FORMAT_BOOLEAN = 0x01, /**< Boolean. */
julientiron 0:3d641e170a74 235 BLE_GATT_FORMAT_2BIT = 0x02, /**< Unsigned 2-bit integer. */
julientiron 0:3d641e170a74 236 BLE_GATT_FORMAT_NIBBLE = 0x03, /**< Unsigned 4-bit integer. */
julientiron 0:3d641e170a74 237 BLE_GATT_FORMAT_UINT8 = 0x04, /**< Unsigned 8-bit integer. */
julientiron 0:3d641e170a74 238 BLE_GATT_FORMAT_UINT12 = 0x05, /**< Unsigned 12-bit integer. */
julientiron 0:3d641e170a74 239 BLE_GATT_FORMAT_UINT16 = 0x06, /**< Unsigned 16-bit integer. */
julientiron 0:3d641e170a74 240 BLE_GATT_FORMAT_UINT24 = 0x07, /**< Unsigned 24-bit integer. */
julientiron 0:3d641e170a74 241 BLE_GATT_FORMAT_UINT32 = 0x08, /**< Unsigned 32-bit integer. */
julientiron 0:3d641e170a74 242 BLE_GATT_FORMAT_UINT48 = 0x09, /**< Unsigned 48-bit integer. */
julientiron 0:3d641e170a74 243 BLE_GATT_FORMAT_UINT64 = 0x0A, /**< Unsigned 64-bit integer. */
julientiron 0:3d641e170a74 244 BLE_GATT_FORMAT_UINT128 = 0x0B, /**< Unsigned 128-bit integer. */
julientiron 0:3d641e170a74 245 BLE_GATT_FORMAT_SINT8 = 0x0C, /**< Signed 2-bit integer. */
julientiron 0:3d641e170a74 246 BLE_GATT_FORMAT_SINT12 = 0x0D, /**< Signed 12-bit integer. */
julientiron 0:3d641e170a74 247 BLE_GATT_FORMAT_SINT16 = 0x0E, /**< Signed 16-bit integer. */
julientiron 0:3d641e170a74 248 BLE_GATT_FORMAT_SINT24 = 0x0F, /**< Signed 24-bit integer. */
julientiron 0:3d641e170a74 249 BLE_GATT_FORMAT_SINT32 = 0x10, /**< Signed 32-bit integer. */
julientiron 0:3d641e170a74 250 BLE_GATT_FORMAT_SINT48 = 0x11, /**< Signed 48-bit integer. */
julientiron 0:3d641e170a74 251 BLE_GATT_FORMAT_SINT64 = 0x12, /**< Signed 64-bit integer. */
julientiron 0:3d641e170a74 252 BLE_GATT_FORMAT_SINT128 = 0x13, /**< Signed 128-bit integer. */
julientiron 0:3d641e170a74 253 BLE_GATT_FORMAT_FLOAT32 = 0x14, /**< IEEE-754 32-bit floating point. */
julientiron 0:3d641e170a74 254 BLE_GATT_FORMAT_FLOAT64 = 0x15, /**< IEEE-754 64-bit floating point. */
julientiron 0:3d641e170a74 255 BLE_GATT_FORMAT_SFLOAT = 0x16, /**< IEEE-11073 16-bit SFLOAT. */
julientiron 0:3d641e170a74 256 BLE_GATT_FORMAT_FLOAT = 0x17, /**< IEEE-11073 32-bit FLOAT. */
julientiron 0:3d641e170a74 257 BLE_GATT_FORMAT_DUINT16 = 0x18, /**< IEEE-20601 format. */
julientiron 0:3d641e170a74 258 BLE_GATT_FORMAT_UTF8S = 0x19, /**< UTF-8 string. */
julientiron 0:3d641e170a74 259 BLE_GATT_FORMAT_UTF16S = 0x1A, /**< UTF-16 string. */
julientiron 0:3d641e170a74 260 BLE_GATT_FORMAT_STRUCT = 0x1B /**< Opaque Structure. */
julientiron 0:3d641e170a74 261 } ble_gatt_format_t;
julientiron 0:3d641e170a74 262
julientiron 0:3d641e170a74 263 /**************************************************************************/
julientiron 0:3d641e170a74 264 /*!
julientiron 0:3d641e170a74 265 \brief Standard GATT characteritic properties
julientiron 0:3d641e170a74 266
julientiron 0:3d641e170a74 267 \note See Bluetooth Specification 4.0 (Vol. 3), Part G, Section 3.3.1.1
julientiron 0:3d641e170a74 268 and Section 3.3.3.1 for Extended Properties
julientiron 0:3d641e170a74 269 */
julientiron 0:3d641e170a74 270 /**************************************************************************/
julientiron 0:3d641e170a74 271 typedef enum ble_gatt_char_properties_e {
julientiron 0:3d641e170a74 272 BLE_GATT_CHAR_PROPERTIES_NONE = 0x00,
julientiron 0:3d641e170a74 273 BLE_GATT_CHAR_PROPERTIES_BROADCAST = 0x01, /**< Permits broadcasts of the Characteristic Value using Server Characteristic Configuration Descriptor. */
julientiron 0:3d641e170a74 274 BLE_GATT_CHAR_PROPERTIES_READ = 0x02, /**< Permits reads of the Characteristic Value. */
julientiron 0:3d641e170a74 275 BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE = 0x04, /**< Permits writes of the Characteristic Value without response. */
julientiron 0:3d641e170a74 276 BLE_GATT_CHAR_PROPERTIES_WRITE = 0x08, /**< Permits writes of the Characteristic Value with response. */
julientiron 0:3d641e170a74 277 BLE_GATT_CHAR_PROPERTIES_NOTIFY = 0x10, /**< Permits notifications of a Characteristic Value without acknowledgement. */
julientiron 0:3d641e170a74 278 BLE_GATT_CHAR_PROPERTIES_INDICATE = 0x20, /**< Permits indications of a Characteristic Value with acknowledgement. */
julientiron 0:3d641e170a74 279 BLE_GATT_CHAR_PROPERTIES_AUTHENTICATED_SIGNED_WRITES = 0x40, /**< Permits signed writes to the Characteristic Value. */
julientiron 0:3d641e170a74 280 BLE_GATT_CHAR_PROPERTIES_EXTENDED_PROPERTIES = 0x80 /**< Additional characteristic properties are defined in the Characteristic Extended Properties Descriptor */
julientiron 0:3d641e170a74 281 } ble_gatt_char_properties_t;
julientiron 0:3d641e170a74 282
julientiron 0:3d641e170a74 283 /**************************************************************************/
julientiron 0:3d641e170a74 284 /*!
julientiron 0:3d641e170a74 285 \brief GATT presentation format wrapper
julientiron 0:3d641e170a74 286
julientiron 0:3d641e170a74 287 \note See Bluetooth Specification 4.0 (Vol. 3), Part G, Section 3.3.3.5
julientiron 0:3d641e170a74 288 \note See https://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml
julientiron 0:3d641e170a74 289 */
julientiron 0:3d641e170a74 290 /**************************************************************************/
julientiron 0:3d641e170a74 291 typedef struct PresentationFormat {
julientiron 0:3d641e170a74 292 uint8_t gatt_format; /**< Format of the value, see @ref ble_gatt_format_t. */
julientiron 0:3d641e170a74 293 int8_t exponent; /**< Exponent for integer data types. Ex. if Exponent = -3 and the char value is 3892, the actual value is 3.892 */
julientiron 0:3d641e170a74 294 uint16_t gatt_unit; /**< UUID from Bluetooth Assigned Numbers, see @ref ble_gatt_unit_t. */
julientiron 0:3d641e170a74 295 uint8_t gatt_namespace; /**< Namespace from Bluetooth Assigned Numbers, normally '1', see @ref BLE_GATT_CPF_NAMESPACES. */
julientiron 0:3d641e170a74 296 uint16_t gatt_nsdesc; /**< Namespace description from Bluetooth Assigned Numbers, normally '0', see @ref BLE_GATT_CPF_NAMESPACES. */
julientiron 0:3d641e170a74 297 } presentation_format_t;
julientiron 0:3d641e170a74 298
julientiron 0:3d641e170a74 299 /**
julientiron 0:3d641e170a74 300 * @brief Creates a new GattCharacteristic using the specified 16-bit
julientiron 0:3d641e170a74 301 * UUID, value length, and properties
julientiron 0:3d641e170a74 302 *
julientiron 0:3d641e170a74 303 * @note The UUID value must be unique in the service and is normally >1
julientiron 0:3d641e170a74 304 *
julientiron 0:3d641e170a74 305 * @param[in] uuid
julientiron 0:3d641e170a74 306 * The UUID to use for this characteristic
julientiron 0:3d641e170a74 307 * @param[in] valuePtr
julientiron 0:3d641e170a74 308 * The memory holding the initial value.
julientiron 0:3d641e170a74 309 * @param[in] initialLen
julientiron 0:3d641e170a74 310 * The min length in bytes of this characteristic's value
julientiron 0:3d641e170a74 311 * @param[in] maxLen
julientiron 0:3d641e170a74 312 * The max length in bytes of this characteristic's value
julientiron 0:3d641e170a74 313 * @param[in] props
julientiron 0:3d641e170a74 314 * The 8-bit bit field containing the characteristic's properties
julientiron 0:3d641e170a74 315 *
julientiron 0:3d641e170a74 316 * @section EXAMPLE
julientiron 0:3d641e170a74 317 *
julientiron 0:3d641e170a74 318 * @code
julientiron 0:3d641e170a74 319 *
julientiron 0:3d641e170a74 320 * // UUID = 0x2A19, Min length 2, Max len = 2, Properties = write
julientiron 0:3d641e170a74 321 * GattCharacteristic c = GattCharacteristic( 0x2A19, 2, 2, BLE_GATT_CHAR_PROPERTIES_WRITE );
julientiron 0:3d641e170a74 322 *
julientiron 0:3d641e170a74 323 * @endcode
julientiron 0:3d641e170a74 324 */
julientiron 0:3d641e170a74 325 /**************************************************************************/
julientiron 0:3d641e170a74 326 GattCharacteristic(const UUID &uuid, uint8_t *valuePtr = NULL, uint16_t initialLen = 0, uint16_t maxLen = 0,
julientiron 0:3d641e170a74 327 uint8_t props = BLE_GATT_CHAR_PROPERTIES_NONE) :
julientiron 0:3d641e170a74 328 _uuid(uuid), _valuePtr(valuePtr), _initialLen(initialLen), _lenMax(maxLen), _handle(), _properties(props) {
julientiron 0:3d641e170a74 329 /* empty */
julientiron 0:3d641e170a74 330 }
julientiron 0:3d641e170a74 331
julientiron 0:3d641e170a74 332 public:
julientiron 0:3d641e170a74 333 uint16_t getHandle(void) const {
julientiron 0:3d641e170a74 334 return _handle;
julientiron 0:3d641e170a74 335 }
julientiron 0:3d641e170a74 336 void setHandle(uint16_t id) {
julientiron 0:3d641e170a74 337 _handle = id;
julientiron 0:3d641e170a74 338 }
julientiron 0:3d641e170a74 339 const UUID &getUUID(void) const {
julientiron 0:3d641e170a74 340 return _uuid;
julientiron 0:3d641e170a74 341 }
julientiron 0:3d641e170a74 342 uint8_t getProperties(void) const {
julientiron 0:3d641e170a74 343 return _properties;
julientiron 0:3d641e170a74 344 }
julientiron 0:3d641e170a74 345 uint16_t getInitialLength(void) const {
julientiron 0:3d641e170a74 346 return _initialLen;
julientiron 0:3d641e170a74 347 }
julientiron 0:3d641e170a74 348 uint16_t getMaxLength(void) const {
julientiron 0:3d641e170a74 349 return _lenMax;
julientiron 0:3d641e170a74 350 }
julientiron 0:3d641e170a74 351 uint8_t *getValuePtr(void) {
julientiron 0:3d641e170a74 352 return _valuePtr;
julientiron 0:3d641e170a74 353 }
julientiron 0:3d641e170a74 354
julientiron 0:3d641e170a74 355 private:
julientiron 0:3d641e170a74 356 UUID _uuid; /* Characteristic UUID */
julientiron 0:3d641e170a74 357 uint8_t *_valuePtr;
julientiron 0:3d641e170a74 358 uint16_t _initialLen; /* Initial length of the value */
julientiron 0:3d641e170a74 359 uint16_t _lenMax; /* Maximum length of the value */
julientiron 0:3d641e170a74 360 uint16_t _handle;
julientiron 0:3d641e170a74 361 uint8_t _properties;
julientiron 0:3d641e170a74 362 };
julientiron 0:3d641e170a74 363
julientiron 0:3d641e170a74 364 #endif // ifndef __GATT_CHARACTERISTIC_H__