diff options
Diffstat (limited to 'src/BLECharacteristic.cpp')
-rw-r--r-- | src/BLECharacteristic.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/BLECharacteristic.cpp b/src/BLECharacteristic.cpp index f5b8200..284032e 100644 --- a/src/BLECharacteristic.cpp +++ b/src/BLECharacteristic.cpp @@ -94,19 +94,20 @@ void BLECharacteristic::executeCreate(BLEService* pService) { m_semaphoreCreateEvt.take("executeCreate"); - std::string strValue = m_value.getValue(); - + /* esp_attr_value_t value; - value.attr_len = strValue.length(); + value.attr_len = m_value.getLength(); value.attr_max_len = ESP_GATT_MAX_ATTR_LEN; - value.attr_value = (uint8_t*)strValue.data(); + value.attr_value = m_value.getData(); + */ esp_err_t errRc = ::esp_ble_gatts_add_char( m_pService->getHandle(), getUUID().getNative(), static_cast<esp_gatt_perm_t>(ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE), getProperties(), - &value, + //&value, + nullptr, &control); // Whether to auto respond or not. if (errRc != ESP_OK) { @@ -131,7 +132,6 @@ void BLECharacteristic::executeCreate(BLEService* pService) { } // executeCreate - /** * @brief Return the BLE Descriptor for the given UUID if associated with this characteristic. * @param [in] descriptorUUID The UUID of the descriptor that we wish to retrieve. @@ -141,6 +141,7 @@ BLEDescriptor* BLECharacteristic::getDescriptorByUUID(const char* descriptorUUID return m_descriptorMap.getByUUID(BLEUUID(descriptorUUID)); } // getDescriptorByUUID + /** * @brief Return the BLE Descriptor for the given UUID if associated with this characteristic. * @param [in] descriptorUUID The UUID of the descriptor that we wish to retrieve. @@ -274,7 +275,7 @@ void BLECharacteristic::handleGATTServerEvent( ESP_LOGD(LOG_TAG, " - Response to write event: New value: handle: %.2x, uuid: %s", getHandle(), getUUID().toString().c_str()); - char *pHexData = BLEUtils::buildHexData(nullptr, param->write.value, param->write.len); + char* pHexData = BLEUtils::buildHexData(nullptr, param->write.value, param->write.len); ESP_LOGD(LOG_TAG, " - Data: length: %d, data: %s", param->write.len, pHexData); free(pHexData); @@ -422,6 +423,7 @@ void BLECharacteristic::handleGATTServerEvent( } // handleGATTServerEvent + /** * @brief Send an indication. * An indication is a transmission of up to the first 20 bytes of the characteristic value. An indication |