You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/11/08 22:55:11 UTC

[21/22] incubator-mynewt-core git commit: BLE TPS service - use sysinit.

BLE TPS service - use sysinit.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/58d6bcd1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/58d6bcd1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/58d6bcd1

Branch: refs/heads/develop
Commit: 58d6bcd13c5e57741be1db292de012b5c92daa7a
Parents: 5663384
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Nov 8 14:46:40 2016 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Nov 8 14:46:40 2016 -0800

----------------------------------------------------------------------
 .../services/tps/include/services/tps/ble_svc_tps.h |  2 +-
 net/nimble/host/services/tps/pkg.yml                |  2 ++
 net/nimble/host/services/tps/src/ble_svc_tps.c      | 16 +++++-----------
 3 files changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/58d6bcd1/net/nimble/host/services/tps/include/services/tps/ble_svc_tps.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/services/tps/include/services/tps/ble_svc_tps.h b/net/nimble/host/services/tps/include/services/tps/ble_svc_tps.h
index c1797ae..ec4cd79 100644
--- a/net/nimble/host/services/tps/include/services/tps/ble_svc_tps.h
+++ b/net/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
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/58d6bcd1/net/nimble/host/services/tps/pkg.yml
----------------------------------------------------------------------
diff --git a/net/nimble/host/services/tps/pkg.yml b/net/nimble/host/services/tps/pkg.yml
index 45d85b6..17b2b87 100644
--- a/net/nimble/host/services/tps/pkg.yml
+++ b/net/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

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/58d6bcd1/net/nimble/host/services/tps/src/ble_svc_tps.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/services/tps/src/ble_svc_tps.c b/net/nimble/host/services/tps/src/ble_svc_tps.c
index 3f241b0..2351a79 100644
--- a/net/nimble/host/services/tps/src/ble_svc_tps.c
+++ b/net/nimble/host/services/tps/src/ble_svc_tps.c
@@ -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);
 }