Skip to content

Commit 291ab05

Browse files
authoredJun 28, 2024
Merge branch 'master' into zephyr
2 parents 715ab5e + 0460715 commit 291ab05

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
 

‎src/platform/ESP32/ChipDeviceScanner.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#pragma once
1919

20+
#include <ble/Ble.h>
2021
#include <lib/core/CHIPError.h>
2122
#include <system/SystemLayer.h>
2223

@@ -31,7 +32,6 @@
3132
#include "esp_gattc_api.h"
3233
#include "esp_log.h"
3334
#include "freertos/FreeRTOS.h"
34-
#include <ble/Ble.h>
3535
#include <lib/core/CHIPError.h>
3636
#include <system/SystemLayer.h>
3737
#endif

‎src/platform/ESP32/nimble/BLEManagerImpl.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,13 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBle
659659
return false;
660660
}
661661

662-
rc = ble_gattc_write_flat(conId, chr->chr.val_handle, pBuf->Start(), pBuf->DataLength(), OnWriteComplete, this);
662+
if (pBuf->DataLength() > UINT16_MAX)
663+
{
664+
ChipLogError(Ble, "Buffer data Length is too long");
665+
return false;
666+
}
667+
rc = ble_gattc_write_flat(conId, chr->chr.val_handle, pBuf->Start(), static_cast<uint16_t>(pBuf->DataLength()), OnWriteComplete,
668+
this);
663669
if (rc != 0)
664670
{
665671
ChipLogError(Ble, "ble_gattc_write_flat failed: %d", rc);

0 commit comments

Comments
 (0)