From a3a3bbf3f638b94dbfb70f2a8f9f2c1a97f055e6 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Wed, 8 May 2024 15:53:37 +0200 Subject: [PATCH] More compilation fixes --- src/ble/tests/TestBleLayer.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ble/tests/TestBleLayer.cpp b/src/ble/tests/TestBleLayer.cpp index ea7865c33a92b1..d6d4bc267ea02c 100644 --- a/src/ble/tests/TestBleLayer.cpp +++ b/src/ble/tests/TestBleLayer.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include @@ -47,10 +48,20 @@ constexpr ChipBleUUID uuidChar2 = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, constexpr ChipBleUUID uuidChar3 = { { 0x64, 0x63, 0x02, 0x38, 0x87, 0x72, 0x45, 0xF2, 0xB8, 0x7D, 0x74, 0x8A, 0x83, 0x21, 0x8F, 0x04 } }; +// Return unique BLE connection object for each call. BLE_CONNECTION_OBJECT GetConnectionObject() { static auto connObj = reinterpret_cast(0x1234); - return ++connObj; + + if constexpr (!std::is_pointer_v) + { + return ++connObj; + } + else + { + static auto n = 0; + return &connObj[n++]; + } } }; // namespace