From 21039e545a86729246c76b26a1aa559d99dc5257 Mon Sep 17 00:00:00 2001 From: Christopher Collins Date: Tue, 8 Nov 2016 14:46:40 -0800 Subject: [PATCH] BLE TPS service - use sysinit. X-Original-Commit: 58d6bcd13c5e57741be1db292de012b5c92daa7a --- .../tps/include/services/tps/ble_svc_tps.h | 2 +- nimble/host/services/tps/pkg.yml | 2 ++ nimble/host/services/tps/src/ble_svc_tps.c | 16 +++++----------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/nimble/host/services/tps/include/services/tps/ble_svc_tps.h b/nimble/host/services/tps/include/services/tps/ble_svc_tps.h index c1797ae55..ec4cd790a 100644 --- a/nimble/host/services/tps/include/services/tps/ble_svc_tps.h +++ b/nimble/host/services/tps/include/services/tps/ble_svc_tps.h @@ -25,7 +25,7 @@ struct ble_hs_cfg; #define BLE_SVC_TPS_UUID16 0x1804 #define BLE_SVC_TPS_CHR_UUID16_TX_POWER_LEVEL 0x2a07 -int ble_svc_tps_init(struct ble_hs_cfg *cfg); +void ble_svc_tps_init(void); #endif diff --git a/nimble/host/services/tps/pkg.yml b/nimble/host/services/tps/pkg.yml index 45d85b6ec..17b2b8741 100644 --- a/nimble/host/services/tps/pkg.yml +++ b/nimble/host/services/tps/pkg.yml @@ -30,3 +30,5 @@ pkg.keywords: pkg.deps: - net/nimble/host +pkg.init_function: ble_svc_tps_init +pkg.init_stage: 3 diff --git a/nimble/host/services/tps/src/ble_svc_tps.c b/nimble/host/services/tps/src/ble_svc_tps.c index 3f241b01c..2351a795e 100644 --- a/nimble/host/services/tps/src/ble_svc_tps.c +++ b/nimble/host/services/tps/src/ble_svc_tps.c @@ -21,7 +21,6 @@ #include #include "host/ble_hs.h" #include "services/tps/ble_svc_tps.h" -#include "../../../src/ble_hci_priv.h" int8_t ble_svc_tps_tx_power_level; @@ -80,19 +79,14 @@ ble_svc_tps_access(uint16_t conn_handle, uint16_t attr_handle, /** * Initialize the TPS */ -int -ble_svc_tps_init(struct ble_hs_cfg *cfg) +void +ble_svc_tps_init(void) { int rc; + rc = ble_gatts_count_cfg(ble_svc_tps_defs, cfg); - if (rc != 0) { - return rc; - } + SYSINIT_PANIC_ASSERT(rc == 0); rc = ble_gatts_add_svcs(ble_svc_tps_defs); - if (rc != 0) { - return rc; - } - - return 0; + SYSINIT_PANIC_ASSERT(rc == 0); }