11/*
22 * BlueALSA - bluez.c
3- * SPDX-FileCopyrightText: 2016-2025 BlueALSA developers
3+ * SPDX-FileCopyrightText: 2016-2026 BlueALSA developers
44 * SPDX-License-Identifier: MIT
55 */
66
3939#include "ba-transport-pcm.h"
4040#include "bluealsa-dbus.h"
4141#include "bluez-iface.h"
42- #if ENABLE_MIDI
43- # include "bluez-midi.h"
44- #endif
42+ #include "bt-asha.h"
43+ #include "bt-midi.h"
4544#include "dbus.h"
4645#include "error.h"
4746#include "hci.h"
@@ -83,18 +82,22 @@ struct bluez_dbus_object_data {
8382/**
8483 * BlueALSA copy of BlueZ adapter data. */
8584struct bluez_adapter {
86- /* reference to the adapter structure */
87- struct ba_adapter * adapter ;
88- /* manager for media endpoint objects */
89- GDBusObjectManagerServer * manager_media_application ;
90- /* manager for battery provider objects */
91- GDBusObjectManagerServer * manager_battery_provider ;
85+ /* Reference to the adapter structure. */
86+ struct ba_adapter * adapter ;
87+ /* Manager for media endpoint objects. */
88+ GDBusObjectManagerServer * manager_media_application ;
89+ /* Manager for battery provider objects. */
90+ GDBusObjectManagerServer * manager_battery_provider ;
91+ #if ENABLE_ASHA
92+ /* Bluetooth ASHA based on BlueZ GATT application. */
93+ BluetoothASHA * asha ;
94+ #endif
9295#if ENABLE_MIDI
9396 /* Bluetooth LE MIDI based on BlueZ GATT application. */
9497 BluetoothMIDI * midi ;
9598#endif
96- /* array of SEP configs per connected devices */
97- GHashTable * device_sep_configs_map ;
99+ /* Array of SEP configs per connected devices. */
100+ GHashTable * device_sep_configs_map ;
98101};
99102
100103static pthread_mutex_t bluez_mutex = PTHREAD_MUTEX_INITIALIZER ;
@@ -222,6 +225,14 @@ static void bluez_adapter_register_media_application(
222225 * to be available on the given adapter. */
223226static void bluez_adapter_register_gatt_applications (
224227 G_GNUC_UNUSED struct bluez_adapter * b_adapter ) {
228+ #if ENABLE_ASHA
229+ if (config .profile .asha_sink ) {
230+ char path [64 ];
231+ struct ba_adapter * a = b_adapter -> adapter ;
232+ snprintf (path , sizeof (path ), "/org/bluez/%s/ASHA" , a -> hci .name );
233+ b_adapter -> asha = bluetooth_asha_new (a , path );
234+ }
235+ #endif
225236#if ENABLE_MIDI
226237 if (config .profile .midi ) {
227238 char path [64 ];
@@ -236,6 +247,9 @@ static void bluez_adapter_free(
236247 struct bluez_adapter * b_adapter ) {
237248 if (b_adapter -> adapter == NULL )
238249 return ;
250+ #if ENABLE_ASHA
251+ g_clear_object (& b_adapter -> asha );
252+ #endif
239253#if ENABLE_MIDI
240254 g_clear_object (& b_adapter -> midi );
241255#endif
@@ -1294,9 +1308,9 @@ static void bluez_media_endpoint_process_asha(
12941308 goto fail ;
12951309 }
12961310
1297- /* Make sure that HiSyncId size is valid. */
1311+ /* Make sure that HiSync ID size is valid. */
12981312 if (id_size != sizeof (asha_hi_sync_id_t )) {
1299- error ("Invalid HiSyncId size: %zu != %zu" , id_size , sizeof (asha_hi_sync_id_t ));
1313+ error ("Invalid HiSync ID size: %zu != %zu" , id_size , sizeof (asha_hi_sync_id_t ));
13001314 goto fail ;
13011315 }
13021316
0 commit comments