feat: Set agent capability to NoInputNoOutput and define service UUIDs

This commit is contained in:
2025-12-30 22:00:43 +00:00
committed by Tanner Collin (aider)
parent 2e68948f09
commit f8c09124a4

View File

@@ -28,7 +28,9 @@ AGENT_IFACE = 'org.bluez.Agent1'
AGENT_MANAGER_IFACE = 'org.bluez.AgentManager1' AGENT_MANAGER_IFACE = 'org.bluez.AgentManager1'
AGENT_PATH = '/io/bluetooth_speaker/agent' AGENT_PATH = '/io/bluetooth_speaker/agent'
CAPABILITY = 'DisplayYesNo' CAPABILITY = 'DisplayYesNo'
HFP_UUID = '0000111e-0000-1000-8000-00805f9b34fb' CAPABILITY = 'NoInputNoOutput'
CALLS_SERVICE_UUID = '0000111e-0000-1000-8000-00805f9b34fb'
AUDIO_SERVICE_UUID = '0000110d-0000-1000-8000-00805f9b34fb'
class Agent(ServiceInterface): class Agent(ServiceInterface):
def __init__(self, interface_name): def __init__(self, interface_name):
@@ -72,7 +74,7 @@ class Agent(ServiceInterface):
@method() @method()
def AuthorizeService(self, device: 'o', uuid: 's'): def AuthorizeService(self, device: 'o', uuid: 's'):
logging.info(f"AuthorizeService request for device {device} with UUID {uuid}") logging.info(f"AuthorizeService request for device {device} with UUID {uuid}")
if uuid.lower() == HFP_UUID: if uuid.lower() == CALLS_SERVICE_UUID:
logging.warning("Rejecting Hands-Free Profile (HFP) connection.") logging.warning("Rejecting Hands-Free Profile (HFP) connection.")
raise DBusError('org.bluez.Error.Rejected', 'HFP profile not supported') raise DBusError('org.bluez.Error.Rejected', 'HFP profile not supported')
logging.info(f"Authorizing service UUID {uuid}") logging.info(f"Authorizing service UUID {uuid}")