Bluetooth: Audio: Add value_handle check to MCC subscribe cb

If the subscribed callback is called with value_handle = 0,
then it should not be treated as a subscription complete.

This will happen when bt_mcc_discover_mcs is called, as
reset_mcs_inst unsubscribed to all characteristics before
discovering again.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2023-03-15 13:39:51 +01:00 committed by Carles Cufí
commit b7c2629a6f

View file

@ -1334,6 +1334,11 @@ static void subscribe_mcs_char_func(struct bt_conn *conn, uint8_t err,
LOG_DBG("Subscribed: value handle: %d, ccc handle: %d", LOG_DBG("Subscribed: value handle: %d, ccc handle: %d",
params->value_handle, params->ccc_handle); params->value_handle, params->ccc_handle);
if (params->value_handle == 0) {
/* Unsubscribing, ignore */
return;
}
/* Subscribe to next characteristic */ /* Subscribe to next characteristic */
subscription_done = subscribe_next_mcs_char(mcs_inst, conn); subscription_done = subscribe_next_mcs_char(mcs_inst, conn);