Commit daa783ae authored by Jordan Yates's avatar Jordan Yates Committed by Carles Cufi
Browse files

samples: Bluetooth: use indication destroy cb



Update the `peripheral` and `peripheral_ht` samples to use the
indication `destroy` callback to determine when the indication has
completed, instead of using the value callback of the first active
connection.

Signed-off-by: default avatarJordan Yates <jordan.yates@data61.csiro.au>
parent ffab099e
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -78,6 +78,11 @@ static void indicate_cb(struct bt_conn *conn,
			struct bt_gatt_indicate_params *params, uint8_t err)
{
	printk("Indication %s\n", err != 0U ? "fail" : "success");
}

static void indicate_destroy(struct bt_gatt_indicate_params *params)
{
	printk("Indication complete\n");
	indicating = 0U;
}

@@ -356,7 +361,7 @@ void main(void)

			ind_params.attr = &vnd_svc.attrs[2];
			ind_params.func = indicate_cb;
			ind_params.destroy = NULL;
			ind_params.destroy = indicate_destroy;
			ind_params.data = &indicating;
			ind_params.len = sizeof(indicating);

+6 −1
Original line number Diff line number Diff line
@@ -41,6 +41,11 @@ static void indicate_cb(struct bt_conn *conn,
			struct bt_gatt_indicate_params *params, uint8_t err)
{
	printk("Indication %s\n", err != 0U ? "fail" : "success");
}

static void indicate_destroy(struct bt_gatt_indicate_params *params)
{
	printk("Indication complete\n");
	indicating = 0U;
}

@@ -117,7 +122,7 @@ gatt_indicate:

		ind_params.attr = &hts_svc.attrs[2];
		ind_params.func = indicate_cb;
		ind_params.destroy = NULL;
		ind_params.destroy = indicate_destroy;
		ind_params.data = &htm;
		ind_params.len = sizeof(htm);