BLE TPS service - use sysinit.

X-Original-Commit: 58d6bcd13c5e57741be1db292de012b5c92daa7a
This commit is contained in:
Christopher Collins
2016-11-08 14:46:40 -08:00
parent 7fcdcfe216
commit 57204b65a6
3 changed files with 8 additions and 12 deletions
@@ -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
+2
View File
@@ -30,3 +30,5 @@ pkg.keywords:
pkg.deps:
- net/nimble/host
pkg.init_function: ble_svc_tps_init
pkg.init_stage: 3
+5 -11
View File
@@ -21,7 +21,6 @@
#include <string.h>
#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);
}