19 #ifndef __GATT_CHARACTERISTIC_H__ 20 #define __GATT_CHARACTERISTIC_H__ 24 #include "ble/gatt/GattAttribute.h" 25 #include "ble/gatt/GattCallbackParamTypes.h" 1291 const uint8_t writable =
1296 return properties & writable;
1310 return properties & readable;
1401 uint8_t *valuePtr =
nullptr,
1403 uint16_t maxLen = 0,
1406 unsigned numDescriptors = 0,
1407 bool hasVariableLen =
true 1408 ) : _valueAttribute(uuid, valuePtr, len, maxLen, hasVariableLen),
1410 _descriptors(descriptors),
1411 _descriptorCount(numDescriptors),
1412 readAuthorizationCallback(),
1413 writeAuthorizationCallback(),
1414 _update_security(SecurityRequirement_t::NONE) {
1415 _valueAttribute.allowWrite(
isWritable(_properties));
1416 _valueAttribute.allowRead(
isReadable(_properties));
1418 #if BLE_FEATURE_SECURITY 1422 _valueAttribute.setWriteSecurityRequirement(
1426 #endif // BLE_FEATURE_SECURITY 1442 SecurityRequirement_t read_security,
1443 SecurityRequirement_t write_security,
1444 SecurityRequirement_t update_security
1458 _valueAttribute.setReadSecurityRequirement(security);
1468 return _valueAttribute.getReadSecurityRequirement();
1483 #if BLE_FEATURE_SECURITY 1489 #endif // BLE_FEATURE_SECURITY 1490 _valueAttribute.setWriteSecurityRequirement(security);
1500 return _valueAttribute.getWriteSecurityRequirement();
1514 _update_security = security.
value();
1544 writeAuthorizationCallback.attach(
callback);
1559 template <
typename T>
1564 writeAuthorizationCallback.attach(
object, member);
1580 readAuthorizationCallback.attach(
callback);
1596 template <
typename T>
1601 readAuthorizationCallback.attach(
object, member);
1626 writeAuthorizationCallback.call(params);
1660 readAuthorizationCallback.call(params);
1672 return _valueAttribute;
1682 return _valueAttribute;
1717 return _descriptorCount;
1730 return readAuthorizationCallback;
1743 return writeAuthorizationCallback;
1756 if (index >= _descriptorCount) {
1760 return _descriptors[index];
1774 uint8_t _properties;
1784 uint8_t _descriptorCount;
1790 readAuthorizationCallback;
1796 writeAuthorizationCallback;
1810 template <
typename T>
1836 unsigned numDescriptors = 0
1839 reinterpret_cast<uint8_t *>(valuePtr),
1853 template <
typename T>
1879 unsigned numDescriptors = 0
1882 reinterpret_cast<uint8_t *>(valuePtr),
1895 template <
typename T>
1921 unsigned numDescriptors = 0
1924 reinterpret_cast<uint8_t *>(valuePtr),
1938 template <
typename T,
unsigned NUM_ELEMENTS>
1961 T valuePtr[NUM_ELEMENTS],
1964 unsigned numDescriptors = 0
1967 reinterpret_cast<uint8_t *>(valuePtr),
1968 sizeof(T) * NUM_ELEMENTS,
1969 sizeof(T) * NUM_ELEMENTS,
1981 template <
typename T,
unsigned NUM_ELEMENTS>
2005 T valuePtr[NUM_ELEMENTS],
2008 unsigned numDescriptors = 0
2011 reinterpret_cast<uint8_t *>(valuePtr),
2012 sizeof(T) * NUM_ELEMENTS,
2013 sizeof(T) * NUM_ELEMENTS,
2026 template <
typename T,
unsigned NUM_ELEMENTS>
2050 T valuePtr[NUM_ELEMENTS],
2053 unsigned numDescriptors = 0
2056 reinterpret_cast<uint8_t *>(valuePtr),
2057 sizeof(T) * NUM_ELEMENTS,
2058 sizeof(T) * NUM_ELEMENTS,
Part of the Human Interface Device service.
Characteristic of the Device Information Service that contains a UTF8 string representing the serial ...
Molar energy, joule per mole.
Helper class that represents a readable and writable GattCharacteristic.
Angular Velocity, revolution per minute.
Angular velocity, radian per second.
Characteristic of the Phone Alert Status service that allows a client to configure operating mode...
uint8_t getProperties() const
Get the characteristic's properties.
Not used in a service as a characteristic.
Permits reads of the characteristic value.
Characteristic of the Alert Notification Service that shows how many numbers of unread alerts exist i...
GattAuthCallbackReply_t authorizationReply
Authorization result.
Not used in a service as a characteristic.
Radiance, watt per square meter steradian.
Characteristic of the Health Thermometer service that exposes the interval time between two measureme...
Absorbed dose rate, gray per second.
Characteristic of the Alert Notification Service that defines the category of the alert and how many ...
Part of the Human Interface Device service.
IEEE-754 32-bit floating point.
Not used in actual BLE service.
Characteristic of the Device Information Service that contains a UTF8 string representing the firmwar...
static bool isWritable(uint8_t properties)
Indicates if the properties has at least one of the writable flags.
Electric field strength, volt per meter.
GattAuthCallbackReply_t authorizeRead(GattReadAuthCallbackParams *params)
Invoke the read authorization callback.
Electric flux density, coulomb per square meter.
Permits signed writes to the characteristic value.
GATT write authorization request event.
Radiant intensity, watt per steradian.
Characteristic of the Alert Notification service, which exposes categories of unread alert supported ...
Pressure, pound-force per square inch.
Velocity, kilometer per hour.
GattAttribute::Handle_t getValueHandle() const
Get the characteristic's value attribute handle in the ATT table.
Thermal conductivity, watt per meter kelvin.
Not used in a service as a characteristic.
Characteristic of the Health Thermometer service that describes where the measurement takes place...
Molar entropy, joule per mole kelvin.
Characteristic of the Device Information Service that contains an UTF8 string representing the softwa...
SecurityRequirement_t getReadSecurityRequirement() const
Get the security requirement of the read operation.
The operation require encryption with an authenticated peer that paired using secure connection pairi...
Characteristic of the Alert Notification Service that notifies the count of new alerts for a given ca...
Characteristic of the Environmental Sensing service, which exposes humidity measurements.
Handle_t getHandle() const
Get the attribute's handle in the ATT table.
Mass density, millimole per liter.
Not used in a service as a characteristic.
Characteristic of the TX Power service that exposes the current transmission power in dBm...
Angular acceleration, radian per second squared.
Catalytic activity, katal.
Period, beats per minute.
Activity referred to a radionuclide, becquerel.
Characteristic of the Battery service, which exposes the current battery level as a percentage...
Not used in a service as a characteristic.
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.
Characteristic of the Device Information Service that contains a UTF8 string representing the model n...
The operation requires security and there's no requirement towards peer authentication.
Characteristic of the Blood Pressure service that exposes the measurement of the blood sensor...
Electric conductance, siemens.
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.
Logarithmic radio quantity, neper.
GattAttribute & getValueAttribute()
Get the characteristic's value attribute.
Permits notifications of a characteristic value without acknowledgment.
Characteristic of the Blood Pressure service, which exposes intermediate cuff pressure measurements...
GattAuthCallbackReply_t authorizationReply
Authorization result.
Heat capacity, joule per kelvin.
Logarithmic radio quantity, bel.
LayoutType value() const
Explicit access to the inner value of the SafeEnum instance.
const GattAttribute & getValueAttribute() const
Get the characteristic's value attribute.
Mass density, milligram per deciliter.
The operation does not have security requirements.
Describe the features supported by the blood pressure sensor exposed by the Blood Pressure service...
Heat flux density, watt per square meter.
Dynamic viscosity, pascal second.
type
struct scoped enum wrapped by the class
Pressure, millimeter of mercury.
Surface tension, newton per meter.
Control point of the Alert Notification service that allows the client finely tune the notification c...
Catalytic activity concentration, katal per cubic meter.
Not used in a service as a characteristic.
Helper class that represents a read-only GattCharacteristic with an array value.
Representation of a Universally Unique Identifier (UUID).
Characteristic of the Cycling Speed and Cadence (CSC) service that exposes measurements made by the s...
void setReadSecurityRequirement(SecurityRequirement_t security)
Set the security of the read operation.
Representation of a GattServer attribute.
Moment of force, newton meter.
Electric charge, ampere hours.
Thermodynamic temperature, degree Fahrenheit.
Part of the Human Interface Device service.
Electrical charge, coulomb.
Permits writes of the characteristic value without response.
Characteristic of the Cycling Speed and Cadence (CSC) service that exposes features supported by the ...
ble::attribute_handle_t Handle_t
Representation of an attribute handle.
IEEE-754 64-bit floating point.
Characteristic of the Running Speed and Cadence (RSC) service that exposes features supported by the ...
Unsigned 128-bit integer.
Helper class that represents a write-only GattCharacteristic with an array value. ...
Velocity, meters per second.
Characteristic of the Current Time service that contains the current time.
Characteristic of the Reference Time service that informs clients of the status of the time update op...
Not used in a service as a characteristic.
Not used in actual BLE service.
Characteristic of the current Time service that exposes information about the local time...
Electric charge density, coulomb per cubic meter.
Permittivity, farad per meter.
Characteristic of the Scan Parameter service that sends a notification to a client when the server re...
Surface density (kilogram per square meter).
uint8_t getDescriptorCount() const
Get the total number of descriptors within this characteristic.
Dose equivalent, sievert.
void setReadAuthorizationCallback(void(*callback)(GattReadAuthCallbackParams *))
Register the read requests event handler.
bool isReadAuthorizationEnabled() const
Check whether read authorization is enabled.
Magnetic flux density, tesla.
Electrical potential difference, voltage.
Characteristic of the Next DST Change service that returns to clients the time with DST...
GattAuthCallbackReply_t authorizeWrite(GattWriteAuthCallbackParams *params)
Invoke the write authorization callback.
Characteristic of the Glucose service that exposes glucose measurements.
Characteristic of the Glucose service that sends additional information related to the glucose measur...
Part of the Human Interface Device service.
Not used in actual BLE service.
static const uint8_t size
Number of bits required to store the value.
Characteristic of the Environmental Sensing Service that exposes the pressure measured.
Energy density, joule per cubic meter.
Characteristic of the Device Information Service that contains a UTF8 string representing the hardwar...
static bool isReadable(uint8_t properties)
Indicates if the properties is readable.
Control point of the Immediate Alert service that allows the client to command the server to alert to...
Electric current, ampere.
Characteristic of the Device Information Service that contains a UTF8 string representing the manufac...
Wave number reciprocal, meter.
SecurityRequirement_t getWriteSecurityRequirement() const
Get the security requirement of write operations.
The Characteristic Extended Properties descriptor defines additional characteristic properties...
Representation of a GattServer characteristic.
Mass concentration (kilogram per cubic meter).
Characteristic of the Device Information Service that exposes a structure containing an Organizationa...
GattAttribute * getDescriptor(uint8_t index)
Get this characteristic's descriptor at a specific index.
Specific volume (cubic meter per kilogram).
Characteristic of the Health Thermometer service that sends intermediate temperature values while the...
Permits indications of a characteristic value with acknowledgment.
Part of the Human Interface Device service.
Characteristic of the Heart Rate service that indicate the intended location of the heart rate monito...
Luminance (candela per square meter).
Characteristic of the Health Thermometer service that sends temperature measurement to clients...
Helper class that represents a write only GattCharacteristic.
Characteristic of the Scan Parameter service that stores the client's scan parameters (scan interval ...
Not used in actual BLE service.
IEEE-11073 16-bit SFLOAT.
Magnetic field strength, ampere per meter.
Not used in a service as a characteristic.
Exposure, coulomb per kilogram.
Part of the Human Interface Device service.
Irradiance, watt per square meter.
Current density (ampere per square meter).
Permits broadcasts of the characteristic value using the Server Characteristic Configuration descript...
Characteristic of the Environmental Sensing service that exposes the temperature measurement with a r...
bool isWriteAuthorizationEnabled() const
Check whether write authorization is enabled.
SecurityRequirement_t getUpdateSecurityRequirement() const
Get the security requirement of update operations.
Permeability, henry per meter.
void setReadAuthorizationCallback(T *object, void(T::*member)(GattReadAuthCallbackParams *))
Register the read requests event handler.
Energy, kilogram calorie.
Specific heat capacity, joule per kilogram kelvin.
void setWriteAuthorizationCallback(void(*callback)(GattWriteAuthCallbackParams *))
Register a callback handling client's write requests or commands.
Characteristic of the Heart Rate that sends heart rate measurements to registered clients...
void setWriteSecurityRequirement(SecurityRequirement_t security)
Set the security requirement of the write operations.
Characteristic of the Device Information Service; it is a set of values used to create a device ID th...
Amount concentration (mole per cubic meter).
Characteristic of the Heart Rate service used by the client to control the service behavior...
Luminous intensity, candela.
Celsius temperature, degree Celsius.
Thermodynamic temperature, kelvin.
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.
Characteristic of the Glucose service that exposes features supported by the server.
Surface charge density, coulomb per square meter.
Pulse Oxymeter, Glucose and Continuous Glucose Monitoring services use this control point to provide ...
void setWriteAuthorizationCallback(T *object, void(T::*member)(GattWriteAuthCallbackParams *))
Register a callback handling client's write requests or commands.
Amount of substance, mole.
Characteristic of the Running Speed and Cadence (RSC) service that exposes measurements made by the s...
Helper class that represents a read only GattCharacteristic.
Density, kilogram per cubic meter.
Characteristic of the Reference Time service that allows clients to control time update.
Permits writes of the characteristic value with response.
Electric resistance, ohm.
Specific energy, joule per kilogram.
Concentration, count per cubic meter.
Not used as a characteristic UUID.
Part of the Human Interface Device service.
GattAuthCallbackReply_t
Enumeration of allowed values returned by read or write authorization process.
Characteristic of the Phone Alert Status service that returns the ringer setting when read...
Part of the Human Interface Device service.
Acceleration, meters per second squared.
Characteristic of the Current Time service that exposes information related to the current time serve...
Characteristic of the Device Information Service, which exposes various regulatory or certification c...
Part of the Alert Notification service, which exposes the count of unread alert events existing in th...
Not used as a characteristic UUID.