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-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to