From 9dd814f32e9ee85f73674b50daf92527bdc6dfdc Mon Sep 17 00:00:00 2001 From: Gilles Boccon-Gibod Date: Mon, 12 Aug 2024 08:20:36 -0700 Subject: [PATCH] strict compliance check --- bumble/profiles/tmap.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/bumble/profiles/tmap.py b/bumble/profiles/tmap.py index fd95ec3..7b65015 100644 --- a/bumble/profiles/tmap.py +++ b/bumble/profiles/tmap.py @@ -20,12 +20,12 @@ import enum import logging import struct -from typing import Optional from bumble.gatt import ( TemplateService, Characteristic, DelegatedCharacteristicAdapter, + InvalidServiceError, GATT_TELEPHONY_AND_MEDIA_AUDIO_SERVICE, GATT_TMAP_ROLE_CHARACTERISTIC, ) @@ -69,19 +69,21 @@ class TelephonyAndMediaAudioService(TemplateService): class TelephonyAndMediaAudioServiceProxy(ProfileServiceProxy): SERVICE_CLASS = TelephonyAndMediaAudioService - role: Optional[DelegatedCharacteristicAdapter] + role: DelegatedCharacteristicAdapter def __init__(self, service_proxy: ServiceProxy): self.service_proxy = service_proxy - if characteristics := service_proxy.get_characteristics_by_uuid( - GATT_TMAP_ROLE_CHARACTERISTIC - ): - self.role = DelegatedCharacteristicAdapter( - characteristics[0], - decode=lambda value: Role( - struct.unpack_from('