From 7e958b77defa2b98b956895e74f01730f641220f Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Tue, 22 May 2018 12:14:36 +0200 Subject: [PATCH] porting: Rename ble_npl_callout_queued "is_active" is more consistent with other APIs naming like "is_empty" or "is_queued". Also "active" instead of "queued" makes more sense since this means callout is active and can fire on timeout. "queued" is just related to implementation on Mynewt where active callout is put on queue. Return value is also changes for consistency. --- nimble/controller/src/ble_ll_conn_hci.c | 2 +- nimble/host/src/ble_hs.c | 2 +- nimble/include/nimble/nimble_npl.h | 2 +- porting/npl/dummy/src/npl_os_dummy.c | 6 +++--- porting/npl/freertos/include/nimble/nimble_npl_os.h | 4 ++-- porting/npl/mynewt/include/nimble/nimble_npl_os.h | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nimble/controller/src/ble_ll_conn_hci.c b/nimble/controller/src/ble_ll_conn_hci.c index ce0911f33..22dbd716b 100644 --- a/nimble/controller/src/ble_ll_conn_hci.c +++ b/nimble/controller/src/ble_ll_conn_hci.c @@ -1464,7 +1464,7 @@ ble_ll_conn_hci_wr_auth_pyld_tmo(uint8_t *cmdbuf, uint8_t *rsp, uint8_t *rsplen) rc = BLE_ERR_INV_HCI_CMD_PARMS; } else { connsm->auth_pyld_tmo = tmo; - if (ble_npl_callout_queued(&connsm->auth_pyld_timer)) { + if (ble_npl_callout_is_active(&connsm->auth_pyld_timer)) { ble_ll_conn_auth_pyld_timer_start(connsm); } } diff --git a/nimble/host/src/ble_hs.c b/nimble/host/src/ble_hs.c index 9410c6727..05975d5f0 100644 --- a/nimble/host/src/ble_hs.c +++ b/nimble/host/src/ble_hs.c @@ -430,7 +430,7 @@ ble_hs_timer_sched(int32_t ticks_from_now) * sooner than the previous expiration time. */ abs_time = ble_npl_time_get() + ticks_from_now; - if (!ble_npl_callout_queued(&ble_hs_timer_timer) || + if (!ble_npl_callout_is_active(&ble_hs_timer_timer) || ((ble_npl_stime_t)(abs_time - ble_npl_callout_get_ticks(&ble_hs_timer_timer))) < 0) { ble_hs_timer_reset(ticks_from_now); diff --git a/nimble/include/nimble/nimble_npl.h b/nimble/include/nimble/nimble_npl.h index 49c775b31..713c3a415 100644 --- a/nimble/include/nimble/nimble_npl.h +++ b/nimble/include/nimble/nimble_npl.h @@ -124,7 +124,7 @@ int ble_npl_callout_reset(struct ble_npl_callout *co, ble_npl_time_t ticks); void ble_npl_callout_stop(struct ble_npl_callout *co); -int ble_npl_callout_queued(struct ble_npl_callout *co); +bool ble_npl_callout_is_active(struct ble_npl_callout *co); uint32_t ble_npl_callout_get_ticks(struct ble_npl_callout *co); diff --git a/porting/npl/dummy/src/npl_os_dummy.c b/porting/npl/dummy/src/npl_os_dummy.c index ba7f538d9..699621aaf 100644 --- a/porting/npl/dummy/src/npl_os_dummy.c +++ b/porting/npl/dummy/src/npl_os_dummy.c @@ -146,10 +146,10 @@ ble_npl_callout_stop(struct ble_npl_callout *co) } -int -ble_npl_callout_queued(struct ble_npl_callout *c) +bool +ble_npl_callout_is_active(struct ble_npl_callout *c) { - return 0; + return false; } ble_npl_time_t diff --git a/porting/npl/freertos/include/nimble/nimble_npl_os.h b/porting/npl/freertos/include/nimble/nimble_npl_os.h index 51bd95990..3a7b83589 100644 --- a/porting/npl/freertos/include/nimble/nimble_npl_os.h +++ b/porting/npl/freertos/include/nimble/nimble_npl_os.h @@ -222,8 +222,8 @@ ble_npl_callout_stop(struct ble_npl_callout *co) xTimerStop(co->handle, portMAX_DELAY); } -static inline int -ble_npl_callout_queued(struct ble_npl_callout *co) +static inline bool +ble_npl_callout_is_active(struct ble_npl_callout *co) { return xTimerIsTimerActive(co->handle) == pdTRUE; } diff --git a/porting/npl/mynewt/include/nimble/nimble_npl_os.h b/porting/npl/mynewt/include/nimble/nimble_npl_os.h index c3ce86194..c53d98814 100644 --- a/porting/npl/mynewt/include/nimble/nimble_npl_os.h +++ b/porting/npl/mynewt/include/nimble/nimble_npl_os.h @@ -210,8 +210,8 @@ ble_npl_callout_stop(struct ble_npl_callout *co) os_callout_stop(&co->co); } -static inline int -ble_npl_callout_queued(struct ble_npl_callout *co) +static inline bool +ble_npl_callout_is_active(struct ble_npl_callout *co) { return os_callout_queued(&co->co); }