From 4c70f15a7489df665ef9da5af8bad673b778d214 Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Thu, 24 May 2018 11:04:09 +0200 Subject: [PATCH] porting: Add common function to run default event queue Now application can just call single function which will run default event queue instead of creating "standard" loop. Also on some OS it may be just possible to call some OS-specific API instead, so it's up to app what to do - this is just a convenience function. --- porting/nimble/include/nimble/nimble_port.h | 2 ++ porting/nimble/src/nimble_port.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/porting/nimble/include/nimble/nimble_port.h b/porting/nimble/include/nimble/nimble_port.h index 496acbbb1..28065cf8e 100644 --- a/porting/nimble/include/nimble/nimble_port.h +++ b/porting/nimble/include/nimble/nimble_port.h @@ -28,6 +28,8 @@ extern "C" { void nimble_port_init(void); +void nimble_port_run(void); + struct ble_npl_eventq *nimble_port_get_dflt_eventq(void); #if NIMBLE_CFG_CONTROLLER diff --git a/porting/nimble/src/nimble_port.c b/porting/nimble/src/nimble_port.c index 606429fe0..bf1803cb5 100644 --- a/porting/nimble/src/nimble_port.c +++ b/porting/nimble/src/nimble_port.c @@ -54,6 +54,17 @@ nimble_port_init(void) #endif } +void +nimble_port_run(void) +{ + struct ble_npl_event *ev; + + while (1) { + ev = ble_npl_eventq_get(&g_eventq_dflt, BLE_NPL_TIME_FOREVER); + ble_npl_event_run(ev); + } +} + struct ble_npl_eventq * nimble_port_get_dflt_eventq(void) {