From 6357a0dbea07639bb02b058fc6934a3e42dc484d Mon Sep 17 00:00:00 2001 From: mr258876 <55922010+mr258876@users.noreply.github.com> Date: Mon, 16 Dec 2024 00:32:19 +0800 Subject: [PATCH] Fix compiling errors when central is disabled. * Fix missing member error 'm_pClient' in NimBLEServer --- src/NimBLEServer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/NimBLEServer.cpp b/src/NimBLEServer.cpp index cbd5624..5a15205 100644 --- a/src/NimBLEServer.cpp +++ b/src/NimBLEServer.cpp @@ -70,9 +70,11 @@ NimBLEServer::~NimBLEServer() { delete m_pServerCallbacks; } +# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) if (m_pClient != nullptr) { delete m_pClient; } +# endif } /** @@ -399,10 +401,12 @@ int NimBLEServer::handleGapEvent(ble_gap_event* event, void* arg) { } } +# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) if (pServer->m_pClient && pServer->m_pClient->m_connHandle == event->disconnect.conn.conn_handle) { // If this was also the client make sure it's flagged as disconnected. pServer->m_pClient->m_connHandle = BLE_HS_CONN_HANDLE_NONE; } +# endif if (pServer->m_svcChanged) { pServer->resetGATT();