mirror of
https://github.com/esphome/esphome.git
synced 2026-09-15 09:08:41 +00:00
Co-authored-by: Dave <dave@morty> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Dave
pre-commit-ci-lite[bot]
parent
65d6bb18ed
commit
fb70095ba1
@@ -218,13 +218,14 @@ void BLECharacteristic::gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt
|
||||
}
|
||||
} else {
|
||||
response.attr_value.offset = 0;
|
||||
if (this->value_.size() + 1 > max_offset) {
|
||||
response.attr_value.len = max_offset;
|
||||
this->value_read_offset_ = max_offset;
|
||||
} else {
|
||||
response.attr_value.len = this->value_.size();
|
||||
response.attr_value.len = this->value_.size();
|
||||
if (response.attr_value.len > ESP_GATT_MAX_ATTR_LEN) {
|
||||
ESP_LOGW(TAG, "Characteristic length %u exceeds buffer size of %u, truncating", response.attr_value.len,
|
||||
ESP_GATT_MAX_ATTR_LEN);
|
||||
response.attr_value.len = ESP_GATT_MAX_ATTR_LEN;
|
||||
}
|
||||
memcpy(response.attr_value.value, this->value_.data(), response.attr_value.len);
|
||||
this->value_read_offset_ = 0;
|
||||
}
|
||||
|
||||
response.attr_value.handle = this->handle_;
|
||||
|
||||
Reference in New Issue
Block a user