mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 01:34:18 +01:00
Fix compatibility with new ByteBuffer
This commit is contained in:
parent
240de01205
commit
15b87b5fb7
2 changed files with 2 additions and 4 deletions
|
@ -33,10 +33,8 @@ BLECharacteristic::BLECharacteristic(const ESPBTUUID uuid, uint32_t properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLECharacteristic::set_value(ByteBuffer buffer) {
|
void BLECharacteristic::set_value(ByteBuffer buffer) {
|
||||||
size_t length = buffer.get_capacity();
|
|
||||||
uint8_t *data = buffer.array();
|
|
||||||
xSemaphoreTake(this->set_value_lock_, 0L);
|
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_);
|
xSemaphoreGive(this->set_value_lock_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ void BLEDescriptor::set_value(ByteBuffer buffer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->value_.attr_len = length;
|
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,
|
void BLEDescriptor::gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if,
|
||||||
|
|
Loading…
Reference in a new issue