Skip to content

Commit 7f6959c

Browse files
committed
Add service isStarted method, remove abort in NimBLEServer::start.
1 parent 068419d commit 7f6959c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/NimBLEServer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ void NimBLEServer::start() {
215215
if(svc->m_removed == 0) {
216216
rc = ble_gatts_find_svc(&svc->getUUID().getNative()->u, &svc->m_handle);
217217
if(rc != 0) {
218-
abort();
218+
NIMBLE_LOGW(LOG_TAG, "GATT Server started without service: %s, Service %s",
219+
svc->getUUID().toString().c_str(), svc->isStarted() ? "missing" : "not started");
220+
continue; // Skip this service as it was not started
219221
}
220222
}
221223

src/NimBLEService.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class NimBLEService {
4444
uint16_t getHandle();
4545
std::string toString();
4646
void dump();
47-
47+
bool isStarted() { return m_pSvcDef != nullptr; }
4848
bool start();
4949

5050
NimBLECharacteristic* createCharacteristic(const char* uuid,

0 commit comments

Comments
 (0)