mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-01 15:47:54 +00:00
nimble/iso: Fix missing big_handle return parameter
This fixes ble_iso_create_big to return the BIG handle created to the API user. Signed-off-by: Mariusz Skamra <[email protected]>
This commit is contained in:
committed by
Szymon Janc
parent
8b7eda2a56
commit
f901dfa0c2
@@ -164,6 +164,7 @@ cmd_iso_big_create(int argc, char **argv)
|
||||
{
|
||||
struct ble_iso_create_big_params params = { 0 };
|
||||
struct ble_iso_big_params big_params = { 0 };
|
||||
uint8_t big_handle;
|
||||
int rc;
|
||||
|
||||
rc = parse_arg_init(argc - 1, argv + 1);
|
||||
@@ -235,12 +236,14 @@ cmd_iso_big_create(int argc, char **argv)
|
||||
big_params.broadcast_code = parse_arg_extract("broadcast_code");
|
||||
big_params.encryption = big_params.broadcast_code ? 1 : 0;
|
||||
|
||||
rc = ble_iso_create_big(¶ms, &big_params);
|
||||
rc = ble_iso_create_big(¶ms, &big_params, &big_handle);
|
||||
if (rc != 0) {
|
||||
console_printf("BIG create failed (%d)\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
console_printf("New big_handle %u created\n", big_handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
|
||||
struct ble_audio_broadcast {
|
||||
SLIST_ENTRY(ble_audio_broadcast) next;
|
||||
uint8_t big_handle;
|
||||
uint8_t adv_instance;
|
||||
struct ble_audio_base *base;
|
||||
struct ble_iso_big_params *big_params;
|
||||
@@ -332,7 +333,8 @@ ble_audio_broadcast_start(uint8_t adv_instance,
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_iso_create_big(&create_big_params, broadcast->big_params);
|
||||
rc = ble_iso_create_big(&create_big_params, broadcast->big_params,
|
||||
&broadcast->big_handle);
|
||||
if (rc) {
|
||||
BLE_HS_LOG_ERROR("Failed to create BIG (rc=%d)\n", rc);
|
||||
return rc;
|
||||
@@ -378,7 +380,7 @@ ble_audio_broadcast_destroy(uint8_t adv_instance)
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_iso_terminate_big(adv_instance);
|
||||
rc = ble_iso_terminate_big(broadcast->big_handle);
|
||||
if (rc) {
|
||||
BLE_HS_LOG_ERROR("Failed to terminate BIG\n");
|
||||
return rc;
|
||||
|
||||
@@ -307,6 +307,7 @@ struct ble_iso_create_big_params {
|
||||
* the BIG. These parameters include settings
|
||||
* such as SDU interval, maximum SDU size,
|
||||
* transport latency, etc.
|
||||
* @param[out] big_handle BIG instance handle
|
||||
*
|
||||
* @return 0 on success;
|
||||
* an error code on failure.
|
||||
@@ -315,7 +316,8 @@ struct ble_iso_create_big_params {
|
||||
* function specified in @p create_params.
|
||||
*/
|
||||
int ble_iso_create_big(const struct ble_iso_create_big_params *create_params,
|
||||
const struct ble_iso_big_params *big_params);
|
||||
const struct ble_iso_big_params *big_params,
|
||||
uint8_t *big_handle);
|
||||
|
||||
/**
|
||||
* Terminates an existing Broadcast Isochronous Group (BIG).
|
||||
|
||||
@@ -228,7 +228,8 @@ ble_iso_big_free(struct ble_iso_big *big)
|
||||
#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
|
||||
int
|
||||
ble_iso_create_big(const struct ble_iso_create_big_params *create_params,
|
||||
const struct ble_iso_big_params *big_params)
|
||||
const struct ble_iso_big_params *big_params,
|
||||
uint8_t *big_handle)
|
||||
{
|
||||
struct ble_hci_le_create_big_cp cp = { 0 };
|
||||
struct ble_iso_big *big;
|
||||
@@ -271,6 +272,8 @@ ble_iso_create_big(const struct ble_iso_create_big_params *create_params,
|
||||
memcpy(cp.broadcast_code, big_params->broadcast_code, 16);
|
||||
}
|
||||
|
||||
*big_handle = big->handle;
|
||||
|
||||
return ble_hs_hci_cmd_tx(BLE_HCI_OP(BLE_HCI_OGF_LE,
|
||||
BLE_HCI_OCF_LE_CREATE_BIG),
|
||||
&cp, sizeof(cp),NULL, 0);
|
||||
|
||||
Reference in New Issue
Block a user