You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2024/03/06 12:41:57 UTC
(mynewt-nimble) 01/02: nimble/iso: Fix missing big_handle return parameter
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit f901dfa0c2fec668e277ae4546dffdd15f320962
Author: Mariusz Skamra <ma...@codecoup.pl>
AuthorDate: Tue Mar 5 11:43:58 2024 +0100
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 <ma...@codecoup.pl>
---
apps/btshell/src/cmd_iso.c | 5 ++++-
nimble/host/audio/src/ble_audio_broadcast_source.c | 6 ++++--
nimble/host/include/host/ble_iso.h | 4 +++-
nimble/host/src/ble_iso.c | 5 ++++-
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/apps/btshell/src/cmd_iso.c b/apps/btshell/src/cmd_iso.c
index 284f02111..27a9bc9d4 100644
--- a/apps/btshell/src/cmd_iso.c
+++ b/apps/btshell/src/cmd_iso.c
@@ -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;
}
diff --git a/nimble/host/audio/src/ble_audio_broadcast_source.c b/nimble/host/audio/src/ble_audio_broadcast_source.c
index d243a5f19..20edcceab 100644
--- a/nimble/host/audio/src/ble_audio_broadcast_source.c
+++ b/nimble/host/audio/src/ble_audio_broadcast_source.c
@@ -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;
diff --git a/nimble/host/include/host/ble_iso.h b/nimble/host/include/host/ble_iso.h
index 1bae3366d..ee99b962b 100644
--- a/nimble/host/include/host/ble_iso.h
+++ b/nimble/host/include/host/ble_iso.h
@@ -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).
diff --git a/nimble/host/src/ble_iso.c b/nimble/host/src/ble_iso.c
index 503cdd0d0..76bc94803 100644
--- a/nimble/host/src/ble_iso.c
+++ b/nimble/host/src/ble_iso.c
@@ -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);