Skip to content

BLECharacteristic

The model of a BLE Characteristic.

詳細情報

メンバー

PROPERTY_READ

const uint32_t BLECharacteristic::PROPERTY_READ

PROPERTY_WRITE

const uint32_t BLECharacteristic::PROPERTY_WRITE

PROPERTY_NOTIFY

const uint32_t BLECharacteristic::PROPERTY_NOTIFY

PROPERTY_BROADCAST

const uint32_t BLECharacteristic::PROPERTY_BROADCAST

PROPERTY_INDICATE

const uint32_t BLECharacteristic::PROPERTY_INDICATE

PROPERTY_WRITE_NR

const uint32_t BLECharacteristic::PROPERTY_WRITE_NR

indicationTimeout

const uint32_t BLECharacteristic::indicationTimeout

BLECharacteristic()

Construct a characteristic

BLECharacteristic::BLECharacteristic(const char *uuid, uint32_t properties=0)

引数

  • constchar * uuid - UUID (const char*) for the characteristic.
  • uint32_t properties - Properties for the characteristic.

BLECharacteristic()

Construct a characteristic

BLECharacteristic::BLECharacteristic(BLEUUID uuid, uint32_t properties=0)

引数

  • BLEUUID uuid - UUID for the characteristic.
  • uint32_t properties - Properties for the characteristic.

~BLECharacteristic()

Destructor.

BLECharacteristic::~BLECharacteristic()

addDescriptor()

Associate a descriptor with this characteristic.

void BLECharacteristic::addDescriptor(BLEDescriptor *pDescriptor)

引数

  • BLEDescriptor* pDescriptor

getDescriptorByUUID()

Return the BLE Descriptor for the given UUID if associated with this characteristic.

BLEDescriptor * BLECharacteristic::getDescriptorByUUID(const char *descriptorUUID)

引数

  • constchar * descriptorUUID The UUID of the descriptor that we wish to retrieve.

戻り値

BLEDescriptor* The BLE Descriptor. If no such descriptor is associated with the characteristic, nullptr is returned.

getDescriptorByUUID()

Return the BLE Descriptor for the given UUID if associated with this characteristic.

BLEDescriptor * BLECharacteristic::getDescriptorByUUID(BLEUUID descriptorUUID)

引数

  • BLEUUID descriptorUUID The UUID of the descriptor that we wish to retrieve.

戻り値

BLEDescriptor* The BLE Descriptor. If no such descriptor is associated with the characteristic, nullptr is returned.

getUUID()

Get the UUID of the characteristic.

BLEUUID BLECharacteristic::getUUID()

戻り値

BLEUUID The UUID of the characteristic.

getValue()

Retrieve the current value of the characteristic.

std::string BLECharacteristic::getValue()

戻り値

std::string A pointer to storage containing the current characteristic value.

getData()

Retrieve the current raw data of the characteristic.

uint8_t * BLECharacteristic::getData()

戻り値

uint8_t* A pointer to storage containing the current characteristic data.

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.

void BLECharacteristic::indicate()

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.

void BLECharacteristic::notify(bool is_notification=true)

引数

  • bool is_notification

setBroadcastProperty()

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.

void BLECharacteristic::setBroadcastProperty(bool value)

引数

  • bool value The flag value of the property.

setCallbacks()

Set the callback handlers for this characteristic.

void BLECharacteristic::setCallbacks(BLECharacteristicCallbacks *pCallbacks)

引数

  • BLECharacteristicCallbacks* pCallbacks An instance of a callbacks structure used to define any callbacks for the characteristic.

setIndicateProperty()

Set the Indicate property value.

void BLECharacteristic::setIndicateProperty(bool value)

引数

  • bool value Set to true if we are to allow indicate messages.

setNotifyProperty()

Set the Notify property value.

void BLECharacteristic::setNotifyProperty(bool value)

引数

  • bool value Set to true if we are to allow notification messages.

setReadProperty()

Set the Read property value.

void BLECharacteristic::setReadProperty(bool value)

引数

  • bool value Set to true if we are to allow reads.

setValue()

Set the value of the characteristic.

void BLECharacteristic::setValue(uint8_t *data, size_t size)

引数

  • uint8_t* data The data to set for the characteristic.
  • size_t size

setValue()

Set the value of the characteristic from string data. We set the value of the characteristic from the bytes contained in the string.

void BLECharacteristic::setValue(std::string value)

引数

  • std::string value

setValue()

void BLECharacteristic::setValue(uint16_t &data16)

引数

  • uint16_t& data16

setValue()

void BLECharacteristic::setValue(uint32_t &data32)

引数

  • uint32_t& data32

setValue()

void BLECharacteristic::setValue(int &data32)

引数

  • int & data32

setValue()

void BLECharacteristic::setValue(float &data32)

引数

  • float & data32

setValue()

void BLECharacteristic::setValue(double &data64)

引数

  • double & data64

setWriteProperty()

Set the Write property value.

void BLECharacteristic::setWriteProperty(bool value)

引数

  • bool value Set to true if we are to allow writes.

setWriteNoResponseProperty()

Set the Write No Response property value.

void BLECharacteristic::setWriteNoResponseProperty(bool value)

引数

  • bool value Set to true if we are to allow writes with no response.

toString()

Return a string representation of the characteristic.

std::string BLECharacteristic::toString()

戻り値

std::string A string representation of the characteristic.

getHandle()

Get the handle of the characteristic.

uint16_t BLECharacteristic::getHandle()

戻り値

uint16_t The handle of the characteristic.

setAccessPermissions()

void BLECharacteristic::setAccessPermissions(esp_gatt_perm_t perm)

引数

  • esp_gatt_perm_t perm