Bluetooth: GATT: Replace magic number 0 with macro for auto ccc
Replace the magic number 0 with a #defined value for the auto CCC discovery feature. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
aaaffd20a6
commit
ec2c5b0c1f
18 changed files with 34 additions and 45 deletions
|
@ -159,8 +159,7 @@ static void gatt_subscribe(void)
|
|||
subscribe_params.notify = notify_cb;
|
||||
subscribe_params.subscribe = subscribed_cb;
|
||||
|
||||
/* Use the BT_GATT_AUTO_DISCOVER_CCC feature */
|
||||
subscribe_params.ccc_handle = 0;
|
||||
subscribe_params.ccc_handle = BT_GATT_AUTO_DISCOVER_CCC_HANDLE;
|
||||
subscribe_params.disc_params = &disc_params,
|
||||
subscribe_params.value = BT_GATT_CCC_NOTIFY;
|
||||
subscribe_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE;
|
||||
|
|
|
@ -227,8 +227,8 @@ static struct bt_gatt_discover_params disc_params_short;
|
|||
static struct bt_gatt_subscribe_params sub_params_short = {
|
||||
.notify = test_notify,
|
||||
.subscribe = test_short_subscribed,
|
||||
.ccc_handle = 0, /* Auto-discover CCC*/
|
||||
.disc_params = &disc_params_short, /* Auto-discover CCC */
|
||||
.ccc_handle = BT_GATT_AUTO_DISCOVER_CCC_HANDLE,
|
||||
.disc_params = &disc_params_short,
|
||||
.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE,
|
||||
.value = BT_GATT_CCC_NOTIFY,
|
||||
};
|
||||
|
@ -236,8 +236,8 @@ static struct bt_gatt_discover_params disc_params_long;
|
|||
static struct bt_gatt_subscribe_params sub_params_long = {
|
||||
.notify = test_notify,
|
||||
.subscribe = test_long_subscribed,
|
||||
.ccc_handle = 0, /* Auto-discover CCC*/
|
||||
.disc_params = &disc_params_long, /* Auto-discover CCC */
|
||||
.ccc_handle = BT_GATT_AUTO_DISCOVER_CCC_HANDLE,
|
||||
.disc_params = &disc_params_long,
|
||||
.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE,
|
||||
.value = BT_GATT_CCC_NOTIFY,
|
||||
};
|
||||
|
|
|
@ -230,8 +230,8 @@ static struct bt_gatt_discover_params disc_params_short;
|
|||
static struct bt_gatt_subscribe_params sub_params_short = {
|
||||
.notify = test_notify,
|
||||
.subscribe = test_subscribed,
|
||||
.ccc_handle = 0, /* Auto-discover CCC*/
|
||||
.disc_params = &disc_params_short, /* Auto-discover CCC */
|
||||
.ccc_handle = BT_GATT_AUTO_DISCOVER_CCC_HANDLE,
|
||||
.disc_params = &disc_params_short,
|
||||
.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE,
|
||||
.value = BT_GATT_CCC_NOTIFY,
|
||||
};
|
||||
|
@ -239,8 +239,8 @@ static struct bt_gatt_discover_params disc_params_long;
|
|||
static struct bt_gatt_subscribe_params sub_params_long = {
|
||||
.notify = test_notify,
|
||||
.subscribe = test_subscribed,
|
||||
.ccc_handle = 0, /* Auto-discover CCC*/
|
||||
.disc_params = &disc_params_long, /* Auto-discover CCC */
|
||||
.ccc_handle = BT_GATT_AUTO_DISCOVER_CCC_HANDLE,
|
||||
.disc_params = &disc_params_long,
|
||||
.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE,
|
||||
.value = BT_GATT_CCC_NOTIFY,
|
||||
};
|
||||
|
|
|
@ -206,8 +206,7 @@ void gatt_subscribe_to_service_changed(bool subscribe)
|
|||
subscribe_params.subscribe = sc_subscribed;
|
||||
|
||||
if (subscribe) {
|
||||
/* Use the BT_GATT_AUTO_DISCOVER_CCC feature */
|
||||
subscribe_params.ccc_handle = 0;
|
||||
subscribe_params.ccc_handle = BT_GATT_AUTO_DISCOVER_CCC_HANDLE;
|
||||
subscribe_params.disc_params = &disc_params,
|
||||
subscribe_params.value = BT_GATT_CCC_INDICATE;
|
||||
subscribe_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE;
|
||||
|
|
|
@ -109,9 +109,7 @@ static void subscribe(struct bt_conn *conn, uint16_t handle, bt_gatt_notify_func
|
|||
sub_params.subscribe = sub_cb;
|
||||
sub_params.value = BT_GATT_CCC_INDICATE;
|
||||
sub_params.value_handle = handle;
|
||||
|
||||
/* Set-up auto-discovery of the CCC handle */
|
||||
sub_params.ccc_handle = 0;
|
||||
sub_params.ccc_handle = BT_GATT_AUTO_DISCOVER_CCC_HANDLE;
|
||||
sub_params.disc_params = &ccc_disc_params;
|
||||
sub_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE;
|
||||
|
||||
|
|
|
@ -125,9 +125,7 @@ static void subscribe(struct bt_conn *conn,
|
|||
sub_params.subscribe = sub_cb;
|
||||
sub_params.value = BT_GATT_CCC_NOTIFY;
|
||||
sub_params.value_handle = handle;
|
||||
|
||||
/* Set-up auto-discovery of the CCC handle */
|
||||
sub_params.ccc_handle = 0;
|
||||
sub_params.ccc_handle = BT_GATT_AUTO_DISCOVER_CCC_HANDLE;
|
||||
sub_params.disc_params = &ccc_disc_params;
|
||||
sub_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue