Fix compatibility with new ByteBuffer

This commit is contained in:
Rapsssito 2024-08-23 12:02:55 +02:00
parent 240de01205
commit 15b87b5fb7
2 changed files with 2 additions and 4 deletions

View File

@ -33,10 +33,8 @@ BLECharacteristic::BLECharacteristic(const ESPBTUUID uuid, uint32_t properties)
}
void BLECharacteristic::set_value(ByteBuffer buffer) {
size_t length = buffer.get_capacity();
uint8_t *data = buffer.array();
xSemaphoreTake(this->set_value_lock_, 0L);
this->value_ = std::vector<uint8_t>(data, data + length);
this->value_ = buffer.get_data();
xSemaphoreGive(this->set_value_lock_);
}

View File

@ -46,7 +46,7 @@ void BLEDescriptor::set_value(ByteBuffer buffer) {
return;
}
this->value_.attr_len = length;
memcpy(this->value_.attr_value, buffer.array(), length);
memcpy(this->value_.attr_value, buffer.get_data().data(), length);
}
void BLEDescriptor::gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if,