1 /* 2 * Copyright 2021 HIMSA II K/S - www.himsa.com. 3 * Represented by EHIMA - www.ehima.com 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 #pragma once 19 20 #include <array> 21 #include <optional> 22 #include <vector> 23 24 #include "bta/include/bta_le_audio_api.h" 25 26 /* Interface class */ 27 class LeAudioBroadcaster { 28 public: 29 static constexpr uint8_t kInstanceIdUndefined = 0xFF; 30 31 virtual ~LeAudioBroadcaster(void) = default; 32 33 static void Initialize( 34 bluetooth::le_audio::LeAudioBroadcasterCallbacks* callbacks, 35 base::Callback<bool()> hal_2_1_verifier); 36 static void Stop(void); 37 static void Cleanup(void); 38 static LeAudioBroadcaster* Get(void); 39 static bool IsLeAudioBroadcasterRunning(void); 40 static void DebugDump(int fd); 41 42 virtual void CreateAudioBroadcast( 43 bool is_public, const std::string& broadcast_name, 44 const std::optional<bluetooth::le_audio::BroadcastCode>& broadcast_code, 45 const std::vector<uint8_t>& public_metadata, 46 const std::vector<uint8_t>& subgroup_quality, 47 const std::vector<std::vector<uint8_t>>& subgroup_metadata) = 0; 48 virtual void SuspendAudioBroadcast(uint32_t broadcast_id) = 0; 49 virtual void StartAudioBroadcast(uint32_t broadcast_id) = 0; 50 virtual void StopAudioBroadcast(uint32_t broadcast_id) = 0; 51 virtual void DestroyAudioBroadcast(uint32_t broadcast_id) = 0; 52 virtual void GetBroadcastMetadata(uint32_t broadcast_id) = 0; 53 virtual void GetAllBroadcastStates(void) = 0; 54 virtual void UpdateMetadata( 55 uint32_t broadcast_id, const std::string& broadcast_name, 56 const std::vector<uint8_t>& public_metadata, 57 const std::vector<std::vector<uint8_t>>& subgroup_metadata) = 0; 58 virtual void IsValidBroadcast( 59 uint32_t broadcast_id, uint8_t addr_type, RawAddress addr, 60 base::Callback<void(uint8_t /* broadcast_id */, uint8_t /* addr_type */, 61 RawAddress /* addr */, bool /* is_valid */)> 62 cb) = 0; 63 64 virtual void SetStreamingPhy(uint8_t phy) = 0; 65 virtual uint8_t GetStreamingPhy(void) const = 0; 66 }; 67