From 80160ccdbe4886ab56babfd6b4c36249fd097299 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Wed, 4 Sep 2019 11:30:17 +0200 Subject: [PATCH] porting: Enable periodic advertising on linux port Make sure that linux port is build with all features enabled. --- porting/examples/linux/include/syscfg/syscfg.h | 14 +++++++++----- porting/npl/linux/src/os_eventq.cc | 13 +++++++++++++ porting/npl/linux/src/wqueue.h | 6 ++++++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/porting/examples/linux/include/syscfg/syscfg.h b/porting/examples/linux/include/syscfg/syscfg.h index 507a580dd..779093b92 100644 --- a/porting/examples/linux/include/syscfg/syscfg.h +++ b/porting/examples/linux/include/syscfg/syscfg.h @@ -236,23 +236,27 @@ /*** net/nimble */ #ifndef MYNEWT_VAL_BLE_EXT_ADV -#define MYNEWT_VAL_BLE_EXT_ADV (0) +#define MYNEWT_VAL_BLE_EXT_ADV (1) #endif #ifndef MYNEWT_VAL_BLE_EXT_ADV_MAX_SIZE -#define MYNEWT_VAL_BLE_EXT_ADV_MAX_SIZE (31) +#define MYNEWT_VAL_BLE_EXT_ADV_MAX_SIZE (1650) #endif #ifndef MYNEWT_VAL_BLE_MAX_CONNECTIONS -#define MYNEWT_VAL_BLE_MAX_CONNECTIONS (1) +#define MYNEWT_VAL_BLE_MAX_CONNECTIONS (5) #endif #ifndef MYNEWT_VAL_BLE_MAX_PERIODIC_SYNCS -#define MYNEWT_VAL_BLE_MAX_PERIODIC_SYNCS (0) +#define MYNEWT_VAL_BLE_MAX_PERIODIC_SYNCS (5) #endif #ifndef MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES -#define MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES (0) +#define MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES (5) +#endif + +#ifndef MYNEWT_VAL_BLE_PERIODIC_ADV +#define MYNEWT_VAL_BLE_PERIODIC_ADV (1) #endif #ifndef MYNEWT_VAL_BLE_ROLE_BROADCASTER diff --git a/porting/npl/linux/src/os_eventq.cc b/porting/npl/linux/src/os_eventq.cc index a3c4b9631..817d8397d 100644 --- a/porting/npl/linux/src/os_eventq.cc +++ b/porting/npl/linux/src/os_eventq.cc @@ -141,4 +141,17 @@ ble_npl_event_run(struct ble_npl_event *ev) ev->ev_cb(ev); } +void +ble_npl_eventq_remove(struct ble_npl_eventq *evq, struct ble_npl_event *ev) +{ + wqueue_t *q = static_cast(evq->q); + + if (!ev->ev_queued) { + return; + } + + ev->ev_queued = 0; + q->remove(ev); +} + } diff --git a/porting/npl/linux/src/wqueue.h b/porting/npl/linux/src/wqueue.h index 451cae1ef..1de779e7d 100644 --- a/porting/npl/linux/src/wqueue.h +++ b/porting/npl/linux/src/wqueue.h @@ -74,6 +74,12 @@ public: return item; } + void remove(T item) { + pthread_mutex_lock(&m_mutex); + m_queue.remove(item); + pthread_mutex_unlock(&m_mutex); + } + int size() { pthread_mutex_lock(&m_mutex); int size = m_queue.size();