19 #ifndef __GATT_CHARACTERISTIC_H__ 20 #define __GATT_CHARACTERISTIC_H__ 24 #include "ble/gatt/GattAttribute.h" 25 #include "ble/gatt/GattCallbackParamTypes.h" 30 #if !defined(DOXYGEN_ONLY) 34 #endif // !defined(DOXYGEN_ONLY) 115 UUID_BATTERY_LEVEL_STATE_CHAR = 0x2A1B,
120 UUID_BATTERY_POWER_STATE_CHAR = 0x2A1A,
125 UUID_REMOVABLE_CHAR = 0x2A3A,
130 UUID_SERVICE_REQUIRED_CHAR = 0x2A3B,
135 UUID_ALERT_CATEGORY_ID_CHAR = 0x2A43,
140 UUID_ALERT_CATEGORY_ID_BIT_MASK_CHAR = 0x2A42,
146 UUID_ALERT_LEVEL_CHAR = 0x2A06,
152 UUID_ALERT_NOTIFICATION_CONTROL_POINT_CHAR = 0x2A44,
158 UUID_ALERT_STATUS_CHAR = 0x2A3F,
164 UUID_BATTERY_LEVEL_CHAR = 0x2A19,
170 UUID_BLOOD_PRESSURE_FEATURE_CHAR = 0x2A49,
176 UUID_BLOOD_PRESSURE_MEASUREMENT_CHAR = 0x2A35,
182 UUID_BODY_SENSOR_LOCATION_CHAR = 0x2A38,
187 UUID_BOOT_KEYBOARD_INPUT_REPORT_CHAR = 0x2A22,
192 UUID_BOOT_KEYBOARD_OUTPUT_REPORT_CHAR = 0x2A32,
197 UUID_BOOT_MOUSE_INPUT_REPORT_CHAR = 0x2A33,
203 UUID_CURRENT_TIME_CHAR = 0x2A2B,
208 UUID_DATE_TIME_CHAR = 0x2A08,
213 UUID_DAY_DATE_TIME_CHAR = 0x2A0A,
218 UUID_DAY_OF_WEEK_CHAR = 0x2A09,
223 UUID_DST_OFFSET_CHAR = 0x2A0D,
228 UUID_EXACT_TIME_256_CHAR = 0x2A0C,
235 UUID_FIRMWARE_REVISION_STRING_CHAR = 0x2A26,
241 UUID_GLUCOSE_FEATURE_CHAR = 0x2A51,
247 UUID_GLUCOSE_MEASUREMENT_CHAR = 0x2A18,
253 UUID_GLUCOSE_MEASUREMENT_CONTEXT_CHAR = 0x2A34,
259 UUID_HARDWARE_REVISION_STRING_CHAR = 0x2A27,
265 UUID_HEART_RATE_CONTROL_POINT_CHAR = 0x2A39,
271 UUID_HEART_RATE_MEASUREMENT_CHAR = 0x2A37,
276 UUID_HID_CONTROL_POINT_CHAR = 0x2A4C,
281 UUID_HID_INFORMATION_CHAR = 0x2A4A,
287 UUID_HUMIDITY_CHAR = 0x2A6F,
294 UUID_IEEE_REGULATORY_CERTIFICATION_DATA_LIST_CHAR = 0x2A2A,
300 UUID_INTERMEDIATE_CUFF_PRESSURE_CHAR = 0x2A36,
306 UUID_INTERMEDIATE_TEMPERATURE_CHAR = 0x2A1E,
312 UUID_LOCAL_TIME_INFORMATION_CHAR = 0x2A0F,
318 UUID_MANUFACTURER_NAME_STRING_CHAR = 0x2A29,
324 UUID_MEASUREMENT_INTERVAL_CHAR = 0x2A21,
331 UUID_MODEL_NUMBER_STRING_CHAR = 0x2A24,
337 UUID_UNREAD_ALERT_CHAR = 0x2A45,
344 UUID_NEW_ALERT_CHAR = 0x2A46,
350 UUID_PNP_ID_CHAR = 0x2A50,
356 UUID_PRESSURE_CHAR = 0x2A6D,
361 UUID_PROTOCOL_MODE_CHAR = 0x2A4E,
368 UUID_RECORD_ACCESS_CONTROL_POINT_CHAR = 0x2A52,
375 UUID_REFERENCE_TIME_INFORMATION_CHAR = 0x2A14,
380 UUID_REPORT_CHAR = 0x2A4D,
385 UUID_REPORT_MAP_CHAR = 0x2A4B,
391 UUID_RINGER_CONTROL_POINT_CHAR = 0x2A40,
397 UUID_RINGER_SETTING_CHAR = 0x2A41,
403 UUID_SCAN_INTERVAL_WINDOW_CHAR = 0x2A4F,
409 UUID_SCAN_REFRESH_CHAR = 0x2A31,
415 UUID_SERIAL_NUMBER_STRING_CHAR = 0x2A25,
421 UUID_SOFTWARE_REVISION_STRING_CHAR = 0x2A28,
427 UUID_SUPPORTED_NEW_ALERT_CATEGORY_CHAR = 0x2A47,
433 UUID_SUPPORTED_UNREAD_ALERT_CATEGORY_CHAR = 0x2A48,
441 UUID_SYSTEM_ID_CHAR = 0x2A23,
447 UUID_TEMPERATURE_CHAR = 0x2A6E,
453 UUID_TEMPERATURE_MEASUREMENT_CHAR = 0x2A1C,
459 UUID_TEMPERATURE_TYPE_CHAR = 0x2A1D,
464 UUID_TIME_ACCURACY_CHAR = 0x2A12,
469 UUID_TIME_SOURCE_CHAR = 0x2A13,
475 UUID_TIME_UPDATE_CONTROL_POINT_CHAR = 0x2A16,
481 UUID_TIME_UPDATE_STATE_CHAR = 0x2A17,
487 UUID_TIME_WITH_DST_CHAR = 0x2A11,
492 UUID_TIME_ZONE_CHAR = 0x2A0E,
498 UUID_TX_POWER_LEVEL_CHAR = 0x2A07,
504 UUID_CSC_FEATURE_CHAR = 0x2A5C,
510 UUID_CSC_MEASUREMENT_CHAR = 0x2A5B,
516 UUID_RSC_FEATURE_CHAR = 0x2A54,
522 UUID_RSC_MEASUREMENT_CHAR = 0x2A53
540 BLE_GATT_UNIT_NONE = 0x2700,
545 BLE_GATT_UNIT_LENGTH_METRE = 0x2701,
550 BLE_GATT_UNIT_MASS_KILOGRAM = 0x2702,
555 BLE_GATT_UNIT_TIME_SECOND = 0x2703,
560 BLE_GATT_UNIT_ELECTRIC_CURRENT_AMPERE = 0x2704,
565 BLE_GATT_UNIT_THERMODYNAMIC_TEMPERATURE_KELVIN = 0x2705,
570 BLE_GATT_UNIT_AMOUNT_OF_SUBSTANCE_MOLE = 0x2706,
575 BLE_GATT_UNIT_LUMINOUS_INTENSITY_CANDELA = 0x2707,
580 BLE_GATT_UNIT_AREA_SQUARE_METRES = 0x2710,
585 BLE_GATT_UNIT_VOLUME_CUBIC_METRES = 0x2711,
590 BLE_GATT_UNIT_VELOCITY_METRES_PER_SECOND = 0x2712,
595 BLE_GATT_UNIT_ACCELERATION_METRES_PER_SECOND_SQUARED = 0x2713,
600 BLE_GATT_UNIT_WAVENUMBER_RECIPROCAL_METRE = 0x2714,
605 BLE_GATT_UNIT_DENSITY_KILOGRAM_PER_CUBIC_METRE = 0x2715,
610 BLE_GATT_UNIT_SURFACE_DENSITY_KILOGRAM_PER_SQUARE_METRE = 0x2716,
615 BLE_GATT_UNIT_SPECIFIC_VOLUME_CUBIC_METRE_PER_KILOGRAM = 0x2717,
620 BLE_GATT_UNIT_CURRENT_DENSITY_AMPERE_PER_SQUARE_METRE = 0x2718,
625 BLE_GATT_UNIT_MAGNETIC_FIELD_STRENGTH_AMPERE_PER_METRE = 0x2719,
630 BLE_GATT_UNIT_AMOUNT_CONCENTRATION_MOLE_PER_CUBIC_METRE = 0x271A,
635 BLE_GATT_UNIT_MASS_CONCENTRATION_KILOGRAM_PER_CUBIC_METRE = 0x271B,
640 BLE_GATT_UNIT_LUMINANCE_CANDELA_PER_SQUARE_METRE = 0x271C,
645 BLE_GATT_UNIT_REFRACTIVE_INDEX = 0x271D,
650 BLE_GATT_UNIT_RELATIVE_PERMEABILITY = 0x271E,
655 BLE_GATT_UNIT_PLANE_ANGLE_RADIAN = 0x2720,
660 BLE_GATT_UNIT_SOLID_ANGLE_STERADIAN = 0x2721,
665 BLE_GATT_UNIT_FREQUENCY_HERTZ = 0x2722,
670 BLE_GATT_UNIT_FORCE_NEWTON = 0x2723,
675 BLE_GATT_UNIT_PRESSURE_PASCAL = 0x2724,
680 BLE_GATT_UNIT_ENERGY_JOULE = 0x2725,
685 BLE_GATT_UNIT_POWER_WATT = 0x2726,
690 BLE_GATT_UNIT_ELECTRIC_CHARGE_COULOMB = 0x2727,
695 BLE_GATT_UNIT_ELECTRIC_POTENTIAL_DIFFERENCE_VOLT = 0x2728,
700 BLE_GATT_UNIT_CAPACITANCE_FARAD = 0x2729,
705 BLE_GATT_UNIT_ELECTRIC_RESISTANCE_OHM = 0x272A,
710 BLE_GATT_UNIT_ELECTRIC_CONDUCTANCE_SIEMENS = 0x272B,
715 BLE_GATT_UNIT_MAGNETIC_FLUX_WEBER = 0x272C,
720 BLE_GATT_UNIT_MAGNETIC_FLUX_DENSITY_TESLA = 0x272D,
725 BLE_GATT_UNIT_INDUCTANCE_HENRY = 0x272E,
730 BLE_GATT_UNIT_THERMODYNAMIC_TEMPERATURE_DEGREE_CELSIUS = 0x272F,
735 BLE_GATT_UNIT_LUMINOUS_FLUX_LUMEN = 0x2730,
740 BLE_GATT_UNIT_ILLUMINANCE_LUX = 0x2731,
745 BLE_GATT_UNIT_ACTIVITY_REFERRED_TO_A_RADIONUCLIDE_BECQUEREL = 0x2732,
750 BLE_GATT_UNIT_ABSORBED_DOSE_GRAY = 0x2733,
755 BLE_GATT_UNIT_DOSE_EQUIVALENT_SIEVERT = 0x2734,
760 BLE_GATT_UNIT_CATALYTIC_ACTIVITY_KATAL = 0x2735,
765 BLE_GATT_UNIT_DYNAMIC_VISCOSITY_PASCAL_SECOND = 0x2740,
770 BLE_GATT_UNIT_MOMENT_OF_FORCE_NEWTON_METRE = 0x2741,
775 BLE_GATT_UNIT_SURFACE_TENSION_NEWTON_PER_METRE = 0x2742,
780 BLE_GATT_UNIT_ANGULAR_VELOCITY_RADIAN_PER_SECOND = 0x2743,
785 BLE_GATT_UNIT_ANGULAR_ACCELERATION_RADIAN_PER_SECOND_SQUARED = 0x2744,
790 BLE_GATT_UNIT_HEAT_FLUX_DENSITY_WATT_PER_SQUARE_METRE = 0x2745,
795 BLE_GATT_UNIT_HEAT_CAPACITY_JOULE_PER_KELVIN = 0x2746,
800 BLE_GATT_UNIT_SPECIFIC_HEAT_CAPACITY_JOULE_PER_KILOGRAM_KELVIN = 0x2747,
805 BLE_GATT_UNIT_SPECIFIC_ENERGY_JOULE_PER_KILOGRAM = 0x2748,
810 BLE_GATT_UNIT_THERMAL_CONDUCTIVITY_WATT_PER_METRE_KELVIN = 0x2749,
815 BLE_GATT_UNIT_ENERGY_DENSITY_JOULE_PER_CUBIC_METRE = 0x274A,
820 BLE_GATT_UNIT_ELECTRIC_FIELD_STRENGTH_VOLT_PER_METRE = 0x274B,
825 BLE_GATT_UNIT_ELECTRIC_CHARGE_DENSITY_COULOMB_PER_CUBIC_METRE = 0x274C,
830 BLE_GATT_UNIT_SURFACE_CHARGE_DENSITY_COULOMB_PER_SQUARE_METRE = 0x274D,
835 BLE_GATT_UNIT_ELECTRIC_FLUX_DENSITY_COULOMB_PER_SQUARE_METRE = 0x274E,
840 BLE_GATT_UNIT_PERMITTIVITY_FARAD_PER_METRE = 0x274F,
845 BLE_GATT_UNIT_PERMEABILITY_HENRY_PER_METRE = 0x2750,
850 BLE_GATT_UNIT_MOLAR_ENERGY_JOULE_PER_MOLE = 0x2751,
855 BLE_GATT_UNIT_MOLAR_ENTROPY_JOULE_PER_MOLE_KELVIN = 0x2752,
860 BLE_GATT_UNIT_EXPOSURE_COULOMB_PER_KILOGRAM = 0x2753,
865 BLE_GATT_UNIT_ABSORBED_DOSE_RATE_GRAY_PER_SECOND = 0x2754,
870 BLE_GATT_UNIT_RADIANT_INTENSITY_WATT_PER_STERADIAN = 0x2755,
875 BLE_GATT_UNIT_RADIANCE_WATT_PER_SQUARE_METRE_STERADIAN = 0x2756,
880 BLE_GATT_UNIT_CATALYTIC_ACTIVITY_CONCENTRATION_KATAL_PER_CUBIC_METRE = 0x2757,
885 BLE_GATT_UNIT_TIME_MINUTE = 0x2760,
890 BLE_GATT_UNIT_TIME_HOUR = 0x2761,
895 BLE_GATT_UNIT_TIME_DAY = 0x2762,
900 BLE_GATT_UNIT_PLANE_ANGLE_DEGREE = 0x2763,
905 BLE_GATT_UNIT_PLANE_ANGLE_MINUTE = 0x2764,
910 BLE_GATT_UNIT_PLANE_ANGLE_SECOND = 0x2765,
915 BLE_GATT_UNIT_AREA_HECTARE = 0x2766,
920 BLE_GATT_UNIT_VOLUME_LITRE = 0x2767,
925 BLE_GATT_UNIT_MASS_TONNE = 0x2768,
930 BLE_GATT_UNIT_PRESSURE_BAR = 0x2780,
935 BLE_GATT_UNIT_PRESSURE_MILLIMETRE_OF_MERCURY = 0x2781,
940 BLE_GATT_UNIT_LENGTH_ANGSTROM = 0x2782,
945 BLE_GATT_UNIT_LENGTH_NAUTICAL_MILE = 0x2783,
950 BLE_GATT_UNIT_AREA_BARN = 0x2784,
955 BLE_GATT_UNIT_VELOCITY_KNOT = 0x2785,
960 BLE_GATT_UNIT_LOGARITHMIC_RADIO_QUANTITY_NEPER = 0x2786,
965 BLE_GATT_UNIT_LOGARITHMIC_RADIO_QUANTITY_BEL = 0x2787,
970 BLE_GATT_UNIT_LENGTH_YARD = 0x27A0,
975 BLE_GATT_UNIT_LENGTH_PARSEC = 0x27A1,
980 BLE_GATT_UNIT_LENGTH_INCH = 0x27A2,
985 BLE_GATT_UNIT_LENGTH_FOOT = 0x27A3,
990 BLE_GATT_UNIT_LENGTH_MILE = 0x27A4,
995 BLE_GATT_UNIT_PRESSURE_POUND_FORCE_PER_SQUARE_INCH = 0x27A5,
1000 BLE_GATT_UNIT_VELOCITY_KILOMETRE_PER_HOUR = 0x27A6,
1005 BLE_GATT_UNIT_VELOCITY_MILE_PER_HOUR = 0x27A7,
1010 BLE_GATT_UNIT_ANGULAR_VELOCITY_REVOLUTION_PER_MINUTE = 0x27A8,
1015 BLE_GATT_UNIT_ENERGY_GRAM_CALORIE = 0x27A9,
1020 BLE_GATT_UNIT_ENERGY_KILOGRAM_CALORIE = 0x27AA,
1025 BLE_GATT_UNIT_ENERGY_KILOWATT_HOUR = 0x27AB,
1030 BLE_GATT_UNIT_THERMODYNAMIC_TEMPERATURE_DEGREE_FAHRENHEIT = 0x27AC,
1035 BLE_GATT_UNIT_PERCENTAGE = 0x27AD,
1040 BLE_GATT_UNIT_PER_MILLE = 0x27AE,
1045 BLE_GATT_UNIT_PERIOD_BEATS_PER_MINUTE = 0x27AF,
1050 BLE_GATT_UNIT_ELECTRIC_CHARGE_AMPERE_HOURS = 0x27B0,
1055 BLE_GATT_UNIT_MASS_DENSITY_MILLIGRAM_PER_DECILITRE = 0x27B1,
1060 BLE_GATT_UNIT_MASS_DENSITY_MILLIMOLE_PER_LITRE = 0x27B2,
1065 BLE_GATT_UNIT_TIME_YEAR = 0x27B3,
1070 BLE_GATT_UNIT_TIME_MONTH = 0x27B4,
1075 BLE_GATT_UNIT_CONCENTRATION_COUNT_PER_CUBIC_METRE = 0x27B5,
1080 BLE_GATT_UNIT_IRRADIANCE_WATT_PER_SQUARE_METRE = 0x27B6
1096 BLE_GATT_FORMAT_RFU = 0x00,
1101 BLE_GATT_FORMAT_BOOLEAN = 0x01,
1106 BLE_GATT_FORMAT_2BIT = 0x02,
1111 BLE_GATT_FORMAT_NIBBLE = 0x03,
1116 BLE_GATT_FORMAT_UINT8 = 0x04,
1121 BLE_GATT_FORMAT_UINT12 = 0x05,
1126 BLE_GATT_FORMAT_UINT16 = 0x06,
1131 BLE_GATT_FORMAT_UINT24 = 0x07,
1136 BLE_GATT_FORMAT_UINT32 = 0x08,
1141 BLE_GATT_FORMAT_UINT48 = 0x09,
1146 BLE_GATT_FORMAT_UINT64 = 0x0A,
1151 BLE_GATT_FORMAT_UINT128 = 0x0B,
1156 BLE_GATT_FORMAT_SINT8 = 0x0C,
1161 BLE_GATT_FORMAT_SINT12 = 0x0D,
1166 BLE_GATT_FORMAT_SINT16 = 0x0E,
1171 BLE_GATT_FORMAT_SINT24 = 0x0F,
1176 BLE_GATT_FORMAT_SINT32 = 0x10,
1181 BLE_GATT_FORMAT_SINT48 = 0x11,
1186 BLE_GATT_FORMAT_SINT64 = 0x12,
1191 BLE_GATT_FORMAT_SINT128 = 0x13,
1196 BLE_GATT_FORMAT_FLOAT32 = 0x14,
1201 BLE_GATT_FORMAT_FLOAT64 = 0x15,
1206 BLE_GATT_FORMAT_SFLOAT = 0x16,
1211 BLE_GATT_FORMAT_FLOAT = 0x17,
1216 BLE_GATT_FORMAT_DUINT16 = 0x18,
1221 BLE_GATT_FORMAT_UTF8S = 0x19,
1226 BLE_GATT_FORMAT_UTF16S = 0x1A,
1231 BLE_GATT_FORMAT_STRUCT = 0x1B
1246 BLE_GATT_CHAR_PROPERTIES_NONE = 0x00,
1252 BLE_GATT_CHAR_PROPERTIES_BROADCAST = 0x01,
1257 BLE_GATT_CHAR_PROPERTIES_READ = 0x02,
1262 BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE = 0x04,
1267 BLE_GATT_CHAR_PROPERTIES_WRITE = 0x08,
1272 BLE_GATT_CHAR_PROPERTIES_NOTIFY = 0x10,
1277 BLE_GATT_CHAR_PROPERTIES_INDICATE = 0x20,
1282 BLE_GATT_CHAR_PROPERTIES_AUTHENTICATED_SIGNED_WRITES = 0x40,
1288 BLE_GATT_CHAR_PROPERTIES_EXTENDED_PROPERTIES = 0x80
1301 const uint8_t writable =
1302 BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE |
1303 BLE_GATT_CHAR_PROPERTIES_WRITE |
1304 BLE_GATT_CHAR_PROPERTIES_AUTHENTICATED_SIGNED_WRITES;
1306 return properties & writable;
1319 const uint8_t readable = BLE_GATT_CHAR_PROPERTIES_READ;
1320 return properties & readable;
1411 uint8_t *valuePtr =
nullptr,
1413 uint16_t maxLen = 0,
1414 uint8_t props = BLE_GATT_CHAR_PROPERTIES_NONE,
1416 unsigned numDescriptors = 0,
1417 bool hasVariableLen =
true 1418 ) : _valueAttribute(uuid, valuePtr, len, maxLen, hasVariableLen),
1420 _descriptors(descriptors),
1421 _descriptorCount(numDescriptors),
1422 readAuthorizationCallback(),
1423 writeAuthorizationCallback(),
1424 _update_security(SecurityRequirement_t::NONE) {
1425 _valueAttribute.allowWrite(isWritable(_properties));
1426 _valueAttribute.allowRead(isReadable(_properties));
1428 #if BLE_FEATURE_SECURITY 1431 if (_properties & BLE_GATT_CHAR_PROPERTIES_AUTHENTICATED_SIGNED_WRITES) {
1432 _valueAttribute.setWriteSecurityRequirement(
1433 SecurityRequirement_t::UNAUTHENTICATED
1436 #endif // BLE_FEATURE_SECURITY 1443 delete _implicit_cccd;
1444 _implicit_cccd =
nullptr;
1457 SecurityRequirement_t read_security,
1458 SecurityRequirement_t write_security,
1459 SecurityRequirement_t update_security
1461 setReadSecurityRequirement(read_security);
1462 setWriteSecurityRequirement(write_security);
1463 setUpdateSecurityRequirement(update_security);
1473 _valueAttribute.setReadSecurityRequirement(security);
1483 return _valueAttribute.getReadSecurityRequirement();
1498 #if BLE_FEATURE_SECURITY 1500 ((_properties & BLE_GATT_CHAR_PROPERTIES_AUTHENTICATED_SIGNED_WRITES) &&
1501 ((security == SecurityRequirement_t::NONE) ||
1502 (security == SecurityRequirement_t::SC_AUTHENTICATED))) ==
false 1504 #endif // BLE_FEATURE_SECURITY 1505 _valueAttribute.setWriteSecurityRequirement(security);
1515 return _valueAttribute.getWriteSecurityRequirement();
1529 _update_security = security.
value();
1559 writeAuthorizationCallback.attach(
callback);
1574 template <
typename T>
1579 writeAuthorizationCallback.attach(
object, member);
1590 return writeAuthorizationCallback;
1606 readAuthorizationCallback.attach(
callback);
1622 template <
typename T>
1627 readAuthorizationCallback.attach(
object, member);
1638 return readAuthorizationCallback;
1657 if (!isWriteAuthorizationEnabled()) {
1663 writeAuthorizationCallback.call(params);
1691 if (!isReadAuthorizationEnabled()) {
1697 readAuthorizationCallback.call(params);
1709 return _valueAttribute;
1719 return _valueAttribute;
1732 return getValueAttribute().getHandle();
1754 return (_implicit_cccd ==
nullptr? _descriptorCount : _descriptorCount+1);
1767 return readAuthorizationCallback;
1780 return writeAuthorizationCallback;
1798 if(index == _descriptorCount) {
1800 return _implicit_cccd;
1802 else if (index > _descriptorCount) {
1806 return _descriptors[index];
1812 friend ble::impl::GattServer;
1814 #if !defined(DOXYGEN_ONLY) 1824 _implicit_cccd = implicit_cccd;
1826 #endif // !defined(DOXYGEN_ONLY) 1840 uint8_t _properties;
1850 uint8_t _descriptorCount;
1866 readAuthorizationCallback;
1872 writeAuthorizationCallback;
1880 uint8_t _update_security: SecurityRequirement_t::size;
1886 template <
typename T>
1910 uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE,
1912 unsigned numDescriptors = 0
1915 reinterpret_cast<uint8_t *>(valuePtr),
1918 BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties,
1929 template <
typename T>
1953 uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE,
1955 unsigned numDescriptors = 0
1958 reinterpret_cast<uint8_t *>(valuePtr),
1961 BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties,
1971 template <
typename T>
1995 uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE,
1997 unsigned numDescriptors = 0
2000 reinterpret_cast<uint8_t *>(valuePtr),
2003 BLE_GATT_CHAR_PROPERTIES_READ | BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties,
2014 template <
typename T,
unsigned NUM_ELEMENTS>
2037 T valuePtr[NUM_ELEMENTS],
2038 uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE,
2040 unsigned numDescriptors = 0
2043 reinterpret_cast<uint8_t *>(valuePtr),
2044 sizeof(T) * NUM_ELEMENTS,
2045 sizeof(T) * NUM_ELEMENTS,
2046 BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties,
2057 template <
typename T,
unsigned NUM_ELEMENTS>
2081 T valuePtr[NUM_ELEMENTS],
2082 uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE,
2084 unsigned numDescriptors = 0
2087 reinterpret_cast<uint8_t *>(valuePtr),
2088 sizeof(T) * NUM_ELEMENTS,
2089 sizeof(T) * NUM_ELEMENTS,
2090 BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties,
2102 template <
typename T,
unsigned NUM_ELEMENTS>
2126 T valuePtr[NUM_ELEMENTS],
2127 uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE,
2129 unsigned numDescriptors = 0
2132 reinterpret_cast<uint8_t *>(valuePtr),
2133 sizeof(T) * NUM_ELEMENTS,
2134 sizeof(T) * NUM_ELEMENTS,
2135 BLE_GATT_CHAR_PROPERTIES_READ | BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties,
Helper class that represents a readable and writable GattCharacteristic.
uint8_t getProperties() const
Get the characteristic's properties.
GattAuthCallbackReply_t authorizationReply
Authorization result.
static bool isWritable(uint8_t properties)
Indicates if the properties has at least one of the writable flags.
GattAuthCallbackReply_t authorizeRead(GattReadAuthCallbackParams *params)
Invoke the read authorization callback.
GATT write authorization request event.
GattAttribute::Handle_t getValueHandle() const
Get the characteristic's value attribute handle in the ATT table.
SecurityRequirement_t getReadSecurityRequirement() const
Get the security requirement of the read operation.
const FunctionPointerWithContext< GattWriteAuthCallbackParams * > & getWriteAuthorizationCallback() const
Return the callback registered to handle client's write.
void setUpdateSecurityRequirement(SecurityRequirement_t security)
Set the security requirement of update operations.
Security requirement that can be attached to an attribute operation.
void setSecurityRequirements(SecurityRequirement_t read_security, SecurityRequirement_t write_security, SecurityRequirement_t update_security)
Set all security requirements of the characteristic.
Helper class that represents a readable and writable GattCharacteristic with an array value...
ble::att_security_requirement_t SecurityRequirement_t
Security level applied to GATT operations.
GATT read authorization request event.
GattAttribute & getValueAttribute()
Get the characteristic's value attribute.
GattAuthCallbackReply_t authorizationReply
Authorization result.
LayoutType value() const
Explicit access to the inner value of the SafeEnum instance.
const GattAttribute & getValueAttribute() const
Get the characteristic's value attribute.
type
struct scoped enum wrapped by the class
Helper class that represents a read-only GattCharacteristic with an array value.
Representation of a Universally Unique Identifier (UUID).
void setReadSecurityRequirement(SecurityRequirement_t security)
Set the security of the read operation.
Representation of a GattServer attribute.
const FunctionPointerWithContext< GattReadAuthCallbackParams * > & getReadAuthorizationCallback() const
Return the callback registered to handle client's read.
ble::attribute_handle_t Handle_t
Representation of an attribute handle.
Helper class that represents a write-only GattCharacteristic with an array value. ...
uint8_t getDescriptorCount() const
Get the total number of descriptors within this characteristic.
void setReadAuthorizationCallback(void(*callback)(GattReadAuthCallbackParams *))
Register the read requests event handler.
bool isReadAuthorizationEnabled() const
Check whether read authorization is enabled.
GattAuthCallbackReply_t authorizeWrite(GattWriteAuthCallbackParams *params)
Invoke the write authorization callback.
static bool isReadable(uint8_t properties)
Indicates if the properties is readable.
SecurityRequirement_t getWriteSecurityRequirement() const
Get the security requirement of write operations.
Representation of a GattServer characteristic.
GattAttribute * getDescriptor(uint8_t index)
Get this characteristic's descriptor at a specific index.
Helper class that represents a write only GattCharacteristic.
bool isWriteAuthorizationEnabled() const
Check whether write authorization is enabled.
SecurityRequirement_t getUpdateSecurityRequirement() const
Get the security requirement of update operations.
void setReadAuthorizationCallback(T *object, void(T::*member)(GattReadAuthCallbackParams *))
Register the read requests event handler.
void setWriteAuthorizationCallback(void(*callback)(GattWriteAuthCallbackParams *))
Register a callback handling client's write requests or commands.
void setWriteSecurityRequirement(SecurityRequirement_t security)
Set the security requirement of the write operations.
GattCharacteristic(const UUID &uuid, uint8_t *valuePtr=nullptr, uint16_t len=0, uint16_t maxLen=0, uint8_t props=BLE_GATT_CHAR_PROPERTIES_NONE, GattAttribute *descriptors[]=nullptr, unsigned numDescriptors=0, bool hasVariableLen=true)
Constructs a new GattCharacteristic.
void setWriteAuthorizationCallback(T *object, void(T::*member)(GattWriteAuthCallbackParams *))
Register a callback handling client's write requests or commands.
Helper class that represents a read only GattCharacteristic.
Entry namespace for all BLE API definitions.
GattAuthCallbackReply_t
Enumeration of allowed values returned by read or write authorization process.