A model of a BLE descriptor.
More...
#include <BLEDescriptor.hpp>
A model of a BLE descriptor.
◆ getHandle()
uint16_t BLEDescriptor::getHandle |
( |
| ) |
|
Get the BLE handle for this descriptor.
- Returns
- The handle for this descriptor.
◆ getLength()
size_t BLEDescriptor::getLength |
( |
| ) |
|
Get the length of the value of this descriptor.
- Returns
- The length (in bytes) of the value of this descriptor.
80 return m_value.attr_len;
◆ getValue()
uint8_t * BLEDescriptor::getValue |
( |
| ) |
|
Get the value of this descriptor.
- Returns
- A pointer to the value of this descriptor.
98 return m_value.attr_value;
◆ setCallbacks()
Set the callback handlers for this descriptor.
- Parameters
-
[in] | pCallbacks | An instance of a callback structure used to define any callbacks for the descriptor. |
107 _debug_print_p(TAG,
">> setCallbacks", pCallback);
108 m_pCallback = pCallback;
109 _debug_print(TAG,
"<< setCallbacks");
◆ setValue() [1/2]
void BLEDescriptor::setValue |
( |
std::string |
value | ) |
|
Set the value of the descriptor.
- Parameters
-
[in] | value | The value of the descriptor in string form. |
148 setValue((uint8_t*) value.data(), value.length());
◆ setValue() [2/2]
void BLEDescriptor::setValue |
( |
uint8_t * |
data, |
|
|
size_t |
length |
|
) |
| |
Set the value of the descriptor.
- Parameters
-
[in] | data | The data to set for the descriptor. |
[in] | length | The length of the data in bytes. |
132 if (length > BLE_GATT_MAX_ATTR_LEN) {
133 void *logCtx __attribute__((unused)) =
nullptr;
134 _debug_print_d(TAG,
"Size too large", length, &logCtx);
135 _debug_print_d(TAG,
", must be no bigger than", BLE_GATT_MAX_ATTR_LEN, &logCtx);
138 m_value.attr_len = length;
139 memcpy(m_value.attr_value, data, length);
◆ toString()
std::string BLEDescriptor::toString |
( |
| ) |
|
Return a string representation of the descriptor.
- Returns
- A string representation of the descriptor.
160 std::stringstream stringstream;
161 stringstream << std::hex << std::setfill(
'0');
162 stringstream <<
"UUID: " << m_bleUUID.
toString() +
", handle: 0x" << std::setw(2) << m_handle;
163 return stringstream.str();
The documentation for this class was generated from the following files:
void setValue(uint8_t *data, size_t size)
Set the value of the descriptor.
Definition: BLEDescriptor.cpp:131