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