The model of a BLE Characteristic.
More...
#include <BLECharacteristic.h>
|
static const uint32_t | PROPERTY_READ = 1<<0 |
|
static const uint32_t | PROPERTY_WRITE = 1<<1 |
|
static const uint32_t | PROPERTY_NOTIFY = 1<<2 |
|
static const uint32_t | PROPERTY_BROADCAST = 1<<3 |
|
static const uint32_t | PROPERTY_INDICATE = 1<<4 |
|
static const uint32_t | PROPERTY_WRITE_NR = 1<<5 |
|
|
class | BLEServer |
|
class | BLEService |
|
class | BLEDescriptor |
|
class | BLECharacteristicMap |
|
The model of a BLE Characteristic.
A BLE Characteristic is an identified value container that manages a value. It is exposed by a BLE server and can be read and written to by a BLE client.
◆ BLECharacteristic()
BLECharacteristic::BLECharacteristic |
( |
BLEUUID |
uuid, |
|
|
uint32_t |
properties = 0 |
|
) |
| |
Construct a characteristic.
- Parameters
-
[in] | uuid | - UUID for the characteristic. |
[in] | properties | - Properties for the characteristic. |
◆ addDescriptor()
void BLECharacteristic::addDescriptor |
( |
BLEDescriptor * |
pDescriptor | ) |
|
Associate a descriptor with this characteristic.
- Parameters
-
- Returns
- N/A.
◆ getDescriptorByUUID()
Return the BLE Descriptor for the given UUID if associated with this characteristic.
- Parameters
-
[in] | descriptorUUID | The UUID of the descriptor that we wish to retrieve. |
- Returns
- The BLE Descriptor. If no such descriptor is associated with the characteristic, nullptr is returned.
◆ getUUID()
BLEUUID BLECharacteristic::getUUID |
( |
| ) |
|
Get the UUID of the characteristic.
- Returns
- The UUID of the characteristic.
◆ getValue()
std::string BLECharacteristic::getValue |
( |
| ) |
|
Retrieve the current value of the characteristic.
- Returns
- A pointer to storage containing the current characteristic value.
◆ indicate()
void BLECharacteristic::indicate |
( |
| ) |
|
Send an indication. An indication is a transmission of up to the first 20 bytes of the characteristic value. An indication will block waiting a positive confirmation from the client.
- Returns
- N/A
◆ notify()
void BLECharacteristic::notify |
( |
| ) |
|
Send a notify. A notification is a transmission of up to the first 20 bytes of the characteristic value. An notification will not block; it is a fire and forget.
- Returns
- N/A.
◆ setBroadcastProperty()
void BLECharacteristic::setBroadcastProperty |
( |
bool |
value | ) |
|
Set the permission to broadcast. A characteristics has properties associated with it which define what it is capable of doing. One of these is the broadcast flag.
- Parameters
-
[in] | value | The flag value of the property. |
- Returns
- N/A
◆ setCallbacks()
Set the callback handlers for this characteristic.
- Parameters
-
[in] | pCallbacks | An instance of a callbacks structure used to define any callbacks for the characteristic. |
◆ setIndicateProperty()
void BLECharacteristic::setIndicateProperty |
( |
bool |
value | ) |
|
Set the Indicate property value.
- Parameters
-
[in] | value | Set to true if we are to allow indicate messages. |
◆ setNotifyProperty()
void BLECharacteristic::setNotifyProperty |
( |
bool |
value | ) |
|
Set the Notify property value.
- Parameters
-
[in] | value | Set to true if we are to allow notification messages. |
◆ setReadProperty()
void BLECharacteristic::setReadProperty |
( |
bool |
value | ) |
|
Set the Read property value.
- Parameters
-
[in] | value | Set to true if we are to allow reads. |
◆ setValue() [1/2]
void BLECharacteristic::setValue |
( |
uint8_t * |
data, |
|
|
size_t |
length |
|
) |
| |
Set the value of the characteristic.
- Parameters
-
[in] | data | The data to set for the characteristic. |
[in] | length | The length of the data in bytes. |
◆ setValue() [2/2]
void BLECharacteristic::setValue |
( |
std::string |
value | ) |
|
Set the value of the characteristic from string data. We set the value of the characteristic from the bytes contained in the string.
- Parameters
-
[in] | Set | the value of the characteristic. |
- Returns
- N/A.
◆ setWriteNoResponseProperty()
void BLECharacteristic::setWriteNoResponseProperty |
( |
bool |
value | ) |
|
Set the Write No Response property value.
- Parameters
-
[in] | value | Set to true if we are to allow writes with no response. |
◆ setWriteProperty()
void BLECharacteristic::setWriteProperty |
( |
bool |
value | ) |
|
Set the Write property value.
- Parameters
-
[in] | value | Set to true if we are to allow writes. |
◆ toString()
std::string BLECharacteristic::toString |
( |
| ) |
|
Return a string representation of the characteristic.
- Returns
- A string representation of the characteristic.
The documentation for this class was generated from the following files: