You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ko...@apache.org on 2023/12/04 08:27:20 UTC
(mynewt-nimble) 01/08: nimble/host: Broadcast Source and Auracast API design
This is an automated email from the ASF dual-hosted git repository.
kopyscinski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit b0fdcb9d5014b4fa57b797e125b2c935708d1d06
Author: Krzysztof Kopyściński <kr...@codecoup.pl>
AuthorDate: Thu Sep 28 13:42:51 2023 +0200
nimble/host: Broadcast Source and Auracast API design
This is a design of API that could be used to create BASE configuration manage
its broadcast (setup extended advertising, periodic advertising and
BASE advertisements, stop, resume, terminate and modify them)
---
nimble/host/include/host/ble_audio_broadcast.h | 245 +++++++++++++++++++++
nimble/host/include/host/ble_audio_common.h | 195 ++++++++++++++++
nimble/host/include/host/ble_hs_adv.h | 6 +
nimble/host/include/host/ble_iso.h | 127 +++++++++++
.../include/services/auracast/ble_svc_auracast.h | 132 +++++++++++
5 files changed, 705 insertions(+)
diff --git a/nimble/host/include/host/ble_audio_broadcast.h b/nimble/host/include/host/ble_audio_broadcast.h
new file mode 100644
index 00000000..acfc5734
--- /dev/null
+++ b/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_audio_big_subgroup`
+ * structure. Created subgroup extends subgroup list in provided BASE.
+ * This function increases `num_subgroups` in BASE structure.
+ *
+ * @param[in/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_audio_big_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[in/out] subgroup Pointer to a updated `ble_audio_big_subgroup`
+ * structure, that will be extended by the new
+ * BIS. In case of error, filled out data may be
+ * erroneous.
+ * @param[out] bis Pointer to a `ble_broadcast_bis`
+ * 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_bis_params`
+ * structure, containing information about new
+ * BIS
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_broadcast_build_bis(struct ble_audio_big_subgroup *subgroup,
+ struct ble_audio_bis *bis,
+ const struct ble_broadcast_bis_params
+ *params);
+
+int ble_audio_broadcast_init(void);
+#endif
diff --git a/nimble/host/include/host/ble_audio_common.h b/nimble/host/include/host/ble_audio_common.h
new file mode 100644
index 00000000..43f88ea2
--- /dev/null
+++ b/nimble/host/include/host/ble_audio_common.h
@@ -0,0 +1,195 @@
+/*
+ * 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"
+
+/** Helper macros for BLE_AUDIO_BUILD_CODEC_CONFIG */
+#define FIELD_LEN_2(_len, _type, _field) _len, _type, _field,
+#define FIELD_LEN_5(_len, _type, _field) _len, _type, _field, \
+ _field >> 8, _field >> 16, \
+ _field >> 24,
+
+#define FIELD_TESTED_0(_len, _type, _field)
+#define FIELD_TESTED_1(_len, _type, _field) FIELD_LEN_ ## _len(_len, \
+ _type, \
+ _field)
+#define EMPTY() FIELD_TESTED_0
+#define PRESENT(X) FIELD_TESTED_1
+#define TEST(x, A, FUNC, ...) FUNC
+#define TEST_FIELD(...) TEST(, ## __VA_ARGS__, \
+ PRESENT(__VA_ARGS__), \
+ EMPTY(__VA_ARGS__))
+#define FIELD_TESTED(_test, _len, _type, _field) _test(_len, _type, _field)
+#define OPTIONAL_FIELD(_len, _type, ...) FIELD_TESTED(TEST_FIELD \
+ (__VA_ARGS__), \
+ _len, \
+ _type, \
+ __VA_ARGS__)
+
+#define BLE_BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+#define BLE_AUDIO_SAMPLING_RATE_8000_HZ 0x01
+#define BLE_AUDIO_SAMPLING_RATE_11025_HZ 0x02
+#define BLE_AUDIO_SAMPLING_RATE_16000_HZ 0x03
+#define BLE_AUDIO_SAMPLING_RATE_22050_HZ 0x04
+#define BLE_AUDIO_SAMPLING_RATE_24000_HZ 0x05
+#define BLE_AUDIO_SAMPLING_RATE_32000_HZ 0x06
+#define BLE_AUDIO_SAMPLING_RATE_44100_HZ 0x07
+#define BLE_AUDIO_SAMPLING_RATE_48000_HZ 0x08
+#define BLE_AUDIO_SAMPLING_RATE_88200_HZ 0x09
+#define BLE_AUDIO_SAMPLING_RATE_96000_HZ 0x0A
+#define BLE_AUDIO_SAMPLING_RATE_176400_HZ 0x0B
+#define BLE_AUDIO_SAMPLING_RATE_192000_HZ 0x0C
+#define BLE_AUDIO_SAMPLING_RATE_384000_HZ 0x0D
+
+#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 (1ULL)
+#define BLE_AUDIO_LOCATION_FRONT_RIGHT (1ULL << 1)
+#define BLE_AUDIO_LOCATION_FRONT_CENTER (1ULL << 2)
+#define BLE_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 (1ULL << 3)
+#define BLE_AUDIO_LOCATION_BACK_LEFT (1ULL << 4)
+#define BLE_AUDIO_LOCATION_FRONT_LEFT_CENTER (1ULL << 5)
+#define BLE_AUDIO_LOCATION_FRONT_RIGHT_CENTER (1ULL << 6)
+#define BLE_AUDIO_LOCATION_BACK_CENTER (1ULL << 7)
+#define BLE_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 (1ULL << 8)
+#define BLE_AUDIO_LOCATION_SIDE_LEFT (1ULL << 9)
+#define BLE_AUDIO_LOCATION_SIDE_RIGHT (1ULL << 10)
+#define BLE_AUDIO_LOCATION_TOP_FRONT_LEFT (1ULL << 11)
+#define BLE_AUDIO_LOCATION_TOP_FRONT_RIGHT (1ULL << 12)
+#define BLE_AUDIO_LOCATION_TOP_FRONT_CENTER (1ULL << 13)
+#define BLE_AUDIO_LOCATION_TOP_CENTER (1ULL << 14)
+#define BLE_AUDIO_LOCATION_TOP_BACK_LEFT (1ULL << 15)
+#define BLE_AUDIO_LOCATION_TOP_BACK_RIGHT (1ULL << 16)
+#define BLE_AUDIO_LOCATION_TOP_SIDE_LEFT (1ULL << 17)
+#define BLE_AUDIO_LOCATION_TOP_SIDE_RIGHT (1ULL << 18)
+#define BLE_AUDIO_LOCATION_TOP_BACK_CENTER (1ULL << 19)
+#define BLE_AUDIO_LOCATION_BOTTOM_FRONT_CENTER (1ULL << 20)
+#define BLE_AUDIO_LOCATION_BOTTOM_FRONT_LEFT (1ULL << 21)
+#define BLE_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT (1ULL << 22)
+#define BLE_AUDIO_LOCATION_LEFT_SURROUND (1ULL << 23)
+#define BLE_AUDIO_LOCATION_RIGHT_SURROUND (1ULL << 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, \
+ _frame_duration, \
+ _audio_channel_alloc, \
+ _octets_per_codec_frame, \
+ _codec_frame_blocks_per_sdu) \
+ { \
+ 2, BLE_AUDIO_CODEC_SAMPLING_FREQ_TYPE, _sampling_freq, \
+ 2, BLE_AUDIO_CODEC_FRAME_DURATION_TYPE, _frame_duration, \
+ OPTIONAL_FIELD(5, BLE_AUDIO_CODEC_AUDIO_CHANNEL_ALLOCATION_TYPE, \
+ _audio_channel_alloc) \
+ 3, BLE_AUDIO_CODEC_OCTETS_PER_CODEC_FRAME_TYPE, \
+ (_octets_per_codec_frame), ((_octets_per_codec_frame) >> 8), \
+ OPTIONAL_FIELD(2, BLE_AUDIO_CODEC_FRAME_BLOCKS_PER_SDU_TYPE, \
+ _codec_frame_blocks_per_sdu) \
+ }
+
+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_big_subgroup {
+ /** Pointer to next subgroup in BIG */
+ STAILQ_ENTRY(ble_audio_big_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_big_subgroup) subs;
+};
+
+#endif /* H_BLE_AUDIO_COMMON_ */
diff --git a/nimble/host/include/host/ble_hs_adv.h b/nimble/host/include/host/ble_hs_adv.h
index fabeca64..a644add6 100644
--- a/nimble/host/include/host/ble_hs_adv.h
+++ b/nimble/host/include/host/ble_hs_adv.h
@@ -164,6 +164,12 @@ struct ble_hs_adv_fields {
/** Length of manufacturer specific data. */
uint8_t mfg_data_len;
+
+ /** 0x30 - Broadcast name. */
+ const uint8_t *broadcast_name;
+
+ /** Length of the Broadcast name. */
+ uint8_t broadcast_name_len;
};
/**
diff --git a/nimble/host/include/host/ble_iso.h b/nimble/host/include/host/ble_iso.h
new file mode 100644
index 00000000..653b0acc
--- /dev/null
+++ b/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 1
+
+#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 {
+ uint8_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
+ ble_hci_ev_le_subev_terminate_big_complete
+ *ev);
+
+int ble_iso_tx(uint16_t conn_handle, void *data, uint16_t data_len);
+
+int ble_iso_init(void);
+
+#endif
+#endif
diff --git a/nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h b/nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h
new file mode 100644
index 00000000..7a31dfc3
--- /dev/null
+++ b/nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h
@@ -0,0 +1,132 @@
+/*
+ * 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 {
+ /** Broadcast Audio Source Endpoint */
+ struct ble_audio_base *base;
+
+ /** BIG parameters */
+ struct ble_iso_big_params *big_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;
+
+ /** Own address type to be used by advertising instance */
+ uint8_t own_addr_type;
+
+ /** PHY to be used for auxiliary advertisements */
+ uint8_t secondary_phy;
+
+ /** Advertising Set ID */
+ uint8_t sid;
+
+ /** Frame duration, in us */
+ uint16_t frame_duration;
+
+ /** sampling frequency, in Hz */
+ uint16_t sampling_frequency;
+
+ /** bitrate, in Hz */
+ uint32_t bitrate;
+
+ /** Program info - null terminated.
+ * Set NULL to not include in advertising.
+ */
+ const char *program_info;
+};
+
+/**
+ * @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] auracast_instance Pointer to a advertising instance used by
+ * created Auracast.
+ * @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,
+ uint8_t *auracast_instance,
+ ble_audio_broadcast_destroy_fn *destroy_cb,
+ void *args,
+ ble_gap_event_fn *gap_cb);
+/**
+ * @brief Terminate all active advertisements and free resources associated
+ * with given Auracast broadcast.
+ *
+ * This function stops Auracast 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[in] auracast_instance Pointer to a advertising instance used by
+ * Auracast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_svc_auracast_terminate(uint8_t auracast_instance);
+
+/**
+ * @brief Start advertisements for given Auracast broadcast
+ *
+ * This function starts Auracast broadcast on by enabling extended and periodic
+ * advertising.
+ *
+ * @param[in] auracast_instance Pointer to a advertising instance used by
+ * Auracast.
+ * @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_svc_auracast_start(uint8_t auracast_instance,
+ ble_iso_event_fn *cb, void *cb_arg);
+
+/**
+ * @brief Stop advertisements for given Auracast broadcast
+ *
+ * This function stops Auracast broadcast by disabling extended and periodic
+ * advertising. Advertising instance is still configured and ready for resume.
+ *
+ * @param[in] auracast_instance Pointer to a advertising instance used by
+ * Auracast.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_svc_auracast_stop(uint8_t auracast_instance);