KKopyscinski commented on code in PR #1698:
URL: https://github.com/apache/mynewt-nimble/pull/1698#discussion_r1515614306


##########
apps/bttester/src/btp_bap.c:
##########
@@ -0,0 +1,420 @@
+/*
+ * 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.
+ */
+
+/* btp_bap.c - Bluetooth Basic Audio Profile Tester */
+
+
+#if MYNEWT_VAL(BLE_ISO_BROADCASTER)
+
+#include "btp/btp_bap.h"
+#include "syscfg/syscfg.h"
+
+
+#include "btp/btp.h"
+#include "console/console.h"
+
+#include "nimble/ble.h"
+#include "host/ble_hs.h"
+#include "host/util/util.h"
+#include "math.h"
+
+#include "audio/ble_audio_broadcast_source.h"
+#include "audio/ble_audio.h"
+#include "host/ble_iso.h"
+
+#include "bsp/bsp.h"
+
+
+#define BROADCAST_ADV_INSTANCE                 1
+
+static struct ble_audio_big_subgroup big_subgroup;
+
+static uint8_t id_addr_type;
+static uint8_t audio_data[155];
+static uint16_t max_sdu;
+static uint32_t sdu_interval;
+
+static struct ble_audio_base tester_base;
+
+static os_membuf_t bis_mem[
+    OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_ISO_MAX_BISES),
+                    sizeof(struct ble_audio_bis))
+];
+static struct os_mempool bis_pool;
+
+static os_membuf_t codec_spec_mem[
+    OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_ISO_MAX_BISES) * 2, 19)
+];
+static struct os_mempool codec_spec_pool;
+
+static uint16_t bis_handles[MYNEWT_VAL(BLE_ISO_MAX_BISES)];
+/* The timer callout */
+static struct os_callout audio_broadcast_callout;
+
+struct ble_iso_big_params big_params;
+
+static int audio_data_offset;
+
+static void
+audio_broadcast_event_cb(struct os_event *ev)
+{
+    assert(ev != NULL);
+    uint32_t ev_start_time = os_cputime_ticks_to_usecs(os_cputime_get32());
+
+    if (audio_data_offset + 2 * max_sdu >= sizeof(audio_data)) {
+        audio_data_offset = 0;
+    }
+
+    uint8_t lr_payload[max_sdu * 2];
+    memcpy(lr_payload, audio_data + audio_data_offset, max_sdu);
+    memcpy(lr_payload + max_sdu, audio_data + audio_data_offset,
+           max_sdu);
+    ble_iso_tx(bis_handles[0], (void *)(lr_payload),
+               max_sdu * 2);
+
+    audio_data_offset += max_sdu;
+
+    /** Use cputime to time BROADCAST_SDU_INTVL, as these ticks are more
+     *  accurate than os_time ones. This assures that we do not push
+     *  LC3 data to ISO before interval, which could lead to
+     *  controller running out of buffers. This is only needed because
+     *  we already have coded data in an array - in real world application

Review Comment:
   ```suggestion
        *  we already have coded in an array - in real world application
   ```
   nitpick: this is filled with pattern, so not encoded



-- 
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