Fix: Make AuthorizeService async to handle D-Bus rejections; correct CAPABILITY
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
3
main.py
3
main.py
@@ -28,7 +28,6 @@ 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'
|
||||||
CAPABILITY = 'NoInputNoOutput'
|
|
||||||
CALLS_SERVICE_UUID = '0000111e-0000-1000-8000-00805f9b34fb'
|
CALLS_SERVICE_UUID = '0000111e-0000-1000-8000-00805f9b34fb'
|
||||||
AUDIO_SERVICE_UUID = '0000110d-0000-1000-8000-00805f9b34fb'
|
AUDIO_SERVICE_UUID = '0000110d-0000-1000-8000-00805f9b34fb'
|
||||||
|
|
||||||
@@ -72,7 +71,7 @@ class Agent(ServiceInterface):
|
|||||||
asyncio.create_task(trust_and_connect_device(device))
|
asyncio.create_task(trust_and_connect_device(device))
|
||||||
|
|
||||||
@method()
|
@method()
|
||||||
def AuthorizeService(self, device: 'o', uuid: 's'):
|
async 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() == CALLS_SERVICE_UUID:
|
if uuid.lower() == CALLS_SERVICE_UUID:
|
||||||
logging.warning("Rejecting Hands-Free Profile (HFP) connection.")
|
logging.warning("Rejecting Hands-Free Profile (HFP) connection.")
|
||||||
|
|||||||
Reference in New Issue
Block a user