You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by "KKopyscinski (via GitHub)" <gi...@apache.org> on 2023/09/22 11:07:48 UTC
[GitHub] [mynewt-nimble] KKopyscinski opened a new pull request, #1619: [dnm] nimble/host: auracast API proposal
KKopyscinski opened a new pull request, #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619
This is rough outline of API that could be used to create BASE configuration and start broadcast (setup extended advertising, periodic advertising and BASE advertisements)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342399723
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
+
+ /** Broadcast name length */
+ uint8_t name_len;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+};
+
+struct ble_broadcast_update_params {
+ /** New BLE address to use for advertising */
+ ble_addr_t *addr;
Review Comment:
remove
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] rymanluk commented on a diff in pull request #1619: [dnm] nimble/host: auracast API proposal
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1335484684
##########
nimble/host/services/leaudio/broadcaster/include/leaudio/broadcaster/broadcaster.h:
##########
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "leaudio/leaudio_common.h"
+
+#define BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+struct broadcast_big *
+broadcast_alloc_big(void);
+
+int
+broadcast_free_big(struct broadcast_big *big);
+
+struct broadcast_subgroup *
+broadcast_alloc_big_sub(struct broadcast_big *big);
+
+int
+broadcast_free_big_sub(struct broadcast_big *big,
+ struct broadcast_subgroup *big_sub);
+
+struct broadcast_bis *
+broadcast_alloc_bis(struct broadcast_subgroup *sub);
+
+int
+broadcast_free_bis(struct broadcast_subgroup *big_sub,
+ struct broadcast_bis *bis);
+
+int
+broadcast_start_advertising(struct broadcast_big *big, uint8_t instance,
+ const uint8_t *name, ble_addr_t *addr,
Review Comment:
struct with params please
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1382818277
##########
apps/btshell/src/btshell.h:
##########
@@ -182,6 +185,36 @@ int btshell_l2cap_send(uint16_t conn, uint16_t idx, uint16_t bytes);
int btshell_l2cap_reconfig(uint16_t conn_handle, uint16_t mtu,
uint8_t num, uint8_t idxs[]);
+#if (MYNEWT_VAL(BLE_ISO_BROADCASTER))
+int btshell_broadcast_base_add(uint8_t adv_instance, uint32_t presentation_delay);
Review Comment:
So the flow is like that:
1. `base_add` (calls `btshell_broadcast_base_add`) - allocates memory for `ble_audio_base`, `ble_iso_big_params`. Sets `presentation_delay` and `adv_instance` to base
2. `big_sub_add` (calls `btshell_broadcast_big_sub_add`) - adds subgroup to BASE identified by `adv_instance` (allocates memory, sets fields)
3. `bis_add` (calls `btshell_broadcast_bis_add`) - similar to `big_sub_add`, but for BIS. Adds bis to last added subgroup in BIG identified by `adv_instance`
4. `broadcast_create` (calls `btshell_broadcast_create` - basically calls `ble_audio_broadcast_create`. Here EA and PA params are set, instance configured with both advertisements.
5. `broadcast_start` (calls `btshell_broadcast_start`) - this finally calls `ble_audio_broadcast_start`, so EA, PA are started. `ble_iso_create_big` is also called, and BIG Info advertisements start to broadcast
6. In shell, I haven't added data stream flow to BISes. I'm not sure how this could be done in shell to make sense. I'm preparing standalone demo that does all this, in similar way extended_advertiser demo does. So at this point app has to have some routine (like loop or thread) that calls `ble_iso_tx`, with payload. For BIS `conn_handle` for this function is BIS handle.
7. At this point broadcast can be stopped (`broadcast_stop`), destroyed (`broadcast_destroy`) or updated (`broadcast_update`).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "kolodgrz (via GitHub)" <gi...@apache.org>.
kolodgrz commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1382910427
##########
nimble/host/src/ble_iso.c:
##########
@@ -0,0 +1,369 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <inttypes.h>
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_ISO)
+
+#include "os/os_mbuf.h"
+#include "host/ble_hs_log.h"
+#include "host/ble_hs.h"
+#include "host/ble_iso.h"
+#include "nimble/hci_common.h"
+#include "sys/queue.h"
+#include "ble_hs_hci_priv.h"
+
+struct ble_iso_big {
+ SLIST_ENTRY(ble_iso_big) next;
+ uint8_t id;
+ uint16_t max_pdu;
+ uint8_t num_bis;
+ uint16_t conn_handles[MYNEWT_VAL(BLE_MAX_BIS)];
+
+ ble_iso_event_fn *cb;
+ void *cb_arg;
+};
+
+static SLIST_HEAD(, ble_iso_big) ble_iso_bigs;
+static struct os_mempool ble_iso_big_pool;
+static os_membuf_t ble_iso_big_mem[
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIG), sizeof (struct ble_iso_big))];
+
+static struct ble_iso_big *
+ble_iso_big_alloc(uint16_t adv_handle)
Review Comment:
Advertising handle shouldn't be 8bit ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1390774624
##########
nimble/host/services/auracast/syscfg.yml:
##########
@@ -0,0 +1,27 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.defs:
+ BLE_SVC_AURACAST_ADV_INSTANCE:
+ description: >
+ Defines which advertising instance is used for Auracast.
+ value: 42
Review Comment:
as discussed offline, I'd change it to start index of first auracast (BIG). When user creates more, new BIG will occupy <this + offset> instance.
add restriction that additional instances are > 1
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371267338
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended advertisements. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
+ * `ble_audio_broadcast_destroy` and recreate with `ble_audio_broadcast_create`
+ *
+ * @param[in] params Pointer to structure with new advertising data
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(const struct ble_broadcast_update_params
+ *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_info;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+};
+
+/**
+ * @brief Build BIG subgroup structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BASE.
+ * This function increases `num_subgroups` in BASE structure.
+ *
+ * @param[out] base Pointer to a `ble_audio_base` structure,
+ * that will be extended by the new subgroup
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
+ * structure, that will be filled out with
+ * supplied configuration
+ * @param[in] params Pointer to a `ble_broadcast_subgroup_params`
+ * structure, containing information about new
+ * subgroup
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_build_sub(struct ble_audio_base *base,
+ struct ble_audio_subgroup *sub,
+ const struct ble_broadcast_subgroup_params
+ *params);
+
+/** BIS parameters */
+struct ble_broadcast_bis_params {
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+};
+
+/**
+ * @brief Build BIS structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_bis`
+ * structure. Created BIS extends BIS list in provided subgroup.
+ * This function increases `bis_cnt` in subgroup structure.
+ *
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
+ * structure,
+ * that will be extended by the new BIS
+ * @param[out] bis Pointer to a `ble_broadcast_bis`
Review Comment:
I'd add line "In case of error, filled out data may be erroneous.". Pointers do not change value, so they are ok - but data pointed by them will contain invalid values. Would that be ok?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1382874426
##########
porting/examples/linux/include/syscfg/syscfg.h:
##########
@@ -771,6 +783,14 @@
#define MYNEWT_VAL_BLE_L2CAP_SIG_MAX_PROCS (1)
#endif
+#ifndef MYNEWT_VAL_BLE_MAX_BIG
+#define MYNEWT_VAL_BLE_MAX_BIG (MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES)
+#endif
+
+#ifndef MYNEWT_VAL_BLE_MAX_BIS
+#define MYNEWT_VAL_BLE_MAX_BIS (4)
Review Comment:
As for now, total. I have nothing against changing it to per BIG, I feel like both approaches are valid
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371255560
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended advertisements. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
Review Comment:
I agree
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "kolodgrz (via GitHub)" <gi...@apache.org>.
kolodgrz commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1381423584
##########
nimble/host/services/auracast/syscfg.yml:
##########
@@ -0,0 +1,29 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.defs:
+ BLE_SVC_AURACAST_ADV_INSTANCE:
+ description: >
+ Defines which advertising instance is used for Auracast.
+ If set to -1 last advertising instance is used, and if MESH is enabled, one before that.
+ Must be set to value in range 0 .. BLE_MULTI_ADV_INSTANCES.
Review Comment:
If -1 is valid value why "Must be ... 0 .. BLE" ?
##########
nimble/host/services/auracast/syscfg.yml:
##########
@@ -0,0 +1,29 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.defs:
+ BLE_SVC_AURACAST_ADV_INSTANCE:
+ description: >
+ Defines which advertising instance is used for Auracast.
+ If set to -1 last advertising instance is used, and if MESH is enabled, one before that.
Review Comment:
What is the reason for defining in configuring which advertising instance should be used ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342366819
##########
nimble/host/include/host/ble_iso.h:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_ISO_
+#define H_BLE_ISO_
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_ISO)
+
+#include <inttypes.h>
+
+struct ble_iso_big_params {
+ uint8_t sdu_interval[3];
Review Comment:
uint32
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342381328
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
+
+ /** Broadcast name length */
+ uint8_t name_len;
Review Comment:
null terminated, remove
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342388553
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
Review Comment:
Consider ble_own_addr_t
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375818275
##########
nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_audio_common.h"
+#include "host/ble_audio_broadcast.h"
+
+struct ble_svc_auracast_create_params {
Review Comment:
do you mean additional service data to `Broadcast Audio Announcement Service UUID` ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1351700228
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
Review Comment:
AFAIK this is not needed (own_addr_type in ble_gap_ext_adv_params defines address, set separately)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342380563
##########
nimble/host/include/host/ble_audio_common.h:
##########
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_COMMON_
+#define H_BLE_AUDIO_COMMON_
+
+#include "stdint.h"
+#include "os/queue.h"
+
+#define BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+struct ble_audio_codec_id {
+ /** Coding Fromat */
+ uint8_t format;
+
+ /** Company ID */
+ uint16_t company_id;
+
+ /** Vendor Specific Codec ID */
+ uint16_t vendor_specific;
+};
+
+struct ble_audio_bis {
+ /** Pointer to next BIS in subgroup */
+ STAILQ_ENTRY(ble_audio_bis) next;
+
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t codec_spec_config_len;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t *codec_spec_config;
+};
+
+typedef int ble_audio_broadcast_sub_free_fn(void *cb_args);
+
+struct ble_audio_subgroup {
+ /** Pointer to next subgroup in BIG */
+ STAILQ_ENTRY(ble_audio_subgroup) next;
+
+ /** Number of BISes in subgroup */
+ uint8_t bis_cnt;
+
+ /** Codec ID */
+ struct ble_audio_codec_id codec_id;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+
+ /** Link list of BISes */
+ STAILQ_HEAD(, ble_audio_bis) bises;
+};
+
+struct ble_audio_big {
+ /** Broadcast ID */
+ uint32_t broadcast_id : 24;
+
+ /** Presentation Delay */
+ uint8_t presentation_delay[3];
+
+ /** Number of subgroups in BIG */
+ uint8_t num_subgroups;
+
+ /** Link list of subgroups */
+ STAILQ_HEAD(, ble_audio_subgroup) subs;
+};
+
+struct ble_audio_codec_config_params {
+ /** Mandatory field, codec sampling frequency. */
+ uint8_t sampling_freq;
+
+ /** Mandatory field, codec frame duration. */
+ uint8_t frame_duration;
+
+ /**
+ * Optional field, bitfield with mapped Audio Locations.
+ * Set to 0 to omit in Codec Specific Configuration LTV construction.
+ */
+ uint32_t audio_channel_alloc;
+
+ /** Mandatory field, codec frame duration. */
+ uint16_t octets_per_codec_frame;
+
+ /**
+ * Optional field, codec frame duration.
+ * Set to 0 to omit in Codec Specific Configuration LTV construction.
+ */
+ uint8_t codec_frame_blocks_per_sdu;
+};
+
+/**
+ * @brief Build Codec Specific Configuration LTV structure
+ *
+ * This function packs Codec Specific Configuration settings into LTV format.
+ *
+ * @param params Pointer to a `ble_audio_codec_config_params`
Review Comment:
param in/param out (here and everywhere)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371227772
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
Review Comment:
Hmm the wording I used here seems confusing. So `ble_audio_broadcast_create` created BASE in host, but here we start advertising it. I think proper wording would be
```
This function starts BASE advertisement by enabling extended, periodic and BIGInfo advertisements for this instance.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "andrzej-kaczmarek (via GitHub)" <gi...@apache.org>.
andrzej-kaczmarek commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1389274586
##########
nimble/host/services/auracast/syscfg.yml:
##########
@@ -0,0 +1,27 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.defs:
+ BLE_SVC_AURACAST_ADV_INSTANCE:
+ description: >
+ Defines which advertising instance is used for Auracast.
+ value: 42
Review Comment:
I don't think this should be a syscfg value. app has to call `ble_svc_auracast_create` anyway so it can also include adv instance.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375830783
##########
nimble/host/src/ble_audio_common.c:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "host/ble_audio_common.h"
+#include <string.h>
+
+int ble_audio_build_codec_config(const struct ble_audio_codec_config_params
+ *params,
+ uint8_t *codec_config_out,
+ uint8_t *codec_config_out_len)
+{
+ uint8_t len = 0;
+
+ memcpy(codec_config_out, ¶ms->sampling_freq, 1);
Review Comment:
shouldn't it build LTVs ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375795608
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
Review Comment:
I believe this callback is called when `ble_audio_broadcast_destroy` is called. Is that correct?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375819421
##########
nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h:
##########
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_audio_common.h"
+#include "host/ble_audio_broadcast.h"
+
+struct ble_svc_auracast_create_params {
+ struct ble_audio_base *base;
+ struct ble_iso_big_params *big_params;
+ const char *name;
+ uint8_t adv_instance;
Review Comment:
how application knows `adv_instance` ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1382875227
##########
nimble/host/services/auracast/syscfg.yml:
##########
@@ -0,0 +1,29 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.defs:
+ BLE_SVC_AURACAST_ADV_INSTANCE:
+ description: >
+ Defines which advertising instance is used for Auracast.
+ If set to -1 last advertising instance is used, and if MESH is enabled, one before that.
+ Must be set to value in range 0 .. BLE_MULTI_ADV_INSTANCES.
Review Comment:
changed to -1 .. BLE
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1382997418
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended advertisements. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
+ * `ble_audio_broadcast_destroy` and recreate with `ble_audio_broadcast_create`
+ *
+ * @param[in] params Pointer to structure with new advertising data
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(const struct ble_broadcast_update_params
+ *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_info;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+};
+
+/**
+ * @brief Build BIG subgroup structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BASE.
+ * This function increases `num_subgroups` in BASE structure.
+ *
+ * @param[out] base Pointer to a `ble_audio_base` structure,
+ * that will be extended by the new subgroup
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
+ * structure, that will be filled out with
+ * supplied configuration
+ * @param[in] params Pointer to a `ble_broadcast_subgroup_params`
+ * structure, containing information about new
+ * subgroup
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_build_sub(struct ble_audio_base *base,
+ struct ble_audio_subgroup *sub,
+ const struct ble_broadcast_subgroup_params
+ *params);
+
+/** BIS parameters */
+struct ble_broadcast_bis_params {
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+};
+
+/**
+ * @brief Build BIS structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_bis`
+ * structure. Created BIS extends BIS list in provided subgroup.
+ * This function increases `bis_cnt` in subgroup structure.
+ *
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
+ * structure,
+ * that will be extended by the new BIS
+ * @param[out] bis Pointer to a `ble_broadcast_bis`
Review Comment:
The way that's implemented right now, it has no true way to "fail", because all that happens there is memcpy and STAILQ_INSERT_HEAD/TAIL, plus some fields are set. So we always return 0. Description can be made future proof, as it is now, so in the future some error checking might take place. Maybe this comment should be ommited for now, as this function weakest point is memcpy, and we cannot really check this for error. Any thoughts @rymanluk @sjanc ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342379985
##########
nimble/host/include/host/ble_audio_common.h:
##########
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_COMMON_
+#define H_BLE_AUDIO_COMMON_
+
+#include "stdint.h"
+#include "os/queue.h"
+
+#define BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+struct ble_audio_codec_id {
+ /** Coding Fromat */
+ uint8_t format;
+
+ /** Company ID */
+ uint16_t company_id;
+
+ /** Vendor Specific Codec ID */
+ uint16_t vendor_specific;
+};
+
+struct ble_audio_bis {
+ /** Pointer to next BIS in subgroup */
+ STAILQ_ENTRY(ble_audio_bis) next;
+
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t codec_spec_config_len;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t *codec_spec_config;
+};
+
+typedef int ble_audio_broadcast_sub_free_fn(void *cb_args);
+
+struct ble_audio_subgroup {
+ /** Pointer to next subgroup in BIG */
+ STAILQ_ENTRY(ble_audio_subgroup) next;
+
+ /** Number of BISes in subgroup */
+ uint8_t bis_cnt;
+
+ /** Codec ID */
+ struct ble_audio_codec_id codec_id;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+
+ /** Link list of BISes */
+ STAILQ_HEAD(, ble_audio_bis) bises;
+};
+
+struct ble_audio_big {
+ /** Broadcast ID */
+ uint32_t broadcast_id : 24;
+
+ /** Presentation Delay */
+ uint8_t presentation_delay[3];
+
+ /** Number of subgroups in BIG */
+ uint8_t num_subgroups;
+
+ /** Link list of subgroups */
+ STAILQ_HEAD(, ble_audio_subgroup) subs;
+};
+
+struct ble_audio_codec_config_params {
+ /** Mandatory field, codec sampling frequency. */
+ uint8_t sampling_freq;
+
+ /** Mandatory field, codec frame duration. */
+ uint8_t frame_duration;
+
+ /**
+ * Optional field, bitfield with mapped Audio Locations.
+ * Set to 0 to omit in Codec Specific Configuration LTV construction.
+ */
+ uint32_t audio_channel_alloc;
+
+ /** Mandatory field, codec frame duration. */
+ uint16_t octets_per_codec_frame;
+
+ /**
+ * Optional field, codec frame duration.
+ * Set to 0 to omit in Codec Specific Configuration LTV construction.
+ */
+ uint8_t codec_frame_blocks_per_sdu;
+};
+
+/**
+ * @brief Build Codec Specific Configuration LTV structure
+ *
+ * This function packs Codec Specific Configuration settings into LTV format.
+ *
+ * @param params Pointer to a `ble_audio_codec_config_params`
+ * struct that contains Codec Specific
+ * Configuration.
+ * @param codec_config_out Pointer to a memory that will be filled with
+ * Codec Specific Configuration LTV structure.
+ * Memory size must be sufficient to fit
+ * expected LTV structure size.
+ * @param codec_config_out_len Total length of constructed Codec Specific
+ * Configuration.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_build_codec_config(struct ble_audio_codec_config_params *params,
Review Comment:
const pointer
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342388136
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
Review Comment:
uint8_t *svc_data; // additional advertising data for extended
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371243115
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
Review Comment:
as in https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371242163, I'll remove it entirely
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371222069
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
Review Comment:
You're right, I'll remove it from here, it's a leftover
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375806874
##########
nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_audio_common.h"
+#include "host/ble_audio_broadcast.h"
+
+struct ble_svc_auracast_create_params {
+ struct ble_audio_base *base;
+ struct ble_iso_big_params *big_params;
+ const char *name;
+ uint8_t adv_instance;
+};
+
+/**
+ * @brief Create Auracast Endpoint and configure advertising instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for Auracast broadcast.
+ *
+ * @param[in] params Pointer to a `ble_svc_auracast_create_params`
+ * structure that defines BIG and broadcast name.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * Auracast advertisement.
+ * @param[in] destroy_cb Optional callback to be called when Auracast
+ * advertisement is destroyed.
Review Comment:
That is true, BAP allows that. But for Public Broadcaster we want to make sure broadcast source is visible :) therefore PA will be there whenever auracast is created.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375800333
##########
nimble/host/include/host/ble_audio_common.h:
##########
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_COMMON_
+#define H_BLE_AUDIO_COMMON_
+
+#include "stdint.h"
+#include "os/queue.h"
+
+#define BLE_BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+#define BLE_BROADCAST_SAMPLING_RATE_8000_HZ BIT(0)
+#define BLE_BROADCAST_SAMPLING_RATE_11025_HZ BIT(1)
+#define BLE_BROADCAST_SAMPLING_RATE_16000_HZ BIT(2)
+#define BLE_BROADCAST_SAMPLING_RATE_22050_HZ BIT(3)
+#define BLE_BROADCAST_SAMPLING_RATE_24000_HZ BIT(4)
+#define BLE_BROADCAST_SAMPLING_RATE_32000_HZ BIT(5)
+#define BLE_BROADCAST_SAMPLING_RATE_44100_HZ BIT(6)
+#define BLE_BROADCAST_SAMPLING_RATE_48000_HZ BIT(7)
+#define BLE_BROADCAST_SAMPLING_RATE_88200_HZ BIT(8)
+#define BLE_BROADCAST_SAMPLING_RATE_96000_HZ BIT(9)
+#define BLE_BROADCAST_SAMPLING_RATE_176400_HZ BIT(10)
+#define BLE_BROADCAST_SAMPLING_RATE_192000_HZ BIT(11)
+#define BLE_BROADCAST_SAMPLING_RATE_384000_HZ BIT(12)
+
+#define BLE_BROADCAST_SUPPORTED_FRAME_DURATION_7_5_MS BIT(0)
+#define BLE_BROADCAST_SUPPORTED_FRAME_DURATION_10_MS BIT(1)
+
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_LEFT BIT(0)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_RIGHT BIT(1)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_CENTER BIT(2)
+#define BLE_BROADCAST_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 BIT(3)
+#define BLE_BROADCAST_AUDIO_LOCATION_BACK_LEFT BIT(4)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_LEFT_CENTER BIT(5)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_RIGHT_CENTER BIT(6)
+#define BLE_BROADCAST_AUDIO_LOCATION_BACK_CENTER BIT(7)
+#define BLE_BROADCAST_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 BIT(8)
+#define BLE_BROADCAST_AUDIO_LOCATION_SIDE_LEFT BIT(9)
+#define BLE_BROADCAST_AUDIO_LOCATION_SIDE_RIGHT BIT(10)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_LEFT BIT(11)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_RIGHT BIT(12)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_CENTER BIT(13)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_CENTER BIT(14)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_LEFT BIT(15)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_RIGHT BIT(16)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_SIDE_LEFT BIT(17)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_SIDE_RIGHT BIT(18)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_CENTER BIT(19)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_CENTER BIT(20)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_LEFT BIT(21)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT BIT(22)
+#define BLE_BROADCAST_AUDIO_LOCATION_LEFT_SURROUND BIT(23)
+#define BLE_BROADCAST_AUDIO_LOCATION_RIGHT_SURROUND BIT(24)
+
+struct ble_audio_codec_id {
+ /** Coding Fromat */
+ uint8_t format;
+
+ /** Company ID */
+ uint16_t company_id;
+
+ /** Vendor Specific Codec ID */
+ uint16_t vendor_specific;
+};
+
+struct ble_audio_bis {
Review Comment:
agree with @KKopyscinski
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375823634
##########
nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_audio_common.h"
+#include "host/ble_audio_broadcast.h"
+
+struct ble_svc_auracast_create_params {
Review Comment:
If we want this field I can add it, like there is in `ble_broadcast_create_params`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#issuecomment-1794284307
> Initial Broadcast Source Implementation ?
Changed in commit messages and PR title
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] rymanluk commented on a diff in pull request #1619: [dnm] nimble/host: auracast API proposal
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1335506640
##########
nimble/host/services/leaudio/broadcaster/include/leaudio/broadcaster/broadcaster.h:
##########
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "leaudio/leaudio_common.h"
+
+#define BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+struct broadcast_big *
+broadcast_alloc_big(void);
+
+int
+broadcast_free_big(struct broadcast_big *big);
+
+struct broadcast_subgroup *
+broadcast_alloc_big_sub(struct broadcast_big *big);
+
+int
+broadcast_free_big_sub(struct broadcast_big *big,
+ struct broadcast_subgroup *big_sub);
+
+struct broadcast_bis *
+broadcast_alloc_bis(struct broadcast_subgroup *sub);
+
+int
+broadcast_free_bis(struct broadcast_subgroup *big_sub,
+ struct broadcast_bis *bis);
+
+int
+broadcast_start_advertising(struct broadcast_big *big, uint8_t instance,
Review Comment:
broadcast_destroy()
broadcast_update()
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] rymanluk commented on a diff in pull request #1619: [dnm] nimble/host: auracast API proposal
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1335496146
##########
nimble/host/services/leaudio/broadcaster/include/leaudio/broadcaster/broadcaster.h:
##########
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "leaudio/leaudio_common.h"
+
+#define BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+struct broadcast_big *
+broadcast_alloc_big(void);
Review Comment:
as agreed memory will be managed by the application
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1395604096
##########
nimble/host/services/auracast/src/ble_svc_auracast.c:
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "syscfg/syscfg.h"
+
+#include "host/ble_gap.h"
+#include "host/ble_hs.h"
+#include "host/ble_audio_broadcast.h"
+#include "services/auracast/ble_svc_auracast.h"
+
+#define AURACAST_ADV_INSTANCE \
+ MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE) < 0 ? \
+ (MYNEWT_VAL(BLE_MESH) ? MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES) - 1 : \
+ MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES)) : \
+ MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE)
+
+int
+ble_svc_auracast_create(const struct ble_svc_auracast_create_params *params,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args, ble_gap_event_fn *gap_cb)
+{
+ struct ble_broadcast_create_params create_params;
+ struct ble_gap_periodic_adv_params periodic_params = { 0 };
+ struct ble_gap_ext_adv_params extended_params = {
+ .scannable = 0,
+ .connectable = 0,
+ .primary_phy = BLE_HCI_LE_PHY_1M,
+ };
+ uint8_t own_addr_type;
+ int rc;
+
+ rc = ble_hs_id_infer_auto(0, &own_addr_type);
+ if (rc != 0) {
+ return rc;
+ }
+
+ extended_params.own_addr_type = own_addr_type;
+ extended_params.sid = AURACAST_ADV_INSTANCE;
+ extended_params.secondary_phy = MYNEWT_VAL(BLE_PHY_2M) ?
+ BLE_HCI_LE_PHY_2M : BLE_HCI_LE_PHY_1M;
Review Comment:
done, added check if requested PHY is supported
##########
nimble/host/services/auracast/src/ble_svc_auracast.c:
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "syscfg/syscfg.h"
+
+#include "host/ble_gap.h"
+#include "host/ble_hs.h"
+#include "host/ble_audio_broadcast.h"
+#include "services/auracast/ble_svc_auracast.h"
+
+#define AURACAST_ADV_INSTANCE \
+ MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE) < 0 ? \
+ (MYNEWT_VAL(BLE_MESH) ? MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES) - 1 : \
+ MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES)) : \
+ MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE)
+
+int
+ble_svc_auracast_create(const struct ble_svc_auracast_create_params *params,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args, ble_gap_event_fn *gap_cb)
+{
+ struct ble_broadcast_create_params create_params;
+ struct ble_gap_periodic_adv_params periodic_params = { 0 };
+ struct ble_gap_ext_adv_params extended_params = {
+ .scannable = 0,
+ .connectable = 0,
+ .primary_phy = BLE_HCI_LE_PHY_1M,
+ };
+ uint8_t own_addr_type;
+ int rc;
+
+ rc = ble_hs_id_infer_auto(0, &own_addr_type);
+ if (rc != 0) {
+ return rc;
+ }
+
+ extended_params.own_addr_type = own_addr_type;
+ extended_params.sid = AURACAST_ADV_INSTANCE;
Review Comment:
done
##########
nimble/host/services/auracast/src/ble_svc_auracast.c:
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "syscfg/syscfg.h"
+
+#include "host/ble_gap.h"
+#include "host/ble_hs.h"
+#include "host/ble_audio_broadcast.h"
+#include "services/auracast/ble_svc_auracast.h"
+
+#define AURACAST_ADV_INSTANCE \
+ MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE) < 0 ? \
+ (MYNEWT_VAL(BLE_MESH) ? MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES) - 1 : \
+ MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES)) : \
+ MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE)
+
+int
+ble_svc_auracast_create(const struct ble_svc_auracast_create_params *params,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args, ble_gap_event_fn *gap_cb)
+{
+ struct ble_broadcast_create_params create_params;
+ struct ble_gap_periodic_adv_params periodic_params = { 0 };
+ struct ble_gap_ext_adv_params extended_params = {
+ .scannable = 0,
+ .connectable = 0,
+ .primary_phy = BLE_HCI_LE_PHY_1M,
+ };
+ uint8_t own_addr_type;
+ int rc;
+
+ rc = ble_hs_id_infer_auto(0, &own_addr_type);
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375769855
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
Review Comment:
Yes, it should be advertising instance.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "kolodgrz (via GitHub)" <gi...@apache.org>.
kolodgrz commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1381784263
##########
apps/btshell/src/btshell.h:
##########
@@ -182,6 +185,36 @@ int btshell_l2cap_send(uint16_t conn, uint16_t idx, uint16_t bytes);
int btshell_l2cap_reconfig(uint16_t conn_handle, uint16_t mtu,
uint8_t num, uint8_t idxs[]);
+#if (MYNEWT_VAL(BLE_ISO_BROADCASTER))
+int btshell_broadcast_base_add(uint8_t adv_instance, uint32_t presentation_delay);
Review Comment:
This is original concept to identify broadcast with adv_instance. Can one advertising instance be used for "multiple" purposes in context of one program ? Broadcast ID seems to be an unique ID
##########
apps/btshell/src/btshell.h:
##########
@@ -182,6 +185,36 @@ int btshell_l2cap_send(uint16_t conn, uint16_t idx, uint16_t bytes);
int btshell_l2cap_reconfig(uint16_t conn_handle, uint16_t mtu,
uint8_t num, uint8_t idxs[]);
+#if (MYNEWT_VAL(BLE_ISO_BROADCASTER))
+int btshell_broadcast_base_add(uint8_t adv_instance, uint32_t presentation_delay);
Review Comment:
What this method is doing ? Isn't this a "StartBasicAudioAnnouncement" function ? not sure about having here presentation delay. Where is the "real" BASE prepared ?
What's the flow ? How to start from scratch a broadcast ?
1. Who prepares Broadcast Audio Announcement
2. Who prepares Broadcast Source Audio Endpoint
3. Where it'll be attached to EA, PA
4. Where EA, PA would be started
5. Where data would be bind to BISes
?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1384498428
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended advertisements. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
+ * `ble_audio_broadcast_destroy` and recreate with `ble_audio_broadcast_create`
+ *
+ * @param[in] params Pointer to structure with new advertising data
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(const struct ble_broadcast_update_params
+ *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_info;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+};
+
+/**
+ * @brief Build BIG subgroup structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BASE.
+ * This function increases `num_subgroups` in BASE structure.
+ *
+ * @param[out] base Pointer to a `ble_audio_base` structure,
+ * that will be extended by the new subgroup
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
+ * structure, that will be filled out with
+ * supplied configuration
+ * @param[in] params Pointer to a `ble_broadcast_subgroup_params`
+ * structure, containing information about new
+ * subgroup
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_build_sub(struct ble_audio_base *base,
+ struct ble_audio_subgroup *sub,
+ const struct ble_broadcast_subgroup_params
+ *params);
+
+/** BIS parameters */
+struct ble_broadcast_bis_params {
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+};
+
+/**
+ * @brief Build BIS structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_bis`
+ * structure. Created BIS extends BIS list in provided subgroup.
+ * This function increases `bis_cnt` in subgroup structure.
+ *
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
+ * structure,
+ * that will be extended by the new BIS
+ * @param[out] bis Pointer to a `ble_broadcast_bis`
Review Comment:
Imho, this is exactly why the `return` is the result of operation. In a case of error returned, we don't care about [out] params and its state is unknown. Current description should be good.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1384500722
##########
porting/examples/linux/include/syscfg/syscfg.h:
##########
@@ -771,6 +783,14 @@
#define MYNEWT_VAL_BLE_L2CAP_SIG_MAX_PROCS (1)
#endif
+#ifndef MYNEWT_VAL_BLE_MAX_BIG
+#define MYNEWT_VAL_BLE_MAX_BIG (MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES)
+#endif
+
+#ifndef MYNEWT_VAL_BLE_MAX_BIS
+#define MYNEWT_VAL_BLE_MAX_BIS (4)
Review Comment:
total should be fine.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1382803599
##########
apps/btshell/src/btshell.h:
##########
@@ -182,6 +185,36 @@ int btshell_l2cap_send(uint16_t conn, uint16_t idx, uint16_t bytes);
int btshell_l2cap_reconfig(uint16_t conn_handle, uint16_t mtu,
uint8_t num, uint8_t idxs[]);
+#if (MYNEWT_VAL(BLE_ISO_BROADCASTER))
+int btshell_broadcast_base_add(uint8_t adv_instance, uint32_t presentation_delay);
Review Comment:
Broadcast ID is indeed unique ID. Internally identifying broadcast with adv_instance (which is also used as BIG ID) saves memory. And AFAIK each adv instance can be only used for single broadcast either way - because it needs to have corelated Ext Adv and PA, and this cannot be started on already active instance. This means, you cannot start another broadcast on same instance.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1396975974
##########
nimble/host/services/auracast/syscfg.yml:
##########
@@ -0,0 +1,27 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.defs:
+ BLE_SVC_AURACAST_ADV_INSTANCE:
+ description: >
+ Defines which advertising instance is used for Auracast.
+ value: 42
+
+syscfg.restrictions:
+ - BLE_PERIODIC_ADV: 1
Review Comment:
I removed this all together, added 7abb8e66a5d672d94d2dde33ff294a8809e9abde to fetch non-configured advertising instance and Auracast will report back what was found. Maybe this commit should be moved to another PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#issuecomment-1772603978
This code is still being tested. Auracast package (that is simplified broadcast) implementation is pending
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371221521
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
Review Comment:
As far as I can see it's either that or what I used:
```c
/*
* @return 0 on success;
* A non-zero value on failure.
*/
```
I can see it in L2CAP, I can change it obviously
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371275680
##########
nimble/host/include/host/ble_audio_common.h:
##########
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_COMMON_
+#define H_BLE_AUDIO_COMMON_
+
+#include "stdint.h"
+#include "os/queue.h"
+
+#define BLE_BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+#define BLE_BROADCAST_SAMPLING_RATE_8000_HZ BIT(0)
+#define BLE_BROADCAST_SAMPLING_RATE_11025_HZ BIT(1)
+#define BLE_BROADCAST_SAMPLING_RATE_16000_HZ BIT(2)
+#define BLE_BROADCAST_SAMPLING_RATE_22050_HZ BIT(3)
+#define BLE_BROADCAST_SAMPLING_RATE_24000_HZ BIT(4)
+#define BLE_BROADCAST_SAMPLING_RATE_32000_HZ BIT(5)
+#define BLE_BROADCAST_SAMPLING_RATE_44100_HZ BIT(6)
+#define BLE_BROADCAST_SAMPLING_RATE_48000_HZ BIT(7)
+#define BLE_BROADCAST_SAMPLING_RATE_88200_HZ BIT(8)
+#define BLE_BROADCAST_SAMPLING_RATE_96000_HZ BIT(9)
+#define BLE_BROADCAST_SAMPLING_RATE_176400_HZ BIT(10)
+#define BLE_BROADCAST_SAMPLING_RATE_192000_HZ BIT(11)
+#define BLE_BROADCAST_SAMPLING_RATE_384000_HZ BIT(12)
+
+#define BLE_BROADCAST_SUPPORTED_FRAME_DURATION_7_5_MS BIT(0)
+#define BLE_BROADCAST_SUPPORTED_FRAME_DURATION_10_MS BIT(1)
+
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_LEFT BIT(0)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_RIGHT BIT(1)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_CENTER BIT(2)
+#define BLE_BROADCAST_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 BIT(3)
+#define BLE_BROADCAST_AUDIO_LOCATION_BACK_LEFT BIT(4)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_LEFT_CENTER BIT(5)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_RIGHT_CENTER BIT(6)
+#define BLE_BROADCAST_AUDIO_LOCATION_BACK_CENTER BIT(7)
+#define BLE_BROADCAST_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 BIT(8)
+#define BLE_BROADCAST_AUDIO_LOCATION_SIDE_LEFT BIT(9)
+#define BLE_BROADCAST_AUDIO_LOCATION_SIDE_RIGHT BIT(10)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_LEFT BIT(11)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_RIGHT BIT(12)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_CENTER BIT(13)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_CENTER BIT(14)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_LEFT BIT(15)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_RIGHT BIT(16)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_SIDE_LEFT BIT(17)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_SIDE_RIGHT BIT(18)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_CENTER BIT(19)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_CENTER BIT(20)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_LEFT BIT(21)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT BIT(22)
+#define BLE_BROADCAST_AUDIO_LOCATION_LEFT_SURROUND BIT(23)
+#define BLE_BROADCAST_AUDIO_LOCATION_RIGHT_SURROUND BIT(24)
+
+struct ble_audio_codec_id {
+ /** Coding Fromat */
+ uint8_t format;
+
+ /** Company ID */
+ uint16_t company_id;
+
+ /** Vendor Specific Codec ID */
+ uint16_t vendor_specific;
+};
+
+struct ble_audio_bis {
Review Comment:
I don't think so, sometimes it's just `next` sometimes it has some name appended. I can change that to `bis_next` and `big_sub_next` (in `ble_audio_big_subgroup`). But `next` seems to be perfectly fine, like in `STAILQ_ENTRY(ble_l2cap_coc_srv) next;`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371242163
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
Review Comment:
So my idea for this was that `ble_broadcast_create_params` is `in` parameter. So it's used to configure instances and so on. If function is successful, `ble_broadcast_base_config` will be filled with `out` values, some copied from `ble_broadcast_create_params`, some generated, like `base->broadcast_id`. On second thought I see that this is not the best, I think I'll remove this parameter and save what's needed in host, so the app doesn't need to save `ble_broadcast_base_config` on it's own. And BASE can be identified just by `adv_instance`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342405292
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
+
+ /** Broadcast name length */
+ uint8_t name_len;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+};
+
+struct ble_broadcast_update_params {
+ /** New BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Updated parameters of Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Updated parameters of Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** New Broadcast name */
+ const uint8_t *name;
+
+ /** New Broadcast name length */
+ uint8_t name_len;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_big *big,
+ void *arg);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BIG configuration */
+ struct ble_audio_big *big;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+
+ /** Broadcast ID */
+ uint8_t big_id;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BIG, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(struct ble_broadcast_create_params *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising and terminates them. After return advertising instance is free
+ * and must be configured again for future advertisements.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended and periodic advertisements
+ * for that are used to broadcast with BASE configuration. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
+ * `ble_audio_broadcast_destroy` and recreate with `ble_audio_broadcast_create`
+ *
+ * @param params Pointer to a `ble_broadcast_update_params`
+ * structure.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(struct ble_broadcast_update_params *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_info;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+};
+
+/**
+ * @brief Build BIG subgroup structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BIG.
+ * This function increases `num_subgroups` in BIG structure.
+ *
+ * @param params Pointer to a `ble_broadcast_subgroup_params`
+ * structure, containing information about new
+ * subgroup
+ * @param big Pointer to a `ble_audio_big` structure,
+ * that will be extended by the new subgroup
+ * @param sub Pointer to a `ble_broadcast_subgroup`
+ * structure, that will be filled out with
+ * supplied configuration
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_build_sub(struct ble_broadcast_subgroup_params params,
Review Comment:
*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342400869
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
+
+ /** Broadcast name length */
+ uint8_t name_len;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+};
+
+struct ble_broadcast_update_params {
+ /** New BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Updated parameters of Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Updated parameters of Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** New Broadcast name */
+ const uint8_t *name;
+
+ /** New Broadcast name length */
+ uint8_t name_len;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_big *big,
+ void *arg);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BIG configuration */
+ struct ble_audio_big *big;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+
+ /** Broadcast ID */
+ uint8_t big_id;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BIG, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(struct ble_broadcast_create_params *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising and terminates them. After return advertising instance is free
+ * and must be configured again for future advertisements.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended and periodic advertisements
+ * for that are used to broadcast with BASE configuration. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
+ * `ble_audio_broadcast_destroy` and recreate with `ble_audio_broadcast_create`
+ *
+ * @param params Pointer to a `ble_broadcast_update_params`
+ * structure.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(struct ble_broadcast_update_params *params);
Review Comment:
(uint8* svc_metadata)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342401698
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
+
+ /** Broadcast name length */
+ uint8_t name_len;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+};
+
+struct ble_broadcast_update_params {
+ /** New BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Updated parameters of Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Updated parameters of Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** New Broadcast name */
+ const uint8_t *name;
+
+ /** New Broadcast name length */
+ uint8_t name_len;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_big *big,
+ void *arg);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BIG configuration */
+ struct ble_audio_big *big;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+
+ /** Broadcast ID */
+ uint8_t big_id;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BIG, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(struct ble_broadcast_create_params *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising and terminates them. After return advertising instance is free
+ * and must be configured again for future advertisements.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(struct ble_broadcast_base_config *base_config);
Review Comment:
void * arg
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342400241
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
+
+ /** Broadcast name length */
+ uint8_t name_len;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+};
+
+struct ble_broadcast_update_params {
Review Comment:
remove
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "andrzej-kaczmarek (via GitHub)" <gi...@apache.org>.
andrzej-kaczmarek commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1389275854
##########
nimble/host/services/auracast/src/ble_svc_auracast.c:
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "syscfg/syscfg.h"
+
+#include "host/ble_gap.h"
+#include "host/ble_hs.h"
+#include "host/ble_audio_broadcast.h"
+#include "services/auracast/ble_svc_auracast.h"
+
+#define AURACAST_ADV_INSTANCE \
+ MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE) < 0 ? \
+ (MYNEWT_VAL(BLE_MESH) ? MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES) - 1 : \
+ MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES)) : \
+ MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE)
+
+int
+ble_svc_auracast_create(const struct ble_svc_auracast_create_params *params,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args, ble_gap_event_fn *gap_cb)
+{
+ struct ble_broadcast_create_params create_params;
+ struct ble_gap_periodic_adv_params periodic_params = { 0 };
+ struct ble_gap_ext_adv_params extended_params = {
+ .scannable = 0,
+ .connectable = 0,
+ .primary_phy = BLE_HCI_LE_PHY_1M,
+ };
+ uint8_t own_addr_type;
+ int rc;
+
+ rc = ble_hs_id_infer_auto(0, &own_addr_type);
+ if (rc != 0) {
+ return rc;
+ }
+
+ extended_params.own_addr_type = own_addr_type;
+ extended_params.sid = AURACAST_ADV_INSTANCE;
+ extended_params.secondary_phy = MYNEWT_VAL(BLE_PHY_2M) ?
+ BLE_HCI_LE_PHY_2M : BLE_HCI_LE_PHY_1M;
Review Comment:
this should be also a parameter
##########
nimble/host/services/auracast/src/ble_svc_auracast.c:
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "syscfg/syscfg.h"
+
+#include "host/ble_gap.h"
+#include "host/ble_hs.h"
+#include "host/ble_audio_broadcast.h"
+#include "services/auracast/ble_svc_auracast.h"
+
+#define AURACAST_ADV_INSTANCE \
+ MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE) < 0 ? \
+ (MYNEWT_VAL(BLE_MESH) ? MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES) - 1 : \
+ MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES)) : \
+ MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE)
+
+int
+ble_svc_auracast_create(const struct ble_svc_auracast_create_params *params,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args, ble_gap_event_fn *gap_cb)
+{
+ struct ble_broadcast_create_params create_params;
+ struct ble_gap_periodic_adv_params periodic_params = { 0 };
+ struct ble_gap_ext_adv_params extended_params = {
+ .scannable = 0,
+ .connectable = 0,
+ .primary_phy = BLE_HCI_LE_PHY_1M,
+ };
+ uint8_t own_addr_type;
+ int rc;
+
+ rc = ble_hs_id_infer_auto(0, &own_addr_type);
+ if (rc != 0) {
+ return rc;
+ }
+
+ extended_params.own_addr_type = own_addr_type;
+ extended_params.sid = AURACAST_ADV_INSTANCE;
Review Comment:
this should be parameter
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#issuecomment-1774592877
@kolodgrz please review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1377493139
##########
nimble/syscfg.yml:
##########
@@ -81,7 +81,7 @@ syscfg.defs:
This allows to configure maximum size of advertising data and
scan response data used in LE Advertising Extensions.
Valid range 31-1650.
- value: 31
+ value: 251
Review Comment:
I'll double check if this needs to be changed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371257780
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended advertisements. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
+ * `ble_audio_broadcast_destroy` and recreate with `ble_audio_broadcast_create`
+ *
+ * @param[in] params Pointer to structure with new advertising data
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(const struct ble_broadcast_update_params
+ *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_info;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+};
+
+/**
+ * @brief Build BIG subgroup structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BASE.
+ * This function increases `num_subgroups` in BASE structure.
+ *
+ * @param[out] base Pointer to a `ble_audio_base` structure,
+ * that will be extended by the new subgroup
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
+ * structure, that will be filled out with
+ * supplied configuration
+ * @param[in] params Pointer to a `ble_broadcast_subgroup_params`
+ * structure, containing information about new
+ * subgroup
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_build_sub(struct ble_audio_base *base,
+ struct ble_audio_subgroup *sub,
Review Comment:
I agree, it's more descriptive
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375835230
##########
nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h:
##########
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_audio_common.h"
+#include "host/ble_audio_broadcast.h"
+
+struct ble_svc_auracast_create_params {
+ struct ble_audio_base *base;
+ struct ble_iso_big_params *big_params;
+ const char *name;
+ uint8_t adv_instance;
Review Comment:
It chooses it by itself, like we do for ext adv and PA. So we may expect that it remembers what it chose.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375819421
##########
nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h:
##########
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_audio_common.h"
+#include "host/ble_audio_broadcast.h"
+
+struct ble_svc_auracast_create_params {
+ struct ble_audio_base *base;
+ struct ble_iso_big_params *big_params;
+ const char *name;
+ uint8_t adv_instance;
Review Comment:
how application knows `adv_instnace` ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375839326
##########
nimble/host/src/ble_audio_common.c:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "host/ble_audio_common.h"
+#include <string.h>
+
+int ble_audio_build_codec_config(const struct ble_audio_codec_config_params
+ *params,
+ uint8_t *codec_config_out,
+ uint8_t *codec_config_out_len)
+{
+ uint8_t len = 0;
+
+ memcpy(codec_config_out, ¶ms->sampling_freq, 1);
Review Comment:
I don't know how I missed this. Also, I'll try to add this to shell
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "andrzej-kaczmarek (via GitHub)" <gi...@apache.org>.
andrzej-kaczmarek commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1376149248
##########
nimble/syscfg.yml:
##########
@@ -81,7 +81,7 @@ syscfg.defs:
This allows to configure maximum size of advertising data and
scan response data used in LE Advertising Extensions.
Valid range 31-1650.
- value: 31
+ value: 251
Review Comment:
also if this is required by some feature we should better make 251 conditional depending on that feature, this way default configuration is not changed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342355116
##########
nimble/host/include/host/ble_iso.h:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_ISO_
+#define H_BLE_ISO_
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_ISO)
+
+#include <inttypes.h>
+
+struct ble_iso_big_params {
+ uint8_t sdu_interval[3];
+ uint16_t max_sdu;
+ uint16_t max_transport_latency;
+ uint8_t rtn;
+ uint8_t phy;
+ uint8_t packing;
+ uint8_t framing;
+ uint8_t encryption;
+ uint8_t broadcast_code[16];
+};
+
+struct ble_iso_create_big_params {
+ uint16_t adv_handle;
+ uint8_t bis_cnt;
+};
+
+int ble_iso_create_big(struct ble_iso_create_big_params *create_params,
+ struct ble_iso_big_params *big_params,
+ uint8_t *big_id);
Review Comment:
why pointer?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342375997
##########
nimble/host/include/host/ble_audio_common.h:
##########
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_COMMON_
+#define H_BLE_AUDIO_COMMON_
+
+#include "stdint.h"
+#include "os/queue.h"
+
+#define BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+struct ble_audio_codec_id {
+ /** Coding Fromat */
+ uint8_t format;
+
+ /** Company ID */
+ uint16_t company_id;
+
+ /** Vendor Specific Codec ID */
+ uint16_t vendor_specific;
+};
+
+struct ble_audio_bis {
+ /** Pointer to next BIS in subgroup */
+ STAILQ_ENTRY(ble_audio_bis) next;
+
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t codec_spec_config_len;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t *codec_spec_config;
+};
+
+typedef int ble_audio_broadcast_sub_free_fn(void *cb_args);
+
+struct ble_audio_subgroup {
+ /** Pointer to next subgroup in BIG */
+ STAILQ_ENTRY(ble_audio_subgroup) next;
+
+ /** Number of BISes in subgroup */
+ uint8_t bis_cnt;
+
+ /** Codec ID */
+ struct ble_audio_codec_id codec_id;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+
+ /** Link list of BISes */
+ STAILQ_HEAD(, ble_audio_bis) bises;
+};
+
+struct ble_audio_big {
+ /** Broadcast ID */
+ uint32_t broadcast_id : 24;
+
+ /** Presentation Delay */
+ uint8_t presentation_delay[3];
+
+ /** Number of subgroups in BIG */
+ uint8_t num_subgroups;
+
+ /** Link list of subgroups */
+ STAILQ_HEAD(, ble_audio_subgroup) subs;
+};
+
+struct ble_audio_codec_config_params {
+ /** Mandatory field, codec sampling frequency. */
+ uint8_t sampling_freq;
Review Comment:
add defines
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342368088
##########
nimble/host/include/host/ble_iso.h:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_ISO_
+#define H_BLE_ISO_
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_ISO)
+
+#include <inttypes.h>
+
+struct ble_iso_big_params {
+ uint8_t sdu_interval[3];
+ uint16_t max_sdu;
+ uint16_t max_transport_latency;
+ uint8_t rtn;
+ uint8_t phy;
+ uint8_t packing;
+ uint8_t framing;
+ uint8_t encryption;
+ uint8_t broadcast_code[16];
Review Comment:
byte order hci
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342403401
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
+
+ /** Broadcast name length */
+ uint8_t name_len;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+};
+
+struct ble_broadcast_update_params {
+ /** New BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Updated parameters of Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Updated parameters of Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** New Broadcast name */
+ const uint8_t *name;
+
+ /** New Broadcast name length */
+ uint8_t name_len;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_big *big,
+ void *arg);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BIG configuration */
+ struct ble_audio_big *big;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+
+ /** Broadcast ID */
+ uint8_t big_id;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BIG, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(struct ble_broadcast_create_params *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
Review Comment:
terminate big
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "andrzej-kaczmarek (via GitHub)" <gi...@apache.org>.
andrzej-kaczmarek commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1389274821
##########
nimble/host/services/auracast/syscfg.yml:
##########
@@ -0,0 +1,27 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.defs:
+ BLE_SVC_AURACAST_ADV_INSTANCE:
+ description: >
+ Defines which advertising instance is used for Auracast.
+ value: 42
+
+syscfg.restrictions:
+ - BLE_PERIODIC_ADV: 1
Review Comment:
this likely doesn't work as expected
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371179117
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
Review Comment:
in `host/ble_gap.h` it's just ` Advertising instance`. Maybe keep it consistent?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski merged PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371246364
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
Review Comment:
I think it's the same as what I wrote in https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371212124
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371218466
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
Review Comment:
Yes, this is generic one. If you mean callback for events related to big it's declared in BIG, here: https://github.com/apache/mynewt-nimble/pull/1619/files#diff-b1517448655ef48c5df75a3f4575a12dd70843b36608468fbc001057d3f5f1efR103
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1384505312
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** Broadcast Audio Source Endpoint */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising.
+ * Length must be in range of 4 to 32 chars.
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[in] destroy_cb Optional callback to be invoked on
+ * `ble_audio_broadcast_destroy` call.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement by enabling extended, periodic
+ * and BIGInfo advertisements for this instance.
+ *
+ * @param[in] adv_instance Advertising instance used by broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(uint8_t adv_instance,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ *
+ * @param[in] adv_instance Advertising instance used by broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(uint8_t adv_instance);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] adv_instance Advertising instance used by broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(uint8_t adv_instance);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function updates extended advertisements.
+ *
+ * @param[in] params Pointer to structure with new advertising data
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(const struct ble_broadcast_update_params
+ *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_id;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+};
+
+/**
+ * @brief Build BIG subgroup structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BASE.
+ * This function increases `num_subgroups` in BASE structure.
+ *
+ * @param[out] base Pointer to a `ble_audio_base` structure,
+ * that will be extended by the new subgroup.
+ * In case of error, filled out data may be
+ * erroneous.
+ * @param[out] subgroup Pointer to a `ble_broadcast_subgroup`
+ * structure, that will be filled out with
+ * supplied configuration. In case of error,
+ * filled out data may be erroneous.
+ * @param[in] params Pointer to a `ble_broadcast_subgroup_params`
+ * structure, containing information about new
+ * subgroup
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_build_sub(struct ble_audio_base *base,
+ struct ble_audio_big_subgroup *subgroup,
+ const struct ble_broadcast_subgroup_params
+ *params);
+
+/** BIS parameters */
+struct ble_broadcast_bis_params {
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+};
+
+/**
+ * @brief Build BIS structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_bis`
+ * structure. Created BIS extends BIS list in provided subgroup.
+ * This function increases `bis_cnt` in subgroup structure.
+ *
+ * @param[out] sub Pointer to a updated `ble_broadcast_subgroup`
Review Comment:
right, this should be `ble_audio_big_subgroup`. How to mark in/out params?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "kolodgrz (via GitHub)" <gi...@apache.org>.
kolodgrz commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1382916529
##########
nimble/host/src/ble_iso.c:
##########
@@ -0,0 +1,369 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <inttypes.h>
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_ISO)
+
+#include "os/os_mbuf.h"
+#include "host/ble_hs_log.h"
+#include "host/ble_hs.h"
+#include "host/ble_iso.h"
+#include "nimble/hci_common.h"
+#include "sys/queue.h"
+#include "ble_hs_hci_priv.h"
+
+struct ble_iso_big {
+ SLIST_ENTRY(ble_iso_big) next;
+ uint8_t id;
+ uint16_t max_pdu;
+ uint8_t num_bis;
+ uint16_t conn_handles[MYNEWT_VAL(BLE_MAX_BIS)];
+
+ ble_iso_event_fn *cb;
+ void *cb_arg;
+};
+
+static SLIST_HEAD(, ble_iso_big) ble_iso_bigs;
+static struct os_mempool ble_iso_big_pool;
+static os_membuf_t ble_iso_big_mem[
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIG), sizeof (struct ble_iso_big))];
+
+static struct ble_iso_big *
+ble_iso_big_alloc(uint16_t adv_handle)
+{
+ struct ble_iso_big *new_big;
+ struct ble_iso_big *big;
+
+ if (adv_handle >= BLE_ADV_INSTANCES) {
+ BLE_HS_LOG_ERROR("Invalid advertising instance");
+ return NULL;
+ }
+
+ if (!ble_gap_ext_adv_active(adv_handle)) {
+ BLE_HS_LOG_ERROR("Instance not active");
+ return NULL;
+ }
+
+ new_big = os_memblock_get(&ble_iso_big_pool);
+ if (new_big == NULL) {
+ BLE_HS_LOG_ERROR("No more memory in pool");
+ /* Out of memory. */
+ return NULL;
+ }
+
+ memset(new_big, 0, sizeof *new_big);
+
+ SLIST_FOREACH(big, &ble_iso_bigs, next) {
+ if (big->id == adv_handle) {
+ BLE_HS_LOG_ERROR("Advertising instance (%d) already in use",
+ adv_handle);
+ return NULL;
+ }
+ }
+
+ new_big->id = adv_handle;
+
+ if (SLIST_EMPTY(&ble_iso_bigs)) {
+ SLIST_INSERT_HEAD(&ble_iso_bigs, new_big, next);
+ } else {
+ SLIST_INSERT_AFTER(big, new_big, next);
+ }
+
+ return new_big;
+}
+
+static struct ble_iso_big *
+ble_iso_big_find_by_id(uint8_t big_id)
+{
+ struct ble_iso_big *big;
+
+ SLIST_FOREACH(big, &ble_iso_bigs, next) {
+ if (big->id == big_id) {
+ return big;
+ }
+ }
+
+ return NULL;
+}
+
+static int
+ble_iso_big_free(struct ble_iso_big *big)
+{
+ SLIST_REMOVE(&ble_iso_bigs, big, ble_iso_big, next);
+ os_memblock_put(&ble_iso_big_pool, big);
+ return 0;
+}
+
+int
+ble_iso_create_big(const struct ble_iso_create_big_params *create_params,
+ const struct ble_iso_big_params *big_params)
+{
+ struct ble_hci_le_create_big_cp cp = { 0 };
+ struct ble_iso_big *big;
+
+ big = ble_iso_big_alloc(create_params->adv_handle);
+ if (big == NULL) {
+ return BLE_HS_ENOENT;
+ }
+
+ big->cb = create_params->cb;
+ big->cb_arg = create_params->cb_arg;
+
+ cp.big_handle = create_params->adv_handle;
+
+ cp.adv_handle = create_params->adv_handle;
+ if (create_params->bis_cnt > MYNEWT_VAL(BLE_MAX_BIS)) {
+ return BLE_HS_EINVAL;
+ }
+
+ cp.num_bis = create_params->bis_cnt;
+ put_le24(cp.sdu_interval, big_params->sdu_interval);
+ cp.max_sdu = big_params->max_sdu;
+ cp.max_transport_latency = big_params->max_transport_latency;
+ cp.rtn = big_params->rtn;
+ cp.phy = big_params->phy;
+ cp.packing = big_params->packing;
+ cp.framing = big_params->framing;
+ cp.encryption = big_params->encryption;
+ if (big_params->encryption) {
+ memcpy(cp.broadcast_code, big_params->broadcast_code, 16);
+ }
+
+ return ble_hs_hci_cmd_tx(BLE_HCI_OP(BLE_HCI_OGF_LE,
+ BLE_HCI_OCF_LE_CREATE_BIG),
+ &cp, sizeof(cp),NULL, 0);
+}
+
+int
+ble_iso_terminate_big(uint8_t big_id)
+{
+ struct ble_hci_le_terminate_big_cp cp;
+ struct ble_iso_big *big;
+ int rc;
+
+ big = ble_iso_big_find_by_id(big_id);
+ if (big == NULL) {
+ BLE_HS_LOG_ERROR("No BIG with id=%d\n", big_id);
+ return BLE_HS_ENOENT;
+ }
+
+ cp.big_handle = big->id;
+ cp.reason = BLE_ERR_CONN_TERM_LOCAL;
+
+ rc = ble_hs_hci_cmd_tx(BLE_HCI_OP(BLE_HCI_OGF_LE,
+ BLE_HCI_OCF_LE_TERMINATE_BIG),
+ &cp, sizeof(cp),NULL, 0);
+ if (rc == 0) {
+ ble_iso_big_free(big);
+ }
+
+ return rc;
+}
+
+int
+ble_iso_init(void)
+{
+ int rc;
+
+ SLIST_INIT(&ble_iso_bigs);
+
+ rc = os_mempool_init(&ble_iso_big_pool,
+ MYNEWT_VAL(BLE_MAX_BIG),
+ sizeof (struct ble_iso_big),
+ ble_iso_big_mem, "ble_iso_big_pool");
+ SYSINIT_PANIC_ASSERT(rc == 0);
+
+ return 0;
+}
+
+void
+ble_iso_rx_create_big_complete(const struct ble_hci_ev_le_subev_create_big_complete *ev)
+{
+ struct ble_iso_event event;
+
+ struct ble_iso_big *big;
+ int i;
+
+ big = ble_iso_big_find_by_id(ev->big_handle);
+
+ big->num_bis = ev->num_bis;
+
+ for (i = 0; i < ev->num_bis; i++) {
+ big->conn_handles[i] = ev->conn_handle[i];
+ }
+
+ big->max_pdu = ev->max_pdu;
+
+ event.type = BLE_ISO_EVENT_BIG_CREATE_COMPLETE;
+ event.big_created.desc.big_handle = ev->big_handle;
+ event.big_created.desc.big_sync_delay = get_le24(ev->big_sync_delay);
+ event.big_created.desc.transport_latency_big =
+ get_le24(ev->transport_latency_big);
+ event.big_created.desc.phy = ev->phy;
+ event.big_created.desc.nse = ev->nse;
+ event.big_created.desc.bn = ev->bn;
+ event.big_created.desc.pto = ev->pto;
+ event.big_created.desc.irc = ev->irc;
+ event.big_created.desc.max_pdu = ev->max_pdu;
+ event.big_created.desc.iso_interval = ev->iso_interval;
+ event.big_created.desc.num_bis = ev->num_bis;
+ memcpy(event.big_created.desc.conn_handle, ev->conn_handle,
+ ev->num_bis * sizeof(uint16_t));
+
+ if (big->cb != NULL) {
+ big->cb(&event, big->cb_arg);
+ }
+}
+
+void
+ble_iso_rx_terminate_big_complete(const struct ble_hci_ev_le_subev_terminate_big_complete *ev)
+{
+ struct ble_iso_event event;
+ struct ble_iso_big *big;
+
+ big = ble_iso_big_find_by_id(ev->big_handle);
+
+ event.type = BLE_ISO_EVENT_BIG_TERMINATE_COMPLETE;
+ event.big_terminated.big_handle = ev->big_handle;
+ event.big_terminated.reason = ev->reason;
+
+ if (big->cb != NULL) {
+ big->cb(&event, big->cb_arg);
+ }
+}
+
+static int
+ble_iso_tx_complete(uint16_t conn_handle, const uint8_t *data,
+ uint16_t data_len)
+{
+ struct os_mbuf *om;
+ int rc;
+
+ om = os_msys_get_pkthdr(BLE_HCI_DATA_HDR_SZ + 4, 0);
+ if (!om) {
+ return BLE_HS_ENOMEM;
+ }
+
+ /* Connection_Handle, PB_Flag, TS_Flag */
+ put_le16(&om->om_data[0],
+ BLE_HCI_ISO_HANDLE(conn_handle, BLE_HCI_ISO_PB_COMPLETE, 1));
+ /* Data_Total_Length = Data length + Packet_Sequence_Number placeholder */
+ put_le16(&om->om_data[2], data_len + 4);
+ /* Packet_Sequence_Number placeholder */
+ put_le16(&om->om_data[3], 0);
+ /* ISO_SDU_Length */
+ put_le16(&om->om_data[4], data_len);
+
+ rc = os_mbuf_append(om, data, data_len);
+ if (rc) {
+ return rc;
+ }
+
+ return ble_transport_to_ll_iso(om);
+}
+
+static int
+ble_iso_tx_segmented(uint16_t conn_handle, uint16_t max_pdu,
+ const uint8_t *data, uint16_t data_len)
+{
+ struct os_mbuf *om;
+ uint16_t data_left = data_len;
+ uint16_t packet_len;
+ uint16_t offset = 0;
+ uint8_t pb;
+ uint8_t ts;
+ int rc;
+
+ while (data_left) {
+ packet_len = min(max_pdu - (BLE_HCI_DATA_HDR_SZ + 4), data_left);
+ if (data_left == data_len) {
+ pb = BLE_HCI_ISO_PB_FIRST;
+ ts = 1;
+ } else if (packet_len == data_left) {
+ pb = BLE_HCI_ISO_PB_LAST;
+ ts = 0;
+ } else {
+ pb = BLE_HCI_ISO_PB_CONTINUATION;
+ ts = 0;
+ }
+
+ om = os_msys_get_pkthdr(BLE_HCI_DATA_HDR_SZ + 4, 0);
+ if (!om) {
+ return BLE_HS_ENOMEM;
+ }
+
+ /* Connection_Handle, PB_Flag, TS_Flag */
+ put_le16(&om->om_data[0],
+ BLE_HCI_ISO_HANDLE(conn_handle, pb, ts));
+ /* Data_Total_Length = Data length + Packet_Sequence_Number placeholder */
+ put_le16(&om->om_data[2], packet_len + 4);
+ /* Packet_Sequence_Number placeholder */
+ put_le16(&om->om_data[3], 0);
+ /* ISO_SDU_Length */
+ put_le16(&om->om_data[4], packet_len);
+
+ rc = os_mbuf_append(om, data + offset, packet_len);
+ if (rc) {
+ return rc;
+ }
+
+ ble_transport_to_ll_iso(om);
+
+ offset += packet_len;
+ data_len -= packet_len;
+ }
+
+ return 0;
+}
+
+int
+ble_iso_tx(uint16_t conn_handle, const uint8_t *data, uint16_t data_len)
+{
+ struct ble_iso_big *big;
+ uint16_t max_pdu = 0;
+ int rc;
+ int i;
+
+ SLIST_FOREACH(big, &ble_iso_bigs, next) {
+ for (i = 0; i < big->num_bis; i++) {
+ if (big->conn_handles[i] == conn_handle) {
+ max_pdu = big->max_pdu;
+ break;
+ }
+ }
+ if (max_pdu > 0) {
+ break;
+ }
+ }
+
+ if (!max_pdu) {
+ return BLE_HS_ENOENT;
+ }
+
+ if (data_len < max_pdu) {
+ rc = ble_iso_tx_complete(conn_handle, data, data_len);
Review Comment:
what about return ble_iso_tx_complete ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342385962
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
Review Comment:
NULL to not include int broadcast
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1382876547
##########
nimble/host/services/auracast/syscfg.yml:
##########
@@ -0,0 +1,29 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.defs:
+ BLE_SVC_AURACAST_ADV_INSTANCE:
+ description: >
+ Defines which advertising instance is used for Auracast.
+ If set to -1 last advertising instance is used, and if MESH is enabled, one before that.
Review Comment:
For broadcast, we can choose. For Auracast user has freedom to define single instance (for now) to be used, OR give up this decision to package. This can simplify process of writting apps, especially simple ones
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1382984104
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
Review Comment:
Anything you need, it's a void pointer, app will cast it back to type it needs. Intention is, that for applications using dynamic memory allocation (like mempool) for BASE, BIG subgroups, BISes etc. this could be used as a pointer to to these things, and then app can free these resources. You can see that in `btshell_broadcast_destroy_fn`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1384493371
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** Broadcast Audio Source Endpoint */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising.
+ * Length must be in range of 4 to 32 chars.
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[in] destroy_cb Optional callback to be invoked on
+ * `ble_audio_broadcast_destroy` call.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement by enabling extended, periodic
+ * and BIGInfo advertisements for this instance.
+ *
+ * @param[in] adv_instance Advertising instance used by broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(uint8_t adv_instance,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ *
+ * @param[in] adv_instance Advertising instance used by broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(uint8_t adv_instance);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] adv_instance Advertising instance used by broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(uint8_t adv_instance);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function updates extended advertisements.
+ *
+ * @param[in] params Pointer to structure with new advertising data
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(const struct ble_broadcast_update_params
+ *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_id;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+};
+
+/**
+ * @brief Build BIG subgroup structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BASE.
+ * This function increases `num_subgroups` in BASE structure.
+ *
+ * @param[out] base Pointer to a `ble_audio_base` structure,
+ * that will be extended by the new subgroup.
+ * In case of error, filled out data may be
+ * erroneous.
+ * @param[out] subgroup Pointer to a `ble_broadcast_subgroup`
+ * structure, that will be filled out with
+ * supplied configuration. In case of error,
+ * filled out data may be erroneous.
+ * @param[in] params Pointer to a `ble_broadcast_subgroup_params`
+ * structure, containing information about new
+ * subgroup
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_build_sub(struct ble_audio_base *base,
+ struct ble_audio_big_subgroup *subgroup,
+ const struct ble_broadcast_subgroup_params
+ *params);
+
+/** BIS parameters */
+struct ble_broadcast_bis_params {
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+};
+
+/**
+ * @brief Build BIS structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_bis`
+ * structure. Created BIS extends BIS list in provided subgroup.
+ * This function increases `bis_cnt` in subgroup structure.
+ *
+ * @param[out] sub Pointer to a updated `ble_broadcast_subgroup`
Review Comment:
can we name it subgroup.
and also this is in/out param right?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1398821542
##########
nimble/host/services/auracast/src/ble_svc_auracast.c:
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "syscfg/syscfg.h"
+
+#include "host/ble_gap.h"
+#include "host/ble_hs.h"
+#include "host/ble_audio_broadcast.h"
+#include "services/auracast/ble_svc_auracast.h"
+
+static uint8_t
+adv_instance_find_free(void)
+{
+ uint8_t i;
+
+ for (i = 1; i <= MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES); i++) {
+ if (!ble_gap_adv_configured_instance(i)) {
+ return i;
+ }
+ }
+
+ return 0;
+}
+
+int
+ble_svc_auracast_create(const struct ble_svc_auracast_create_params *params,
+ uint8_t *adv_instance,
Review Comment:
auracast_instance (change name)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#issuecomment-1814330084
Added sample application for broadcast, fixed minor bug in ble_iso.c. Build check (all apps) is failing, seems to me app tries to be built with ll, but was designed for two core boards (nRF53, net core running ble-hci) I'm not sure how this should be resolved, maybe some config changes?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371315040
##########
nimble/host/include/host/ble_audio_common.h:
##########
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_COMMON_
+#define H_BLE_AUDIO_COMMON_
+
+#include "stdint.h"
+#include "os/queue.h"
+
+#define BLE_BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+#define BLE_BROADCAST_SAMPLING_RATE_8000_HZ BIT(0)
+#define BLE_BROADCAST_SAMPLING_RATE_11025_HZ BIT(1)
+#define BLE_BROADCAST_SAMPLING_RATE_16000_HZ BIT(2)
+#define BLE_BROADCAST_SAMPLING_RATE_22050_HZ BIT(3)
+#define BLE_BROADCAST_SAMPLING_RATE_24000_HZ BIT(4)
+#define BLE_BROADCAST_SAMPLING_RATE_32000_HZ BIT(5)
+#define BLE_BROADCAST_SAMPLING_RATE_44100_HZ BIT(6)
+#define BLE_BROADCAST_SAMPLING_RATE_48000_HZ BIT(7)
+#define BLE_BROADCAST_SAMPLING_RATE_88200_HZ BIT(8)
+#define BLE_BROADCAST_SAMPLING_RATE_96000_HZ BIT(9)
+#define BLE_BROADCAST_SAMPLING_RATE_176400_HZ BIT(10)
+#define BLE_BROADCAST_SAMPLING_RATE_192000_HZ BIT(11)
+#define BLE_BROADCAST_SAMPLING_RATE_384000_HZ BIT(12)
+
+#define BLE_BROADCAST_SUPPORTED_FRAME_DURATION_7_5_MS BIT(0)
+#define BLE_BROADCAST_SUPPORTED_FRAME_DURATION_10_MS BIT(1)
+
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_LEFT BIT(0)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_RIGHT BIT(1)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_CENTER BIT(2)
+#define BLE_BROADCAST_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 BIT(3)
+#define BLE_BROADCAST_AUDIO_LOCATION_BACK_LEFT BIT(4)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_LEFT_CENTER BIT(5)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_RIGHT_CENTER BIT(6)
+#define BLE_BROADCAST_AUDIO_LOCATION_BACK_CENTER BIT(7)
+#define BLE_BROADCAST_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 BIT(8)
+#define BLE_BROADCAST_AUDIO_LOCATION_SIDE_LEFT BIT(9)
+#define BLE_BROADCAST_AUDIO_LOCATION_SIDE_RIGHT BIT(10)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_LEFT BIT(11)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_RIGHT BIT(12)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_CENTER BIT(13)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_CENTER BIT(14)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_LEFT BIT(15)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_RIGHT BIT(16)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_SIDE_LEFT BIT(17)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_SIDE_RIGHT BIT(18)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_CENTER BIT(19)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_CENTER BIT(20)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_LEFT BIT(21)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT BIT(22)
+#define BLE_BROADCAST_AUDIO_LOCATION_LEFT_SURROUND BIT(23)
+#define BLE_BROADCAST_AUDIO_LOCATION_RIGHT_SURROUND BIT(24)
+
+struct ble_audio_codec_id {
+ /** Coding Fromat */
+ uint8_t format;
+
+ /** Company ID */
+ uint16_t company_id;
+
+ /** Vendor Specific Codec ID */
+ uint16_t vendor_specific;
+};
+
+struct ble_audio_bis {
+ /** Pointer to next BIS in subgroup */
+ STAILQ_ENTRY(ble_audio_bis) next;
+
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t codec_spec_config_len;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t *codec_spec_config;
+};
+
+struct ble_audio_subgroup {
+ /** Pointer to next subgroup in BIG */
+ STAILQ_ENTRY(ble_audio_subgroup) next;
+
+ /** Number of BISes in subgroup */
+ uint8_t bis_cnt;
+
+ /** Codec ID */
+ struct ble_audio_codec_id codec_id;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+
+ /** Link list of BISes */
+ STAILQ_HEAD(, ble_audio_bis) bises;
+};
+
+struct ble_audio_base {
+ /** Broadcast ID */
+ uint32_t broadcast_id;
Review Comment:
Yes, I think this can be removed from here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371324815
##########
nimble/host/include/host/ble_iso.h:
##########
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_ISO_
+#define H_BLE_ISO_
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_ISO)
+
+/** ISO event: BIG Create Completed */
+#define BLE_ISO_EVENT_BIG_CREATE_COMPLETE 0
+
+/** ISO event: BIG Terminate Completed */
+#define BLE_ISO_EVENT_BIG_TERMINATE_COMPLETE 0
+
+#include <inttypes.h>
+
+struct ble_iso_big_desc
+{
+ uint8_t big_handle;
+ uint32_t big_sync_delay;
+ uint32_t transport_latency_big;
+ uint8_t phy;
+ uint8_t nse;
+ uint8_t bn;
+ uint8_t pto;
+ uint8_t irc;
+ uint16_t max_pdu;
+ uint16_t iso_interval;
+ uint8_t num_bis;
+ uint16_t conn_handle[MYNEWT_VAL(BLE_MAX_BIS)];
+};
+
+/**
+ * Represents a ISO-related event. When such an event occurs, the host
+ * notifies the application by passing an instance of this structure to an
+ * application-specified callback.
+ */
+struct ble_iso_event {
+ /**
+ * Indicates the type of ISO event that occurred. This is one of the
+ * BLE_ISO_EVENT codes.
+ */
+ uint8_t type;
+
+ /**
+ * A discriminated union containing additional details concerning the ISO
+ * event. The 'type' field indicates which member of the union is valid.
+ */
+ union {
+ /**
+ * Represents a completion of BIG creation. Valid for the following
+ * event types:
+ * o BLE_ISO_EVENT_BIG_CREATE_COMPLETE
+ */
+ struct {
+ struct ble_iso_big_desc desc;
+ } big_created;
+
+ /**
+ * Represents a completion of BIG termination. Valid for the following
+ * event types:
+ * o BLE_ISO_EVENT_BIG_TERMINATE_COMPLETE
+ */
+ struct {
+ uint16_t big_handle;
+ uint8_t reason;
+ } big_terminated;
+ };
+};
+
+typedef int ble_iso_event_fn(struct ble_iso_event *event, void *arg);
+
+struct ble_iso_big_params {
+ uint32_t sdu_interval;
+ uint16_t max_sdu;
+ uint16_t max_transport_latency;
+ uint8_t rtn;
+ uint8_t phy;
+ uint8_t packing;
+ uint8_t framing;
+ uint8_t encryption;
+ const char *broadcast_code;
+};
+
+struct ble_iso_create_big_params {
+ uint16_t adv_handle;
+ uint8_t bis_cnt;
+ ble_iso_event_fn *cb;
+ void *cb_arg;
+};
+
+int ble_iso_create_big(const struct ble_iso_create_big_params *create_params,
+ const struct ble_iso_big_params *big_params);
+
+int ble_iso_terminate_big(uint8_t big_id);
+
+void
+ble_gap_rx_create_big_complete(const struct
Review Comment:
this should change prefix to ble_iso, and be moved to src/ble_iso_priv.h (must be created). It's for handling HCI event
##########
nimble/host/include/host/ble_iso.h:
##########
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_ISO_
+#define H_BLE_ISO_
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_ISO)
+
+/** ISO event: BIG Create Completed */
+#define BLE_ISO_EVENT_BIG_CREATE_COMPLETE 0
+
+/** ISO event: BIG Terminate Completed */
+#define BLE_ISO_EVENT_BIG_TERMINATE_COMPLETE 0
+
+#include <inttypes.h>
+
+struct ble_iso_big_desc
+{
+ uint8_t big_handle;
+ uint32_t big_sync_delay;
+ uint32_t transport_latency_big;
+ uint8_t phy;
+ uint8_t nse;
+ uint8_t bn;
+ uint8_t pto;
+ uint8_t irc;
+ uint16_t max_pdu;
+ uint16_t iso_interval;
+ uint8_t num_bis;
+ uint16_t conn_handle[MYNEWT_VAL(BLE_MAX_BIS)];
+};
+
+/**
+ * Represents a ISO-related event. When such an event occurs, the host
+ * notifies the application by passing an instance of this structure to an
+ * application-specified callback.
+ */
+struct ble_iso_event {
+ /**
+ * Indicates the type of ISO event that occurred. This is one of the
+ * BLE_ISO_EVENT codes.
+ */
+ uint8_t type;
+
+ /**
+ * A discriminated union containing additional details concerning the ISO
+ * event. The 'type' field indicates which member of the union is valid.
+ */
+ union {
+ /**
+ * Represents a completion of BIG creation. Valid for the following
+ * event types:
+ * o BLE_ISO_EVENT_BIG_CREATE_COMPLETE
+ */
+ struct {
+ struct ble_iso_big_desc desc;
+ } big_created;
+
+ /**
+ * Represents a completion of BIG termination. Valid for the following
+ * event types:
+ * o BLE_ISO_EVENT_BIG_TERMINATE_COMPLETE
+ */
+ struct {
+ uint16_t big_handle;
+ uint8_t reason;
+ } big_terminated;
+ };
+};
+
+typedef int ble_iso_event_fn(struct ble_iso_event *event, void *arg);
+
+struct ble_iso_big_params {
+ uint32_t sdu_interval;
+ uint16_t max_sdu;
+ uint16_t max_transport_latency;
+ uint8_t rtn;
+ uint8_t phy;
+ uint8_t packing;
+ uint8_t framing;
+ uint8_t encryption;
+ const char *broadcast_code;
+};
+
+struct ble_iso_create_big_params {
+ uint16_t adv_handle;
+ uint8_t bis_cnt;
+ ble_iso_event_fn *cb;
+ void *cb_arg;
+};
+
+int ble_iso_create_big(const struct ble_iso_create_big_params *create_params,
+ const struct ble_iso_big_params *big_params);
+
+int ble_iso_terminate_big(uint8_t big_id);
+
+void
+ble_gap_rx_create_big_complete(const struct
+ ble_hci_ev_le_subev_create_big_complete *ev);
+void
+ble_gap_rx_terminate_big_complete(const struct
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342403891
##########
nimble/host/services/leaudio/auracast/include/leaudio/auracast/auracast.h:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_audio_common.h"
+#include "host/ble_audio_broadcast.h"
+
+struct ble_svc_auracast_create_params {
+ struct ble_broadcast_big *big;
+ struct ble_iso_big_params *big_params;
+ const uint8_t *name;
+ uint8_t name_len;
+};
+
+/**
+ * @brief Create Auracast Endpoint and configure advertising instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for Auracast broadcast.
+ *
+ * @param params Pointer to a `ble_svc_auracast_create_params`
+ * structure that defines BIG and broadcast name.
+ * @param config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * Auracast advertisement.
+ * @param destroy_cb Optional callback to be called when Auracast
+ * advertisement is destroyed.
+ * @param gap_cb GAP event callback to be associated with
+ * Auracast advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_svc_auracast_create(struct ble_svc_auracast_create_params *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
Review Comment:
void * arg
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375798515
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** Broadcast Audio Source Endpoint */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement by enabling extended, periodic
+ * and BIGInfo advertisements for this instance.
+ *
+ * @param[in] adv_instance Advertising instance used by broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(uint8_t adv_instance,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ *
+ * @param[in] adv_instance Advertising instance used by broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(uint8_t adv_instance);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] adv_instance Advertising instance used by broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(uint8_t adv_instance);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function updates extended advertisements.
+ *
+ * @param[in] params Pointer to structure with new advertising data
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(const struct ble_broadcast_update_params
+ *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_id;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+};
+
+/**
+ * @brief Build BIG subgroup structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BASE.
+ * This function increases `num_subgroups` in BASE structure.
+ *
+ * @param[out] base Pointer to a `ble_audio_base` structure,
+ * that will be extended by the new subgroup.
+ * In case of error, filled out data may be
+ * erroneous.
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
Review Comment:
nit: maybe instead of `sub` use a `subgroup` here and in function name?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375796707
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
Review Comment:
yes, I'll change description to be more precise
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375768771
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
Review Comment:
@KKopyscinski the limitation is coming from here:
https://www.bluetooth.com/specifications/pbp-1-0/
5.1. Broadcast Name Data AD Type
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] rymanluk commented on a diff in pull request #1619: [dnm] nimble/host: auracast API proposal
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1335493540
##########
nimble/host/services/leaudio/broadcaster/include/leaudio/broadcaster/broadcaster.h:
##########
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "leaudio/leaudio_common.h"
+
+#define BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+struct broadcast_big *
+broadcast_alloc_big(void);
+
+int
+broadcast_free_big(struct broadcast_big *big);
+
+struct broadcast_subgroup *
+broadcast_alloc_big_sub(struct broadcast_big *big);
+
+int
+broadcast_free_big_sub(struct broadcast_big *big,
+ struct broadcast_subgroup *big_sub);
+
+struct broadcast_bis *
+broadcast_alloc_bis(struct broadcast_subgroup *sub);
+
+int
+broadcast_free_bis(struct broadcast_subgroup *big_sub,
+ struct broadcast_bis *bis);
+
+int
+broadcast_start_advertising(struct broadcast_big *big, uint8_t instance,
Review Comment:
broadcast_create()
broadcast_start()
broadcast_stop()
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] rymanluk commented on a diff in pull request #1619: [dnm] nimble/host: auracast API proposal
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1335498137
##########
nimble/host/services/leaudio/include/leaudio/leaudio_common.h:
##########
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef LE_AUDIO_COMMON_H_
+#define LE_AUDIO_COMMON_H_
+
+#include "stdint.h"
+
+/** TODO: these lengths may need to be changed to fit more data */
+#define METADATA_MAX_LEN (32)
+#define CODEC_SPEC_MAX_LEN (32)
+
+struct codec_id {
+ uint8_t format;
+ uint16_t company_id;
+ uint16_t vendor_specific;
+}__attribute__((packed));
Review Comment:
remote packed from public header
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] rymanluk commented on a diff in pull request #1619: [dnm] nimble/host: auracast API proposal
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1335514604
##########
nimble/host/services/leaudio/include/leaudio/leaudio_common.h:
##########
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef LE_AUDIO_COMMON_H_
+#define LE_AUDIO_COMMON_H_
+
+#include "stdint.h"
+
+/** TODO: these lengths may need to be changed to fit more data */
+#define METADATA_MAX_LEN (32)
+#define CODEC_SPEC_MAX_LEN (32)
+
+struct codec_id {
+ uint8_t format;
+ uint16_t company_id;
+ uint16_t vendor_specific;
+}__attribute__((packed));
+
+struct broadcast_bis {
+ STAILQ_ENTRY(broadcast_bis) next;
+ uint8_t idx;
+ uint8_t codec_spec_config_len;
+ uint8_t codec_spec_config[CODEC_SPEC_MAX_LEN];
Review Comment:
change to pointers maintained by app
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] rymanluk commented on a diff in pull request #1619: [dnm] nimble/host: auracast API proposal
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1335514304
##########
nimble/host/services/leaudio/include/leaudio/leaudio_common.h:
##########
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef LE_AUDIO_COMMON_H_
+#define LE_AUDIO_COMMON_H_
+
+#include "stdint.h"
+
+/** TODO: these lengths may need to be changed to fit more data */
+#define METADATA_MAX_LEN (32)
+#define CODEC_SPEC_MAX_LEN (32)
+
+struct codec_id {
+ uint8_t format;
+ uint16_t company_id;
+ uint16_t vendor_specific;
+}__attribute__((packed));
+
+struct broadcast_bis {
Review Comment:
add helper functions to create / build the BIG structure.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "kolodgrz (via GitHub)" <gi...@apache.org>.
kolodgrz commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1381533180
##########
porting/examples/linux/include/syscfg/syscfg.h:
##########
@@ -771,6 +783,14 @@
#define MYNEWT_VAL_BLE_L2CAP_SIG_MAX_PROCS (1)
#endif
+#ifndef MYNEWT_VAL_BLE_MAX_BIG
+#define MYNEWT_VAL_BLE_MAX_BIG (MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES)
+#endif
+
+#ifndef MYNEWT_VAL_BLE_MAX_BIS
+#define MYNEWT_VAL_BLE_MAX_BIS (4)
Review Comment:
it's per BIG ? or total ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375863742
##########
nimble/host/src/ble_audio_common.c:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "host/ble_audio_common.h"
+#include <string.h>
+
+int ble_audio_build_codec_config(const struct ble_audio_codec_config_params
Review Comment:
change into macro
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1383214799
##########
nimble/host/include/host/ble_audio_common.h:
##########
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_COMMON_
+#define H_BLE_AUDIO_COMMON_
+
+#include "stdint.h"
+#include "os/queue.h"
+
+#define BLE_BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+#define BLE_AUDIO_SAMPLING_RATE_8000_HZ 0x00
+#define BLE_AUDIO_SAMPLING_RATE_11025_HZ 0x01
+#define BLE_AUDIO_SAMPLING_RATE_16000_HZ 0x02
+#define BLE_AUDIO_SAMPLING_RATE_22050_HZ 0x03
+#define BLE_AUDIO_SAMPLING_RATE_24000_HZ 0x04
+#define BLE_AUDIO_SAMPLING_RATE_32000_HZ 0x05
+#define BLE_AUDIO_SAMPLING_RATE_44100_HZ 0x06
+#define BLE_AUDIO_SAMPLING_RATE_48000_HZ 0x07
+#define BLE_AUDIO_SAMPLING_RATE_88200_HZ 0x08
+#define BLE_AUDIO_SAMPLING_RATE_96000_HZ 0x09
+#define BLE_AUDIO_SAMPLING_RATE_176400_HZ 0x0A
+#define BLE_AUDIO_SAMPLING_RATE_192000_HZ 0x0B
+#define BLE_AUDIO_SAMPLING_RATE_384000_HZ 0x0C
+
+#define BLE_AUDIO_SELECTED_FRAME_DURATION_7_5_MS 0x00
+#define BLE_AUDIO_SELECTED_FRAME_DURATION_10_MS 0x01
+
+#define BLE_AUDIO_LOCATION_FRONT_LEFT BIT(0)
+#define BLE_AUDIO_LOCATION_FRONT_RIGHT BIT(1)
+#define BLE_AUDIO_LOCATION_FRONT_CENTER BIT(2)
+#define BLE_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 BIT(3)
+#define BLE_AUDIO_LOCATION_BACK_LEFT BIT(4)
+#define BLE_AUDIO_LOCATION_FRONT_LEFT_CENTER BIT(5)
+#define BLE_AUDIO_LOCATION_FRONT_RIGHT_CENTER BIT(6)
+#define BLE_AUDIO_LOCATION_BACK_CENTER BIT(7)
+#define BLE_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 BIT(8)
+#define BLE_AUDIO_LOCATION_SIDE_LEFT BIT(9)
+#define BLE_AUDIO_LOCATION_SIDE_RIGHT BIT(10)
+#define BLE_AUDIO_LOCATION_TOP_FRONT_LEFT BIT(11)
+#define BLE_AUDIO_LOCATION_TOP_FRONT_RIGHT BIT(12)
+#define BLE_AUDIO_LOCATION_TOP_FRONT_CENTER BIT(13)
+#define BLE_AUDIO_LOCATION_TOP_CENTER BIT(14)
+#define BLE_AUDIO_LOCATION_TOP_BACK_LEFT BIT(15)
+#define BLE_AUDIO_LOCATION_TOP_BACK_RIGHT BIT(16)
+#define BLE_AUDIO_LOCATION_TOP_SIDE_LEFT BIT(17)
+#define BLE_AUDIO_LOCATION_TOP_SIDE_RIGHT BIT(18)
+#define BLE_AUDIO_LOCATION_TOP_BACK_CENTER BIT(19)
+#define BLE_AUDIO_LOCATION_BOTTOM_FRONT_CENTER BIT(20)
+#define BLE_AUDIO_LOCATION_BOTTOM_FRONT_LEFT BIT(21)
+#define BLE_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT BIT(22)
+#define BLE_AUDIO_LOCATION_LEFT_SURROUND BIT(23)
+#define BLE_AUDIO_LOCATION_RIGHT_SURROUND BIT(24)
+
+#define BLE_AUDIO_CODEC_SAMPLING_FREQ_TYPE 0x01
+#define BLE_AUDIO_CODEC_FRAME_DURATION_TYPE 0x02
+#define BLE_AUDIO_CODEC_AUDIO_CHANNEL_ALLOCATION_TYPE 0x03
+#define BLE_AUDIO_CODEC_OCTETS_PER_CODEC_FRAME_TYPE 0x04
+#define BLE_AUDIO_CODEC_FRAME_BLOCKS_PER_SDU_TYPE 0x05
+
+/**
+ * @brief Helper macro used to build LTV array of Codec_Specific_Configuration.
+ *
+ * @param _sampling_freq Sampling_Frequency - single octet value
+ * @param _frame_duration Frame_Duration - single octet value
+ * @param _audio_channel_alloc Audio_Channel_Allocation -
+ * four octet value
+ * @param _octets_per_codec_frame Octets_Per_Codec_Frame -
+ * two octet value
+ * @param _codec_frame_blocks_per_sdu Codec_Frame_Blocks_Per_SDU -
+ * single octet value
+ *
+ * @return Pointer to a `ble_uuid16_t` structure.
+ */
+#define BLE_AUDIO_BUILD_CODEC_CONFIG(_sampling_freq, \
Review Comment:
I noticed that this does not behave as expected: I'll rework this macro to fit spec better
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342365559
##########
nimble/host/include/host/ble_iso.h:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_ISO_
+#define H_BLE_ISO_
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_ISO)
+
+#include <inttypes.h>
+
+struct ble_iso_big_params {
+ uint8_t sdu_interval[3];
+ uint16_t max_sdu;
+ uint16_t max_transport_latency;
+ uint8_t rtn;
+ uint8_t phy;
+ uint8_t packing;
+ uint8_t framing;
+ uint8_t encryption;
+ uint8_t broadcast_code[16];
+};
+
+struct ble_iso_create_big_params {
+ uint16_t adv_handle;
+ uint8_t bis_cnt;
+};
+
+int ble_iso_create_big(struct ble_iso_create_big_params *create_params,
+ struct ble_iso_big_params *big_params,
+ uint8_t *big_id);
Review Comment:
const pointer for params, big_id -> big_id_out
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342393231
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
+
+ /** Broadcast name length */
+ uint8_t name_len;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+};
+
+struct ble_broadcast_update_params {
+ /** New BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Updated parameters of Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Updated parameters of Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** New Broadcast name */
+ const uint8_t *name;
+
+ /** New Broadcast name length */
+ uint8_t name_len;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_big *big,
+ void *arg);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BIG configuration */
+ struct ble_audio_big *big;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+
+ /** Broadcast ID */
+ uint8_t big_id;
Review Comment:
= adv instance, to remove
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342370944
##########
nimble/host/include/host/ble_audio_common.h:
##########
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_COMMON_
+#define H_BLE_AUDIO_COMMON_
+
+#include "stdint.h"
+#include "os/queue.h"
+
+#define BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+struct ble_audio_codec_id {
+ /** Coding Fromat */
+ uint8_t format;
+
+ /** Company ID */
+ uint16_t company_id;
+
+ /** Vendor Specific Codec ID */
+ uint16_t vendor_specific;
+};
+
+struct ble_audio_bis {
+ /** Pointer to next BIS in subgroup */
+ STAILQ_ENTRY(ble_audio_bis) next;
+
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t codec_spec_config_len;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t *codec_spec_config;
+};
+
+typedef int ble_audio_broadcast_sub_free_fn(void *cb_args);
Review Comment:
leftover
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342369805
##########
nimble/host/include/host/ble_iso.h:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_ISO_
+#define H_BLE_ISO_
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_ISO)
+
+#include <inttypes.h>
+
+struct ble_iso_big_params {
+ uint8_t sdu_interval[3];
+ uint16_t max_sdu;
+ uint16_t max_transport_latency;
+ uint8_t rtn;
+ uint8_t phy;
+ uint8_t packing;
+ uint8_t framing;
+ uint8_t encryption;
+ uint8_t broadcast_code[16];
Review Comment:
const pointer char
app must provide 16 bytes, 0 filled
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371212124
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
Review Comment:
I'm not sure either but this is how we discussed this offline. AFAIK it's the similar logic as with extended and periodic: periodic is auxilary of extended, and similary BIGInfo is auxilary of periodic. But when extended is stopped periodic is still being advertised. So when we want to stop all advertisements, we need to stop both extended, periodic and terminate BIG. Without it, extended and periodic would stop but BIGInfo would still advertise. Am I correct here @andrzej-kaczmarek ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371215551
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
Review Comment:
I'm planning to add sample that acts as usb soundcard for pc, where all of this API will be used. But that requires some additional code, outside of scope of this PR, like LC3. For now I added shell commands to test this code. I think it would be nice to add unittests too, when this API is semi-established I'll add them I think
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371246749
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
Review Comment:
Yes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371252854
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended advertisements. This function
Review Comment:
Maybe I'm mistaken, but only EXT Adv can have additional data here? PA has basically BIG structure, with subgroups and BISes, and BIGInfo is something totally else. EXT has Broadcast Name and `service_data` of BLE_BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID, and additional data that can be updated here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371222069
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
Review Comment:
You're right, I'll remove it from here, it's a leftover
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371326238
##########
nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_audio_common.h"
+#include "host/ble_audio_broadcast.h"
+
+struct ble_svc_auracast_create_params {
+ struct ble_audio_base *base;
+ struct ble_iso_big_params *big_params;
+ const char *name;
+ uint8_t adv_instance;
+};
+
+/**
+ * @brief Create Auracast Endpoint and configure advertising instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for Auracast broadcast.
+ *
+ * @param[in] params Pointer to a `ble_svc_auracast_create_params`
+ * structure that defines BIG and broadcast name.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * Auracast advertisement.
+ * @param[in] destroy_cb Optional callback to be called when Auracast
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with
+ * Auracast advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_svc_auracast_create(const struct
+ ble_svc_auracast_create_params *params,
+ struct ble_broadcast_base_config *config_out,
Review Comment:
I agree and my response is also the same :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1375834014
##########
nimble/syscfg.yml:
##########
@@ -81,7 +81,7 @@ syscfg.defs:
This allows to configure maximum size of advertising data and
scan response data used in LE Advertising Extensions.
Valid range 31-1650.
- value: 31
+ value: 251
Review Comment:
if we want to change this, it should be separate patch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "kolodgrz (via GitHub)" <gi...@apache.org>.
kolodgrz commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1368775358
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
Review Comment:
It could be worth to include here information about length ? `minimum of 4 and a
maximum of 32 human-readable characters.` Or it would be somehow handled internally ?
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
Review Comment:
number ?
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
Review Comment:
I think it would be self descriptive: `Broadcast Audio Source Endpoint`
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
Review Comment:
This struct confuses me a bit. It contains almost the same parameters as `ble_broadcast_create_params` with destroy_cb and *args. BASE needs to be delivered for PA, so I understand that it'll be the same struct as for create broadcast.
Maybe this could be included in ble_broadcast_create_params?
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
Review Comment:
This confuses me - it stops only PA ? but method indicates that "broadcast" should be stopped
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended advertisements. This function
Review Comment:
extended advertisement data ?
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended advertisements. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
+ * `ble_audio_broadcast_destroy` and recreate with `ble_audio_broadcast_create`
+ *
+ * @param[in] params Pointer to structure with new advertising data
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(const struct ble_broadcast_update_params
+ *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_info;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+};
+
+/**
+ * @brief Build BIG subgroup structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BASE.
+ * This function increases `num_subgroups` in BASE structure.
+ *
+ * @param[out] base Pointer to a `ble_audio_base` structure,
+ * that will be extended by the new subgroup
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
+ * structure, that will be filled out with
+ * supplied configuration
+ * @param[in] params Pointer to a `ble_broadcast_subgroup_params`
+ * structure, containing information about new
+ * subgroup
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_build_sub(struct ble_audio_base *base,
+ struct ble_audio_subgroup *sub,
Review Comment:
maybe ble_audio_big_subgroup ?
##########
nimble/host/include/host/ble_audio_common.h:
##########
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_COMMON_
+#define H_BLE_AUDIO_COMMON_
+
+#include "stdint.h"
+#include "os/queue.h"
+
+#define BLE_BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+#define BLE_BROADCAST_SAMPLING_RATE_8000_HZ BIT(0)
+#define BLE_BROADCAST_SAMPLING_RATE_11025_HZ BIT(1)
+#define BLE_BROADCAST_SAMPLING_RATE_16000_HZ BIT(2)
+#define BLE_BROADCAST_SAMPLING_RATE_22050_HZ BIT(3)
+#define BLE_BROADCAST_SAMPLING_RATE_24000_HZ BIT(4)
+#define BLE_BROADCAST_SAMPLING_RATE_32000_HZ BIT(5)
+#define BLE_BROADCAST_SAMPLING_RATE_44100_HZ BIT(6)
+#define BLE_BROADCAST_SAMPLING_RATE_48000_HZ BIT(7)
+#define BLE_BROADCAST_SAMPLING_RATE_88200_HZ BIT(8)
+#define BLE_BROADCAST_SAMPLING_RATE_96000_HZ BIT(9)
+#define BLE_BROADCAST_SAMPLING_RATE_176400_HZ BIT(10)
+#define BLE_BROADCAST_SAMPLING_RATE_192000_HZ BIT(11)
+#define BLE_BROADCAST_SAMPLING_RATE_384000_HZ BIT(12)
+
+#define BLE_BROADCAST_SUPPORTED_FRAME_DURATION_7_5_MS BIT(0)
+#define BLE_BROADCAST_SUPPORTED_FRAME_DURATION_10_MS BIT(1)
+
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_LEFT BIT(0)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_RIGHT BIT(1)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_CENTER BIT(2)
+#define BLE_BROADCAST_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 BIT(3)
+#define BLE_BROADCAST_AUDIO_LOCATION_BACK_LEFT BIT(4)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_LEFT_CENTER BIT(5)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_RIGHT_CENTER BIT(6)
+#define BLE_BROADCAST_AUDIO_LOCATION_BACK_CENTER BIT(7)
+#define BLE_BROADCAST_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 BIT(8)
+#define BLE_BROADCAST_AUDIO_LOCATION_SIDE_LEFT BIT(9)
+#define BLE_BROADCAST_AUDIO_LOCATION_SIDE_RIGHT BIT(10)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_LEFT BIT(11)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_RIGHT BIT(12)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_CENTER BIT(13)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_CENTER BIT(14)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_LEFT BIT(15)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_RIGHT BIT(16)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_SIDE_LEFT BIT(17)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_SIDE_RIGHT BIT(18)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_CENTER BIT(19)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_CENTER BIT(20)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_LEFT BIT(21)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT BIT(22)
+#define BLE_BROADCAST_AUDIO_LOCATION_LEFT_SURROUND BIT(23)
+#define BLE_BROADCAST_AUDIO_LOCATION_RIGHT_SURROUND BIT(24)
+
+struct ble_audio_codec_id {
+ /** Coding Fromat */
+ uint8_t format;
+
+ /** Company ID */
+ uint16_t company_id;
+
+ /** Vendor Specific Codec ID */
+ uint16_t vendor_specific;
+};
+
+struct ble_audio_bis {
+ /** Pointer to next BIS in subgroup */
+ STAILQ_ENTRY(ble_audio_bis) next;
+
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t codec_spec_config_len;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t *codec_spec_config;
+};
+
+struct ble_audio_subgroup {
+ /** Pointer to next subgroup in BIG */
+ STAILQ_ENTRY(ble_audio_subgroup) next;
+
+ /** Number of BISes in subgroup */
+ uint8_t bis_cnt;
+
+ /** Codec ID */
+ struct ble_audio_codec_id codec_id;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+
+ /** Link list of BISes */
+ STAILQ_HEAD(, ble_audio_bis) bises;
+};
+
+struct ble_audio_base {
+ /** Broadcast ID */
+ uint32_t broadcast_id;
Review Comment:
this is a part of broadcast announcement, why we need that here in BASE ?
##########
nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_audio_common.h"
+#include "host/ble_audio_broadcast.h"
+
+struct ble_svc_auracast_create_params {
+ struct ble_audio_base *base;
+ struct ble_iso_big_params *big_params;
+ const char *name;
+ uint8_t adv_instance;
+};
+
+/**
+ * @brief Create Auracast Endpoint and configure advertising instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for Auracast broadcast.
+ *
+ * @param[in] params Pointer to a `ble_svc_auracast_create_params`
+ * structure that defines BIG and broadcast name.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * Auracast advertisement.
+ * @param[in] destroy_cb Optional callback to be called when Auracast
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with
+ * Auracast advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_svc_auracast_create(const struct
+ ble_svc_auracast_create_params *params,
+ struct ble_broadcast_base_config *config_out,
Review Comment:
This would be probably the very similar comment to previous - out param is base_config and input *params contains also ble_audio_base, what would be the benefit from "re-packing" of struct ?
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
Review Comment:
This is a generic callback for GAP, do we plan to "filter" only some selected event https://github.com/apache/mynewt-nimble/blob/fb3ccfdcdd2dbcc9e01aecb7ecefc25c47dc8a86/nimble/host/include/host/ble_gap.h#L168
##########
nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_audio_common.h"
+#include "host/ble_audio_broadcast.h"
+
+struct ble_svc_auracast_create_params {
+ struct ble_audio_base *base;
+ struct ble_iso_big_params *big_params;
+ const char *name;
+ uint8_t adv_instance;
+};
+
+/**
+ * @brief Create Auracast Endpoint and configure advertising instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for Auracast broadcast.
+ *
+ * @param[in] params Pointer to a `ble_svc_auracast_create_params`
+ * structure that defines BIG and broadcast name.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * Auracast advertisement.
+ * @param[in] destroy_cb Optional callback to be called when Auracast
+ * advertisement is destroyed.
Review Comment:
broadcast is still valid even without advertisements BAP 1.0 `Table 6.2: Broadcast Audio Stream states` , `Continuous transmission of the EA is not required.` and `Continuous transmission of the PA is not required.`
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
Review Comment:
Do we have a sample scenario how this can be used ?
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
Review Comment:
I saw that this is a common description for this: `@return 0 on success, error code on failure.`
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
Review Comment:
From this description can be deduced that BIG describes BASE.
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
Review Comment:
wasn't BASE created in ble_audio_broadcast_create ?
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
Review Comment:
Intention for that would be to use `HCI_LE_Remove_Advertising_Set` ?
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
Review Comment:
I'm not sure that broadcast needs to be considered as destroyed after PA stop. What is the motivation ?
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended advertisements. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
Review Comment:
it's -> its
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended advertisements. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
+ * `ble_audio_broadcast_destroy` and recreate with `ble_audio_broadcast_create`
+ *
+ * @param[in] params Pointer to structure with new advertising data
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(const struct ble_broadcast_update_params
+ *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_info;
Review Comment:
codec_info -> codec_id ?
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended advertisements. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
Review Comment:
I'm not sure if description on API method should contain any "tips" - how to modify BASE. In my opinion description should point to what this method does. It updates broadcast advertisement.
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended advertisements. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
+ * `ble_audio_broadcast_destroy` and recreate with `ble_audio_broadcast_create`
+ *
+ * @param[in] params Pointer to structure with new advertising data
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(const struct ble_broadcast_update_params
+ *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_info;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+};
+
+/**
+ * @brief Build BIG subgroup structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BASE.
+ * This function increases `num_subgroups` in BASE structure.
+ *
+ * @param[out] base Pointer to a `ble_audio_base` structure,
+ * that will be extended by the new subgroup
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
+ * structure, that will be filled out with
+ * supplied configuration
+ * @param[in] params Pointer to a `ble_broadcast_subgroup_params`
+ * structure, containing information about new
+ * subgroup
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_build_sub(struct ble_audio_base *base,
+ struct ble_audio_subgroup *sub,
+ const struct ble_broadcast_subgroup_params
+ *params);
+
+/** BIS parameters */
+struct ble_broadcast_bis_params {
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+};
+
+/**
+ * @brief Build BIS structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_bis`
+ * structure. Created BIS extends BIS list in provided subgroup.
+ * This function increases `bis_cnt` in subgroup structure.
+ *
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
Review Comment:
maybe pointer to "UPDATED" ?
##########
nimble/host/include/host/ble_audio_common.h:
##########
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_COMMON_
+#define H_BLE_AUDIO_COMMON_
+
+#include "stdint.h"
+#include "os/queue.h"
+
+#define BLE_BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+#define BLE_BROADCAST_SAMPLING_RATE_8000_HZ BIT(0)
+#define BLE_BROADCAST_SAMPLING_RATE_11025_HZ BIT(1)
+#define BLE_BROADCAST_SAMPLING_RATE_16000_HZ BIT(2)
+#define BLE_BROADCAST_SAMPLING_RATE_22050_HZ BIT(3)
+#define BLE_BROADCAST_SAMPLING_RATE_24000_HZ BIT(4)
+#define BLE_BROADCAST_SAMPLING_RATE_32000_HZ BIT(5)
+#define BLE_BROADCAST_SAMPLING_RATE_44100_HZ BIT(6)
+#define BLE_BROADCAST_SAMPLING_RATE_48000_HZ BIT(7)
+#define BLE_BROADCAST_SAMPLING_RATE_88200_HZ BIT(8)
+#define BLE_BROADCAST_SAMPLING_RATE_96000_HZ BIT(9)
+#define BLE_BROADCAST_SAMPLING_RATE_176400_HZ BIT(10)
+#define BLE_BROADCAST_SAMPLING_RATE_192000_HZ BIT(11)
+#define BLE_BROADCAST_SAMPLING_RATE_384000_HZ BIT(12)
+
+#define BLE_BROADCAST_SUPPORTED_FRAME_DURATION_7_5_MS BIT(0)
+#define BLE_BROADCAST_SUPPORTED_FRAME_DURATION_10_MS BIT(1)
+
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_LEFT BIT(0)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_RIGHT BIT(1)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_CENTER BIT(2)
+#define BLE_BROADCAST_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 BIT(3)
+#define BLE_BROADCAST_AUDIO_LOCATION_BACK_LEFT BIT(4)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_LEFT_CENTER BIT(5)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_RIGHT_CENTER BIT(6)
+#define BLE_BROADCAST_AUDIO_LOCATION_BACK_CENTER BIT(7)
+#define BLE_BROADCAST_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 BIT(8)
+#define BLE_BROADCAST_AUDIO_LOCATION_SIDE_LEFT BIT(9)
+#define BLE_BROADCAST_AUDIO_LOCATION_SIDE_RIGHT BIT(10)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_LEFT BIT(11)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_RIGHT BIT(12)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_CENTER BIT(13)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_CENTER BIT(14)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_LEFT BIT(15)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_RIGHT BIT(16)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_SIDE_LEFT BIT(17)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_SIDE_RIGHT BIT(18)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_CENTER BIT(19)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_CENTER BIT(20)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_LEFT BIT(21)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT BIT(22)
+#define BLE_BROADCAST_AUDIO_LOCATION_LEFT_SURROUND BIT(23)
+#define BLE_BROADCAST_AUDIO_LOCATION_RIGHT_SURROUND BIT(24)
+
+struct ble_audio_codec_id {
+ /** Coding Fromat */
+ uint8_t format;
+
+ /** Company ID */
+ uint16_t company_id;
+
+ /** Vendor Specific Codec ID */
+ uint16_t vendor_specific;
+};
+
+struct ble_audio_bis {
+ /** Pointer to next BIS in subgroup */
+ STAILQ_ENTRY(ble_audio_bis) next;
+
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t codec_spec_config_len;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t *codec_spec_config;
+};
+
+struct ble_audio_subgroup {
Review Comment:
big_subgroup ?
##########
nimble/host/include/host/ble_audio_common.h:
##########
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_COMMON_
+#define H_BLE_AUDIO_COMMON_
+
+#include "stdint.h"
+#include "os/queue.h"
+
+#define BLE_BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+#define BLE_BROADCAST_SAMPLING_RATE_8000_HZ BIT(0)
+#define BLE_BROADCAST_SAMPLING_RATE_11025_HZ BIT(1)
+#define BLE_BROADCAST_SAMPLING_RATE_16000_HZ BIT(2)
+#define BLE_BROADCAST_SAMPLING_RATE_22050_HZ BIT(3)
+#define BLE_BROADCAST_SAMPLING_RATE_24000_HZ BIT(4)
+#define BLE_BROADCAST_SAMPLING_RATE_32000_HZ BIT(5)
+#define BLE_BROADCAST_SAMPLING_RATE_44100_HZ BIT(6)
+#define BLE_BROADCAST_SAMPLING_RATE_48000_HZ BIT(7)
+#define BLE_BROADCAST_SAMPLING_RATE_88200_HZ BIT(8)
+#define BLE_BROADCAST_SAMPLING_RATE_96000_HZ BIT(9)
+#define BLE_BROADCAST_SAMPLING_RATE_176400_HZ BIT(10)
+#define BLE_BROADCAST_SAMPLING_RATE_192000_HZ BIT(11)
+#define BLE_BROADCAST_SAMPLING_RATE_384000_HZ BIT(12)
+
+#define BLE_BROADCAST_SUPPORTED_FRAME_DURATION_7_5_MS BIT(0)
+#define BLE_BROADCAST_SUPPORTED_FRAME_DURATION_10_MS BIT(1)
+
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_LEFT BIT(0)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_RIGHT BIT(1)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_CENTER BIT(2)
+#define BLE_BROADCAST_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 BIT(3)
+#define BLE_BROADCAST_AUDIO_LOCATION_BACK_LEFT BIT(4)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_LEFT_CENTER BIT(5)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_RIGHT_CENTER BIT(6)
+#define BLE_BROADCAST_AUDIO_LOCATION_BACK_CENTER BIT(7)
+#define BLE_BROADCAST_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 BIT(8)
+#define BLE_BROADCAST_AUDIO_LOCATION_SIDE_LEFT BIT(9)
+#define BLE_BROADCAST_AUDIO_LOCATION_SIDE_RIGHT BIT(10)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_LEFT BIT(11)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_RIGHT BIT(12)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_CENTER BIT(13)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_CENTER BIT(14)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_LEFT BIT(15)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_RIGHT BIT(16)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_SIDE_LEFT BIT(17)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_SIDE_RIGHT BIT(18)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_CENTER BIT(19)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_CENTER BIT(20)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_LEFT BIT(21)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT BIT(22)
+#define BLE_BROADCAST_AUDIO_LOCATION_LEFT_SURROUND BIT(23)
+#define BLE_BROADCAST_AUDIO_LOCATION_RIGHT_SURROUND BIT(24)
+
+struct ble_audio_codec_id {
+ /** Coding Fromat */
+ uint8_t format;
+
+ /** Company ID */
+ uint16_t company_id;
+
+ /** Vendor Specific Codec ID */
+ uint16_t vendor_specific;
+};
+
+struct ble_audio_bis {
Review Comment:
I'm not familiar with such entry elements of STAILQ but I think if this struct shouldn't contain "entry" in name ? e.g. ble_audio_bis_entry ?
##########
nimble/host/include/host/ble_audio_common.h:
##########
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_COMMON_
+#define H_BLE_AUDIO_COMMON_
+
+#include "stdint.h"
+#include "os/queue.h"
+
+#define BLE_BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+#define BLE_BROADCAST_SAMPLING_RATE_8000_HZ BIT(0)
+#define BLE_BROADCAST_SAMPLING_RATE_11025_HZ BIT(1)
+#define BLE_BROADCAST_SAMPLING_RATE_16000_HZ BIT(2)
+#define BLE_BROADCAST_SAMPLING_RATE_22050_HZ BIT(3)
+#define BLE_BROADCAST_SAMPLING_RATE_24000_HZ BIT(4)
+#define BLE_BROADCAST_SAMPLING_RATE_32000_HZ BIT(5)
+#define BLE_BROADCAST_SAMPLING_RATE_44100_HZ BIT(6)
+#define BLE_BROADCAST_SAMPLING_RATE_48000_HZ BIT(7)
+#define BLE_BROADCAST_SAMPLING_RATE_88200_HZ BIT(8)
+#define BLE_BROADCAST_SAMPLING_RATE_96000_HZ BIT(9)
+#define BLE_BROADCAST_SAMPLING_RATE_176400_HZ BIT(10)
+#define BLE_BROADCAST_SAMPLING_RATE_192000_HZ BIT(11)
+#define BLE_BROADCAST_SAMPLING_RATE_384000_HZ BIT(12)
+
+#define BLE_BROADCAST_SUPPORTED_FRAME_DURATION_7_5_MS BIT(0)
+#define BLE_BROADCAST_SUPPORTED_FRAME_DURATION_10_MS BIT(1)
+
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_LEFT BIT(0)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_RIGHT BIT(1)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_CENTER BIT(2)
+#define BLE_BROADCAST_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 BIT(3)
+#define BLE_BROADCAST_AUDIO_LOCATION_BACK_LEFT BIT(4)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_LEFT_CENTER BIT(5)
+#define BLE_BROADCAST_AUDIO_LOCATION_FRONT_RIGHT_CENTER BIT(6)
+#define BLE_BROADCAST_AUDIO_LOCATION_BACK_CENTER BIT(7)
+#define BLE_BROADCAST_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 BIT(8)
+#define BLE_BROADCAST_AUDIO_LOCATION_SIDE_LEFT BIT(9)
+#define BLE_BROADCAST_AUDIO_LOCATION_SIDE_RIGHT BIT(10)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_LEFT BIT(11)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_RIGHT BIT(12)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_FRONT_CENTER BIT(13)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_CENTER BIT(14)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_LEFT BIT(15)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_RIGHT BIT(16)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_SIDE_LEFT BIT(17)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_SIDE_RIGHT BIT(18)
+#define BLE_BROADCAST_AUDIO_LOCATION_TOP_BACK_CENTER BIT(19)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_CENTER BIT(20)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_LEFT BIT(21)
+#define BLE_BROADCAST_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT BIT(22)
+#define BLE_BROADCAST_AUDIO_LOCATION_LEFT_SURROUND BIT(23)
+#define BLE_BROADCAST_AUDIO_LOCATION_RIGHT_SURROUND BIT(24)
+
+struct ble_audio_codec_id {
+ /** Coding Fromat */
+ uint8_t format;
+
+ /** Company ID */
+ uint16_t company_id;
+
+ /** Vendor Specific Codec ID */
+ uint16_t vendor_specific;
+};
+
+struct ble_audio_bis {
+ /** Pointer to next BIS in subgroup */
+ STAILQ_ENTRY(ble_audio_bis) next;
+
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t codec_spec_config_len;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t *codec_spec_config;
+};
+
+struct ble_audio_subgroup {
+ /** Pointer to next subgroup in BIG */
+ STAILQ_ENTRY(ble_audio_subgroup) next;
+
+ /** Number of BISes in subgroup */
+ uint8_t bis_cnt;
+
+ /** Codec ID */
+ struct ble_audio_codec_id codec_id;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+
+ /** Link list of BISes */
+ STAILQ_HEAD(, ble_audio_bis) bises;
+};
+
+struct ble_audio_base {
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+
+ /** Presentation Delay */
+ uint32_t presentation_delay;
+
+ /** Number of subgroups in BIG */
+ uint8_t num_subgroups;
+
+ /** Link list of subgroups */
+ STAILQ_HEAD(, ble_audio_subgroup) subs;
+};
+
+struct ble_audio_codec_config_params {
+ /** Mandatory field, codec sampling frequency. */
+ uint8_t sampling_freq;
+
+ /** Mandatory field, codec frame duration. */
+ uint8_t frame_duration;
+
+ /**
+ * Optional field, bitfield with mapped Audio Locations.
+ * Set to 0 to omit in Codec Specific Configuration LTV construction.
+ */
+ uint32_t audio_channel_alloc;
+
+ /** Mandatory field, codec frame duration. */
+ uint16_t octets_per_codec_frame;
+
+ /**
+ * Optional field, codec frame duration.
+ * Set to 0 to omit in Codec Specific Configuration LTV construction.
+ */
+ uint8_t codec_frame_blocks_per_sdu;
+};
+
+/**
+ * @brief Build Codec Specific Configuration LTV structure
+ *
+ * This function packs Codec Specific Configuration settings into LTV format.
+ *
+ * @param[in] params Pointer to a
+ * `ble_audio_codec_config_params`
+ * struct that contains Codec Specific
+ * Configuration.
+ * @param[out] codec_config_out Pointer to a memory that will be filled
Review Comment:
"to a memory" is spare, pointer always points to some memory or null.
##########
nimble/host/include/host/ble_iso.h:
##########
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_ISO_
+#define H_BLE_ISO_
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_ISO)
+
+/** ISO event: BIG Create Completed */
+#define BLE_ISO_EVENT_BIG_CREATE_COMPLETE 0
+
+/** ISO event: BIG Terminate Completed */
+#define BLE_ISO_EVENT_BIG_TERMINATE_COMPLETE 0
+
+#include <inttypes.h>
+
+struct ble_iso_big_desc
+{
+ uint8_t big_handle;
+ uint32_t big_sync_delay;
+ uint32_t transport_latency_big;
+ uint8_t phy;
+ uint8_t nse;
+ uint8_t bn;
+ uint8_t pto;
+ uint8_t irc;
+ uint16_t max_pdu;
+ uint16_t iso_interval;
+ uint8_t num_bis;
+ uint16_t conn_handle[MYNEWT_VAL(BLE_MAX_BIS)];
+};
+
+/**
+ * Represents a ISO-related event. When such an event occurs, the host
+ * notifies the application by passing an instance of this structure to an
+ * application-specified callback.
+ */
+struct ble_iso_event {
+ /**
+ * Indicates the type of ISO event that occurred. This is one of the
+ * BLE_ISO_EVENT codes.
+ */
+ uint8_t type;
+
+ /**
+ * A discriminated union containing additional details concerning the ISO
+ * event. The 'type' field indicates which member of the union is valid.
+ */
+ union {
+ /**
+ * Represents a completion of BIG creation. Valid for the following
+ * event types:
+ * o BLE_ISO_EVENT_BIG_CREATE_COMPLETE
+ */
+ struct {
+ struct ble_iso_big_desc desc;
+ } big_created;
+
+ /**
+ * Represents a completion of BIG termination. Valid for the following
+ * event types:
+ * o BLE_ISO_EVENT_BIG_TERMINATE_COMPLETE
+ */
+ struct {
+ uint16_t big_handle;
+ uint8_t reason;
+ } big_terminated;
+ };
+};
+
+typedef int ble_iso_event_fn(struct ble_iso_event *event, void *arg);
+
+struct ble_iso_big_params {
+ uint32_t sdu_interval;
+ uint16_t max_sdu;
+ uint16_t max_transport_latency;
+ uint8_t rtn;
+ uint8_t phy;
+ uint8_t packing;
+ uint8_t framing;
+ uint8_t encryption;
+ const char *broadcast_code;
+};
+
+struct ble_iso_create_big_params {
+ uint16_t adv_handle;
+ uint8_t bis_cnt;
+ ble_iso_event_fn *cb;
+ void *cb_arg;
+};
+
+int ble_iso_create_big(const struct ble_iso_create_big_params *create_params,
+ const struct ble_iso_big_params *big_params);
+
+int ble_iso_terminate_big(uint8_t big_id);
+
+void
+ble_gap_rx_create_big_complete(const struct
+ ble_hci_ev_le_subev_create_big_complete *ev);
+void
+ble_gap_rx_terminate_big_complete(const struct
Review Comment:
what is this for ?
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended advertisements. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
+ * `ble_audio_broadcast_destroy` and recreate with `ble_audio_broadcast_create`
+ *
+ * @param[in] params Pointer to structure with new advertising data
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(const struct ble_broadcast_update_params
+ *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_info;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+};
+
+/**
+ * @brief Build BIG subgroup structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BASE.
+ * This function increases `num_subgroups` in BASE structure.
+ *
+ * @param[out] base Pointer to a `ble_audio_base` structure,
+ * that will be extended by the new subgroup
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
+ * structure, that will be filled out with
+ * supplied configuration
+ * @param[in] params Pointer to a `ble_broadcast_subgroup_params`
+ * structure, containing information about new
+ * subgroup
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_build_sub(struct ble_audio_base *base,
+ struct ble_audio_subgroup *sub,
+ const struct ble_broadcast_subgroup_params
+ *params);
+
+/** BIS parameters */
+struct ble_broadcast_bis_params {
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+};
+
+/**
+ * @brief Build BIS structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_bis`
+ * structure. Created BIS extends BIS list in provided subgroup.
+ * This function increases `bis_cnt` in subgroup structure.
+ *
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
+ * structure,
+ * that will be extended by the new BIS
+ * @param[out] bis Pointer to a `ble_broadcast_bis`
Review Comment:
Maybe there should be included information for out type parameters in case of failure ? out pointers would be null or invalid ?
##########
nimble/host/include/host/ble_iso.h:
##########
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_ISO_
+#define H_BLE_ISO_
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_ISO)
+
+/** ISO event: BIG Create Completed */
+#define BLE_ISO_EVENT_BIG_CREATE_COMPLETE 0
+
+/** ISO event: BIG Terminate Completed */
+#define BLE_ISO_EVENT_BIG_TERMINATE_COMPLETE 0
Review Comment:
this is the same as CREATE_COMPLETE
##########
nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_audio_common.h"
+#include "host/ble_audio_broadcast.h"
+
+struct ble_svc_auracast_create_params {
Review Comment:
Shouldn't be here included broadcast announcement ?
##########
nimble/host/include/host/ble_iso.h:
##########
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_ISO_
+#define H_BLE_ISO_
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_ISO)
+
+/** ISO event: BIG Create Completed */
+#define BLE_ISO_EVENT_BIG_CREATE_COMPLETE 0
+
+/** ISO event: BIG Terminate Completed */
+#define BLE_ISO_EVENT_BIG_TERMINATE_COMPLETE 0
+
+#include <inttypes.h>
+
+struct ble_iso_big_desc
+{
+ uint8_t big_handle;
+ uint32_t big_sync_delay;
+ uint32_t transport_latency_big;
+ uint8_t phy;
+ uint8_t nse;
+ uint8_t bn;
+ uint8_t pto;
+ uint8_t irc;
+ uint16_t max_pdu;
+ uint16_t iso_interval;
+ uint8_t num_bis;
+ uint16_t conn_handle[MYNEWT_VAL(BLE_MAX_BIS)];
+};
+
+/**
+ * Represents a ISO-related event. When such an event occurs, the host
+ * notifies the application by passing an instance of this structure to an
+ * application-specified callback.
+ */
+struct ble_iso_event {
+ /**
+ * Indicates the type of ISO event that occurred. This is one of the
+ * BLE_ISO_EVENT codes.
+ */
+ uint8_t type;
+
+ /**
+ * A discriminated union containing additional details concerning the ISO
+ * event. The 'type' field indicates which member of the union is valid.
+ */
+ union {
+ /**
+ * Represents a completion of BIG creation. Valid for the following
+ * event types:
+ * o BLE_ISO_EVENT_BIG_CREATE_COMPLETE
+ */
+ struct {
+ struct ble_iso_big_desc desc;
+ } big_created;
+
+ /**
+ * Represents a completion of BIG termination. Valid for the following
+ * event types:
+ * o BLE_ISO_EVENT_BIG_TERMINATE_COMPLETE
+ */
+ struct {
+ uint16_t big_handle;
+ uint8_t reason;
+ } big_terminated;
+ };
+};
+
+typedef int ble_iso_event_fn(struct ble_iso_event *event, void *arg);
+
+struct ble_iso_big_params {
+ uint32_t sdu_interval;
+ uint16_t max_sdu;
+ uint16_t max_transport_latency;
+ uint8_t rtn;
+ uint8_t phy;
+ uint8_t packing;
+ uint8_t framing;
+ uint8_t encryption;
+ const char *broadcast_code;
+};
+
+struct ble_iso_create_big_params {
+ uint16_t adv_handle;
+ uint8_t bis_cnt;
+ ble_iso_event_fn *cb;
+ void *cb_arg;
+};
+
+int ble_iso_create_big(const struct ble_iso_create_big_params *create_params,
+ const struct ble_iso_big_params *big_params);
+
+int ble_iso_terminate_big(uint8_t big_id);
+
+void
+ble_gap_rx_create_big_complete(const struct
Review Comment:
what is this for ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1382973344
##########
nimble/host/src/ble_iso.c:
##########
@@ -0,0 +1,369 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <inttypes.h>
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_ISO)
+
+#include "os/os_mbuf.h"
+#include "host/ble_hs_log.h"
+#include "host/ble_hs.h"
+#include "host/ble_iso.h"
+#include "nimble/hci_common.h"
+#include "sys/queue.h"
+#include "ble_hs_hci_priv.h"
+
+struct ble_iso_big {
+ SLIST_ENTRY(ble_iso_big) next;
+ uint8_t id;
+ uint16_t max_pdu;
+ uint8_t num_bis;
+ uint16_t conn_handles[MYNEWT_VAL(BLE_MAX_BIS)];
+
+ ble_iso_event_fn *cb;
+ void *cb_arg;
+};
+
+static SLIST_HEAD(, ble_iso_big) ble_iso_bigs;
+static struct os_mempool ble_iso_big_pool;
+static os_membuf_t ble_iso_big_mem[
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIG), sizeof (struct ble_iso_big))];
+
+static struct ble_iso_big *
+ble_iso_big_alloc(uint16_t adv_handle)
Review Comment:
yes :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "kolodgrz (via GitHub)" <gi...@apache.org>.
kolodgrz commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1382918409
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
Review Comment:
I mean args for destroy_cb :)
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BASE configuration */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+
+ /** Pointer to args for `destroy_cb` */
+ void *args;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[out] config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param[in] destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising and creates BASE for this instance.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(const struct ble_broadcast_base_config *base_config,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ * BASE will be terminated.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(const struct ble_broadcast_base_config
+ *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended advertisements. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
+ * `ble_audio_broadcast_destroy` and recreate with `ble_audio_broadcast_create`
+ *
+ * @param[in] params Pointer to structure with new advertising data
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(const struct ble_broadcast_update_params
+ *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_info;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+};
+
+/**
+ * @brief Build BIG subgroup structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BASE.
+ * This function increases `num_subgroups` in BASE structure.
+ *
+ * @param[out] base Pointer to a `ble_audio_base` structure,
+ * that will be extended by the new subgroup
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
+ * structure, that will be filled out with
+ * supplied configuration
+ * @param[in] params Pointer to a `ble_broadcast_subgroup_params`
+ * structure, containing information about new
+ * subgroup
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_build_sub(struct ble_audio_base *base,
+ struct ble_audio_subgroup *sub,
+ const struct ble_broadcast_subgroup_params
+ *params);
+
+/** BIS parameters */
+struct ble_broadcast_bis_params {
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+};
+
+/**
+ * @brief Build BIS structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_bis`
+ * structure. Created BIS extends BIS list in provided subgroup.
+ * This function increases `bis_cnt` in subgroup structure.
+ *
+ * @param[out] sub Pointer to a `ble_broadcast_subgroup`
+ * structure,
+ * that will be extended by the new BIS
+ * @param[out] bis Pointer to a `ble_broadcast_bis`
Review Comment:
It depends on what is the common way to handle it across nimble. Is this a common solution ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1371185902
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BASE to broadcast */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
Review Comment:
Hmm I don't see in spec this length requirement. Could you give a paragraph? `LOCAL NAME` AD type doesn't seem to have length requirement, neither complete or shortened. GATT characteristic can have lenght in range 0 to 248. Is it somewhere in BAP maybe? If so I'd add this to documentation and added check in implementation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1384493371
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** Broadcast Audio Source Endpoint */
+ struct ble_audio_base *base;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising.
+ * Length must be in range of 4 to 32 chars.
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+};
+
+struct ble_broadcast_update_params {
+ /** Broadcast name - null terminated.
+ * Set NULL to not include in advertising
+ */
+ const char *name;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+
+ /** Additional data to include in Extended Advertising */
+ uint8_t *svc_data;
+
+ /** Additional data length */
+ uint16_t svc_data_len;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_base *base,
+ void *args);
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param[in] params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BASE, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param[in] destroy_cb Optional callback to be invoked on
+ * `ble_audio_broadcast_destroy` call.
+ * @param[in] args Optional arguments to be passed to `destroy_cb`
+ * @param[in] gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(const struct ble_broadcast_create_params
+ *params,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement by enabling extended, periodic
+ * and BIGInfo advertisements for this instance.
+ *
+ * @param[in] adv_instance Advertising instance used by broadcast.
+ * @param[in] cb Pointer to an ISO event handler.
+ * @param[in] cb_arg Arguments to an ISO event handler.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(uint8_t adv_instance,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ *
+ * @param[in] adv_instance Advertising instance used by broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(uint8_t adv_instance);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function terminates BASE advertisement instance.
+ * After return advertising instance is free and must be configured again
+ * for future advertisements.
+ *
+ * @param[in] adv_instance Advertising instance used by broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(uint8_t adv_instance);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function updates extended advertisements.
+ *
+ * @param[in] params Pointer to structure with new advertising data
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(const struct ble_broadcast_update_params
+ *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_id;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+};
+
+/**
+ * @brief Build BIG subgroup structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BASE.
+ * This function increases `num_subgroups` in BASE structure.
+ *
+ * @param[out] base Pointer to a `ble_audio_base` structure,
+ * that will be extended by the new subgroup.
+ * In case of error, filled out data may be
+ * erroneous.
+ * @param[out] subgroup Pointer to a `ble_broadcast_subgroup`
+ * structure, that will be filled out with
+ * supplied configuration. In case of error,
+ * filled out data may be erroneous.
+ * @param[in] params Pointer to a `ble_broadcast_subgroup_params`
+ * structure, containing information about new
+ * subgroup
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_build_sub(struct ble_audio_base *base,
+ struct ble_audio_big_subgroup *subgroup,
+ const struct ble_broadcast_subgroup_params
+ *params);
+
+/** BIS parameters */
+struct ble_broadcast_bis_params {
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+};
+
+/**
+ * @brief Build BIS structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_bis`
+ * structure. Created BIS extends BIS list in provided subgroup.
+ * This function increases `bis_cnt` in subgroup structure.
+ *
+ * @param[out] sub Pointer to a updated `ble_broadcast_subgroup`
Review Comment:
can we name it subgroup.
and also this is in/out param right?
btw what is `ble_broadcast_subgroup` ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Initial Broadcast Source implementation [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1395603739
##########
nimble/host/services/auracast/syscfg.yml:
##########
@@ -0,0 +1,27 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.defs:
+ BLE_SVC_AURACAST_ADV_INSTANCE:
+ description: >
+ Defines which advertising instance is used for Auracast.
+ value: 42
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342379563
##########
nimble/host/include/host/ble_audio_common.h:
##########
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_COMMON_
+#define H_BLE_AUDIO_COMMON_
+
+#include "stdint.h"
+#include "os/queue.h"
+
+#define BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+struct ble_audio_codec_id {
+ /** Coding Fromat */
+ uint8_t format;
+
+ /** Company ID */
+ uint16_t company_id;
+
+ /** Vendor Specific Codec ID */
+ uint16_t vendor_specific;
+};
+
+struct ble_audio_bis {
+ /** Pointer to next BIS in subgroup */
+ STAILQ_ENTRY(ble_audio_bis) next;
+
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t codec_spec_config_len;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t *codec_spec_config;
+};
+
+typedef int ble_audio_broadcast_sub_free_fn(void *cb_args);
+
+struct ble_audio_subgroup {
+ /** Pointer to next subgroup in BIG */
+ STAILQ_ENTRY(ble_audio_subgroup) next;
+
+ /** Number of BISes in subgroup */
+ uint8_t bis_cnt;
+
+ /** Codec ID */
+ struct ble_audio_codec_id codec_id;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+
+ /** Link list of BISes */
+ STAILQ_HEAD(, ble_audio_bis) bises;
+};
+
+struct ble_audio_big {
+ /** Broadcast ID */
+ uint32_t broadcast_id : 24;
+
+ /** Presentation Delay */
+ uint8_t presentation_delay[3];
+
+ /** Number of subgroups in BIG */
+ uint8_t num_subgroups;
+
+ /** Link list of subgroups */
+ STAILQ_HEAD(, ble_audio_subgroup) subs;
+};
+
+struct ble_audio_codec_config_params {
+ /** Mandatory field, codec sampling frequency. */
+ uint8_t sampling_freq;
+
+ /** Mandatory field, codec frame duration. */
+ uint8_t frame_duration;
+
+ /**
+ * Optional field, bitfield with mapped Audio Locations.
+ * Set to 0 to omit in Codec Specific Configuration LTV construction.
+ */
+ uint32_t audio_channel_alloc;
+
+ /** Mandatory field, codec frame duration. */
+ uint16_t octets_per_codec_frame;
+
+ /**
+ * Optional field, codec frame duration.
+ * Set to 0 to omit in Codec Specific Configuration LTV construction.
+ */
+ uint8_t codec_frame_blocks_per_sdu;
+};
+
+/**
+ * @brief Build Codec Specific Configuration LTV structure
+ *
+ * This function packs Codec Specific Configuration settings into LTV format.
+ *
+ * @param params Pointer to a `ble_audio_codec_config_params`
+ * struct that contains Codec Specific
+ * Configuration.
+ * @param codec_config_out Pointer to a memory that will be filled with
+ * Codec Specific Configuration LTV structure.
+ * Memory size must be sufficient to fit
+ * expected LTV structure size.
+ * @param codec_config_out_len Total length of constructed Codec Specific
+ * Configuration.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_build_codec_config(struct ble_audio_codec_config_params *params,
+ uint8_t *codec_config_out,
+ uint8_t codec_config_out_len);
Review Comment:
pointer to len
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342381083
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
Review Comment:
char
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342412569
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
+
+ /** Broadcast name length */
+ uint8_t name_len;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+};
+
+struct ble_broadcast_update_params {
+ /** New BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Updated parameters of Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Updated parameters of Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** New Broadcast name */
+ const uint8_t *name;
+
+ /** New Broadcast name length */
+ uint8_t name_len;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_big *big,
+ void *arg);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BIG configuration */
+ struct ble_audio_big *big;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+
+ /** Broadcast ID */
+ uint8_t big_id;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BIG, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(struct ble_broadcast_create_params *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(struct ble_broadcast_base_config *base_config);
Review Comment:
move big here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342369805
##########
nimble/host/include/host/ble_iso.h:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_ISO_
+#define H_BLE_ISO_
+#include "syscfg/syscfg.h"
+
+#if MYNEWT_VAL(BLE_ISO)
+
+#include <inttypes.h>
+
+struct ble_iso_big_params {
+ uint8_t sdu_interval[3];
+ uint16_t max_sdu;
+ uint16_t max_transport_latency;
+ uint8_t rtn;
+ uint8_t phy;
+ uint8_t packing;
+ uint8_t framing;
+ uint8_t encryption;
+ uint8_t broadcast_code[16];
Review Comment:
const pointer char
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] rymanluk commented on a diff in pull request #1619: nimble/host: broadcast and Auracast API
Posted by "rymanluk (via GitHub)" <gi...@apache.org>.
rymanluk commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342349115
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
+
+ /** Broadcast name length */
+ uint8_t name_len;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+};
+
+struct ble_broadcast_update_params {
+ /** New BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Updated parameters of Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Updated parameters of Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** New Broadcast name */
+ const uint8_t *name;
+
+ /** New Broadcast name length */
+ uint8_t name_len;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_big *big,
+ void *arg);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BIG configuration */
+ struct ble_audio_big *big;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
Review Comment:
ins't broadcast_id already in *big?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342401698
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
+
+ /** Broadcast name length */
+ uint8_t name_len;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+};
+
+struct ble_broadcast_update_params {
+ /** New BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Updated parameters of Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Updated parameters of Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** New Broadcast name */
+ const uint8_t *name;
+
+ /** New Broadcast name length */
+ uint8_t name_len;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_big *big,
+ void *arg);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BIG configuration */
+ struct ble_audio_big *big;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+
+ /** Broadcast ID */
+ uint8_t big_id;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BIG, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(struct ble_broadcast_create_params *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising and terminates them. After return advertising instance is free
+ * and must be configured again for future advertisements.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(struct ble_broadcast_base_config *base_config);
Review Comment:
void * usr_data
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
+
+ /** Broadcast name length */
+ uint8_t name_len;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+};
+
+struct ble_broadcast_update_params {
+ /** New BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Updated parameters of Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Updated parameters of Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** New Broadcast name */
+ const uint8_t *name;
+
+ /** New Broadcast name length */
+ uint8_t name_len;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_big *big,
+ void *arg);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BIG configuration */
+ struct ble_audio_big *big;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+
+ /** Broadcast ID */
+ uint8_t big_id;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BIG, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(struct ble_broadcast_create_params *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising and terminates them. After return advertising instance is free
+ * and must be configured again for future advertisements.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(struct ble_broadcast_base_config *base_config);
Review Comment:
void * arg
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342405292
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
+
+ /** Broadcast name length */
+ uint8_t name_len;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+};
+
+struct ble_broadcast_update_params {
+ /** New BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Updated parameters of Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Updated parameters of Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** New Broadcast name */
+ const uint8_t *name;
+
+ /** New Broadcast name length */
+ uint8_t name_len;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_big *big,
+ void *arg);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BIG configuration */
+ struct ble_audio_big *big;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+
+ /** Broadcast ID */
+ uint8_t big_id;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BIG, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(struct ble_broadcast_create_params *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ ble_gap_event_fn *gap_cb);
+
+/**
+ * @brief Start advertisements for given BASE configuration
+ *
+ * This function starts BASE advertisement on by enabling extended and periodic
+ * advertising.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that shall be used for broadcast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_start(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Stop advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be stopped for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_stop(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Destroy advertisements for given BASE configuration
+ *
+ * This function stops BASE advertisement by disabling extended and periodic
+ * advertising and terminates them. After return advertising instance is free
+ * and must be configured again for future advertisements.
+ *
+ * @param base_config Pointer to a `ble_broadcast_base_config`
+ * struct that broadcast shall be terminated for.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_destroy(struct ble_broadcast_base_config *base_config);
+
+/**
+ * @brief Update advertisements for given BASE configuration
+ *
+ * This function can be used to update extended and periodic advertisements
+ * for that are used to broadcast with BASE configuration. This function
+ * cannot be used to update BASE configuration itself, because BIG cannot be
+ * changed during it's lifetime. To modify BASE configuration destroy it using
+ * `ble_audio_broadcast_destroy` and recreate with `ble_audio_broadcast_create`
+ *
+ * @param params Pointer to a `ble_broadcast_update_params`
+ * structure.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_update(struct ble_broadcast_update_params *params);
+
+/** BIG Subgroup parameters */
+struct ble_broadcast_subgroup_params {
+ /** Subgroup level Codec information */
+ struct ble_audio_codec_id *codec_info;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+};
+
+/**
+ * @brief Build BIG subgroup structure
+ *
+ * This is a helper function can be used to fill out `ble_broadcast_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BIG.
+ * This function increases `num_subgroups` in BIG structure.
+ *
+ * @param params Pointer to a `ble_broadcast_subgroup_params`
+ * structure, containing information about new
+ * subgroup
+ * @param big Pointer to a `ble_audio_big` structure,
+ * that will be extended by the new subgroup
+ * @param sub Pointer to a `ble_broadcast_subgroup`
+ * structure, that will be filled out with
+ * supplied configuration
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_build_sub(struct ble_broadcast_subgroup_params params,
Review Comment:
order: big, sub, out params
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: broadcast and Auracast API [mynewt-nimble]
Posted by "KKopyscinski (via GitHub)" <gi...@apache.org>.
KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1342404402
##########
nimble/host/include/host/ble_audio_broadcast.h:
##########
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_BROADCAST_
+#define H_BLE_AUDIO_BROADCAST_
+
+#include <stdint.h>
+#include "host/ble_gap.h"
+#include "host/ble_iso.h"
+#include "host/ble_audio_common.h"
+
+struct ble_broadcast_create_params {
+ /** BIG to broadcast */
+ struct ble_audio_big *big;
+
+ /** BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Parameters used to configure Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Parameters used to configure Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_params;
+
+ /** Broadcast name */
+ const uint8_t *name;
+
+ /** Broadcast name length */
+ uint8_t name_len;
+
+ /** Advertising instance */
+ uint8_t adv_instance;
+};
+
+struct ble_broadcast_update_params {
+ /** New BLE address to use for advertising */
+ ble_addr_t *addr;
+
+ /** Updated parameters of Extended advertising */
+ struct ble_gap_ext_adv_params *extended_params;
+
+ /** Updated parameters of Periodic advertising */
+ struct ble_gap_periodic_adv_params *periodic_params;
+
+ /** New Broadcast name */
+ const uint8_t *name;
+
+ /** New Broadcast name length */
+ uint8_t name_len;
+};
+
+typedef int ble_audio_broadcast_destroy_fn(struct ble_audio_big *big,
+ void *arg);
+
+/** BASE configuration describing broadcast advertisement */
+struct ble_broadcast_base_config {
+ /** Advertising instance used by broadcast */
+ uint8_t adv_instance;
+
+ /** Pointer to BIG configuration */
+ struct ble_audio_big *big;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+
+ /** Broadcast ID */
+ uint8_t big_id;
+
+ /**
+ * Optional callback associated with broadcasting instance, called on
+ * destroying broadcast
+ */
+ ble_audio_broadcast_destroy_fn *destroy_cb;
+};
+
+/**
+ * @brief Create Broadcast Audio Source Endpoint and configure advertising
+ * instance
+ *
+ * This function configures advertising instance for extended and periodic
+ * advertisements to be ready for broadcast with BASE configuration.
+ *
+ * @param params Pointer to a `ble_broadcast_base_params`
+ * structure that defines BIG, extended
+ * advertising and periodic advertising
+ * configuration.
+ * @param config_out Pointer to a `ble_broadcast_base_config`
+ * structure to return configuration of created
+ * BASE advertisement.
+ * @param destroy_cb Optional callback to be called when BASE
+ * advertisement is destroyed.
+ * @param gap_cb GAP event callback to be associated with BASE
+ * advertisement.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_create(struct ble_broadcast_create_params *params,
+ struct ble_broadcast_base_config *config_out,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
Review Comment:
void *args
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org