Add support for manufacturer data
This commit is contained in:
@@ -24,6 +24,7 @@ qos_config_mono_low_rel = AuracastQoSConfig( #highest latency
|
||||
@dataclass
|
||||
class AuracastGlobalConfig:
|
||||
qos_config: AuracastQoSConfig
|
||||
debug: bool = False
|
||||
device_name: str = 'Auracaster'
|
||||
transport: str = ''
|
||||
auracast_device_address: hci.Address = hci.Address('F0:F1:F2:F3:F4:F5')
|
||||
@@ -31,7 +32,7 @@ class AuracastGlobalConfig:
|
||||
octets_per_frame: int = 60 #48kbps@24kHz # bitrate = octets_per_frame * 8 / frame len
|
||||
frame_duration_us: int = 10000
|
||||
presentation_delay_us: int = 40000
|
||||
debug: bool = False
|
||||
manufacturer_data: tuple[int, bytes] = None
|
||||
|
||||
@dataclass
|
||||
class AuracastBigConfig:
|
||||
|
||||
@@ -22,6 +22,7 @@ import contextlib
|
||||
import logging
|
||||
import wave
|
||||
import itertools
|
||||
import struct
|
||||
from typing import cast, Any, AsyncGenerator, Coroutine, Dict, Optional, Tuple
|
||||
from typing import List
|
||||
|
||||
@@ -170,6 +171,21 @@ async def run_broadcast(
|
||||
],
|
||||
)
|
||||
logger.info('Setup Advertising')
|
||||
advertising_manufacturer_data = (
|
||||
b''
|
||||
if global_config.manufacturer_data is None
|
||||
else bytes(
|
||||
core.AdvertisingData(
|
||||
[
|
||||
(
|
||||
core.AdvertisingData.MANUFACTURER_SPECIFIC_DATA,
|
||||
struct.pack('<H', global_config.manufacturer_data[0])
|
||||
+ global_config.manufacturer_data[1],
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
)
|
||||
bigs[f'big{i}']['broadcast_audio_announcement'] = bap.BroadcastAudioAnnouncement(conf.broadcast_id)
|
||||
advertising_set = await device.create_advertising_set(
|
||||
random_address=conf.broadcast_random_address,
|
||||
@@ -192,6 +208,7 @@ async def run_broadcast(
|
||||
[(core.AdvertisingData.BROADCAST_NAME, conf.broadcast_name.encode())]
|
||||
)
|
||||
)
|
||||
+ advertising_manufacturer_data
|
||||
),
|
||||
periodic_advertising_parameters=bumble.device.PeriodicAdvertisingParameters(
|
||||
periodic_advertising_interval_min=round(80*ADVERTISING_SLOWDOWN_FACTOR),
|
||||
@@ -331,3 +348,10 @@ if __name__ == "__main__":
|
||||
global_conf,
|
||||
bigs
|
||||
)
|
||||
|
||||
# TODO: possible inputs:
|
||||
# wav file locally
|
||||
# precoded lc3 file locally
|
||||
# realtime audio locally
|
||||
# realtime audio network lc3 coded
|
||||
# (realtime audio network uncoded)
|
||||
Reference in New Issue
Block a user