diff options
author | kolban <kolban1@kolban.com> | 2017-10-13 10:52:17 -0500 |
---|---|---|
committer | kolban <kolban1@kolban.com> | 2017-10-13 10:52:17 -0500 |
commit | 34902f4e7fc6926a005a5ccfd4e530d6a6321613 (patch) | |
tree | 512593068ed656012ee31fced9526bff80ecad55 /src/BLECharacteristic.cpp | |
parent | Merge pull request #5 from sebastiankliem/master (diff) | |
download | thermostat-34902f4e7fc6926a005a5ccfd4e530d6a6321613.tar.gz thermostat-34902f4e7fc6926a005a5ccfd4e530d6a6321613.tar.bz2 thermostat-34902f4e7fc6926a005a5ccfd4e530d6a6321613.zip |
Sync update for 0.4.3 take 2
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 |