KKopyscinski commented on code in PR #1677: URL: https://github.com/apache/mynewt-nimble/pull/1677#discussion_r1482552435
########## nimble/host/audio/include/host/audio/ble_audio.h: ########## @@ -0,0 +1,413 @@ +/* + * 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_ +#define H_BLE_AUDIO_ + +#include <stdint.h> +#include <sys/queue.h> + +#include "host/audio/ble_audio_bsnk.h" + +#ifndef MIN +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif + +#ifndef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif + +/** @brief Broadcast Audio Announcement structure */ +struct ble_audio_bcst_audio_announcement { + /** Broadcast ID */ + uint32_t broadcast_id; + + /** Additional service data included in Broadcast Audio Announcement */ + const uint8_t *svc_data; + + /** Additional service data length */ + uint16_t svc_data_len; +}; + +/** @brief Public Broadcast Announcement features bits */ +enum ble_audio_public_bcst_announcement_feat { + /** Broadcast Stream Encryption */ + BLE_AUDIO_PUBLIC_BCST_ANNOUNCEMENT_FEAT_ENCRYPTION = 1 << 0, + + /** Standard Quality Public Broadcast Audio */ + BLE_AUDIO_PUBLIC_BCST_ANNOUNCEMENT_FEAT_AUDIO_SQ = 1 << 1, + + /** High Quality Public Broadcast Audio */ + BLE_AUDIO_PUBLIC_BCST_ANNOUNCEMENT_FEAT_AUDIO_HQ = 1 << 2, +}; + +/** @brief Public Broadcast Announcement structure */ +struct ble_audio_public_bcst_announcement { + /** Public Broadcast Announcement features bitfield */ + enum ble_audio_public_bcst_announcement_feat feat; + + /** Metadata Length */ + uint8_t metadata_len; + + /** Metadata */ + const uint8_t *metadata; +}; + +struct ble_audio_bcst_name { + /** Broadcast Name length */ + uint8_t name_len; + + /** Broadcast Name */ + const char *name; +}; + +/** + * @defgroup ble_audio_events Bluetooth Low Energy Audio Events + * @{ + */ + +/** BLE Audio event: Broadcast Sink created */ +#define BLE_AUDIO_EVENT_BSNK_CREATED 0 + +/** BLE Audio event: Broadcast Sink destroyed */ +#define BLE_AUDIO_EVENT_BSNK_DESTROYED 1 + +/** BLE Audio event: Broadcast Sink PA Sync state changed */ +#define BLE_AUDIO_EVENT_BSNK_PA_SYNC_STATE_CHANGED 2 + +/** BLE Audio event: Broadcast Sink Encryption state changed */ +#define BLE_AUDIO_EVENT_BSNK_ENC_STATE_CHANGED 3 + +/** BLE Audio event: Broadcast Sink Sync state changed */ +#define BLE_AUDIO_EVENT_BSNK_SYNC_STATE_CHANGED 4 + +/** BLE Audio event: Basic Audio Announcement */ +#define BLE_AUDIO_EVENT_BASIC_AUDIO_ANNOUNCEMENT 5 + +/** BLE Audio event: Broadcast Announcement */ +#define BLE_AUDIO_EVENT_BCST_ANNOUNCEMENT 6 +/** @} */ + +/** @brief Audio Broadcast Sink created event */ +struct ble_audio_event_bsnk_created { + /** Audio Broadcast Sink instance */ + struct ble_audio_bsnk *snk; +}; + +/** @brief Audio Broadcast Sink destroyed event */ +struct ble_audio_event_bsnk_destroyed { + /** Audio Broadcast Sink instance */ + struct ble_audio_bsnk *snk; +}; + +/** @brief Audio Broadcast Sink PA Sync state changed event */ +struct ble_audio_event_bsnk_pa_sync_state_changed { + /** Audio Broadcast Sink instance */ + struct ble_audio_bsnk *snk; + + /** Periodic Advertisement Sync state */ + enum ble_audio_bsnk_pa_sync_state state; +}; + +/** @brief Audio Broadcast Sink Encryption state changed event */ +struct ble_audio_event_bsnk_enc_state_changed { + /** Audio Broadcast Sink instance */ + struct ble_audio_bsnk *snk; + + /** BIG Encryption state */ + enum ble_audio_bsnk_enc_state state; + + // Add Invalid (bad) code +}; + +/** @brief Audio Broadcast Sink Sync state changed event */ +struct ble_audio_event_bsnk_sync_state_changed { + /** Audio Broadcast Sink instance */ + struct ble_audio_bsnk *snk; + + /** Audio Broadcast Sync state */ + enum ble_audio_bsnk_sync_state state; + + /** BIS Synchronization */ + uint32_t bis_sync; Review Comment: I think this should be an array - probably pointer with count of entries (subgroups) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
