"""
BAP/BSRC/SCC/BV-38-C: Multi BIG Configuration

Configuration: Two BIGs (id=12 and id=13), stereo (2 BISes each)
"""

import logging
import os

from auracast.auracast_config import AuracastGlobalConfig, AuracastBigConfig, AuracastQosFast
from auracast.multicast import broadcast, run_async


if __name__ == "__main__":
    logging.basicConfig(
        level=os.environ.get("LOG_LEVEL", logging.INFO),
        format="%(module)s.py:%(lineno)d %(levelname)s: %(message)s",
    )

    os.chdir(os.path.join(os.path.dirname(__file__), "../../auracast"))

    config = AuracastGlobalConfig()
    config.qos_config = AuracastQosFast()
    config.transport = "serial:/dev/ttyAMA3,1000000,rtscts"

    # First BIG
    big1 = AuracastBigConfig()
    big1.random_address = "F1:F1:F2:F3:F4:F5"
    big1.audio_source = "file:./testdata/announcement_en.wav"
    big1.num_bis = 1
    big1.id = 12

    # Second BIG
    big2 = AuracastBigConfig()
    big2.random_address = "F1:F1:F2:F3:F4:F6"
    big2.audio_source = "file:./testdata/announcement_en.wav"
    big2.num_bis = 1
    big2.id = 13

    run_async(
        broadcast(
            config,
            [big1, big2],
        )
    )
