Microbug / BLE_API_FOTA

Fork of BLE_API by Bluetooth Low Energy

Committer:
Rohit Grover
Date:
Wed Jun 04 10:48:27 2014 +0100
Revision:
65:100b50423049
Parent:
57:29d592d8729f
Child:
67:0fac4e99f29b
white space diffs

Who changed what in which revision?

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