From f23f8c3e966898c0e106552782eafb1c7279d69c Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 10 Feb 2016 11:59:41 +0200 Subject: Bluetooth: samples/peripheral_hr: Add adv-restart hack for nble Force restarting advertising until nble is able to handle this by itself. Change-Id: Ife811eb69a63b98b3b0380b80e403d5d9dc10f22 Signed-off-by: Johan Hedberg --- samples/bluetooth/peripheral_hr/src/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'samples') diff --git a/samples/bluetooth/peripheral_hr/src/main.c b/samples/bluetooth/peripheral_hr/src/main.c index b1a63b3f3..22cab799a 100644 --- a/samples/bluetooth/peripheral_hr/src/main.c +++ b/samples/bluetooth/peripheral_hr/src/main.c @@ -175,6 +175,14 @@ static void connected(struct bt_conn *conn, uint8_t err) static void disconnected(struct bt_conn *conn, uint8_t reason) { printk("Disconnected (reason %u)\n", reason); + +#if defined(CONFIG_NBLE) + /* FIXME: Remove this once nble is capable restarting advertising */ + if (bt_le_adv_start(BT_LE_ADV(BT_LE_ADV_IND), ad, ARRAY_SIZE(ad), + sd, ARRAY_SIZE(sd))) { + printk("Advertising failed to restart\n"); + } +#endif } static struct bt_conn_cb conn_callbacks = { -- cgit v1.2.3