diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2016-02-05 12:41:48 +0200 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2016-02-10 18:52:29 -0500 |
commit | eb3b2b5f83ccb2dcd06e036f77db55c4517c6611 (patch) | |
tree | af462f4fe4d543a8688d48ed3ad4be6a5d400036 /samples | |
parent | 51ac70d42bc4e11c81781a588b1ebeee77ead5fb (diff) |
Bluetooth: peripheral: Register services after init
With NBLE driver it is not possible to register services before
bt_enable completes.
Change-Id: I71194150b807e183b0016accb600ae9538ba9b01
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/bluetooth/peripheral/src/main.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/samples/bluetooth/peripheral/src/main.c b/samples/bluetooth/peripheral/src/main.c index 7a67d89de..9d88c4c11 100644 --- a/samples/bluetooth/peripheral/src/main.c +++ b/samples/bluetooth/peripheral/src/main.c @@ -427,6 +427,13 @@ static void bt_ready(int err) printk("Bluetooth initialized\n"); + bt_gatt_register(gap_attrs, ARRAY_SIZE(gap_attrs)); + bt_gatt_register(hrs_attrs, ARRAY_SIZE(hrs_attrs)); + bt_gatt_register(bas_attrs, ARRAY_SIZE(bas_attrs)); + bt_gatt_register(cts_attrs, ARRAY_SIZE(cts_attrs)); + bt_gatt_register(dis_attrs, ARRAY_SIZE(dis_attrs)); + bt_gatt_register(vnd_attrs, ARRAY_SIZE(vnd_attrs)); + err = bt_le_adv_start(BT_LE_ADV(BT_LE_ADV_IND), ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { @@ -478,13 +485,6 @@ void main(void) /* Simulate current time for Current Time Service */ generate_current_time(ct); - bt_gatt_register(gap_attrs, ARRAY_SIZE(gap_attrs)); - bt_gatt_register(hrs_attrs, ARRAY_SIZE(hrs_attrs)); - bt_gatt_register(bas_attrs, ARRAY_SIZE(bas_attrs)); - bt_gatt_register(cts_attrs, ARRAY_SIZE(cts_attrs)); - bt_gatt_register(dis_attrs, ARRAY_SIZE(dis_attrs)); - bt_gatt_register(vnd_attrs, ARRAY_SIZE(vnd_attrs)); - bt_conn_cb_register(&conn_callbacks); bt_conn_auth_cb_register(&auth_cb_display); |