diff --git a/bumble/profiles/gmap.py b/bumble/profiles/gmap.py index 648b7261..ef42b8eb 100644 --- a/bumble/profiles/gmap.py +++ b/bumble/profiles/gmap.py @@ -101,7 +101,7 @@ class GamingAudioService(TemplateService): ) characteristics.append(self.gmap_role) - if ugg_features is not None: + if gmap_role & GmapRole.UNICAST_GAME_GATEWAY: self.ugg_features = Characteristic( uuid=GATT_UGG_FEATURES_CHARACTERISTIC, properties=Characteristic.Properties.READ, @@ -110,7 +110,7 @@ class GamingAudioService(TemplateService): ) characteristics.append(self.ugg_features) - if ugt_features is not None: + if gmap_role & GmapRole.UNICAST_GAME_TERMINAL: self.ugt_features = Characteristic( uuid=GATT_UGT_FEATURES_CHARACTERISTIC, properties=Characteristic.Properties.READ, @@ -119,7 +119,7 @@ class GamingAudioService(TemplateService): ) characteristics.append(self.ugt_features) - if bgs_features is not None: + if gmap_role & GmapRole.BROADCAST_GAME_SENDER: self.bgs_features = Characteristic( uuid=GATT_BGS_FEATURES_CHARACTERISTIC, properties=Characteristic.Properties.READ, @@ -128,7 +128,7 @@ class GamingAudioService(TemplateService): ) characteristics.append(self.bgs_features) - if bgr_features is not None: + if gmap_role & GmapRole.BROADCAST_GAME_RECEIVER: self.bgr_features = Characteristic( uuid=GATT_BGR_FEATURES_CHARACTERISTIC, properties=Characteristic.Properties.READ, diff --git a/tests/gmap_test.py b/tests/gmap_test.py index 36308881..7e48c232 100644 --- a/tests/gmap_test.py +++ b/tests/gmap_test.py @@ -36,7 +36,10 @@ from .test_utils import TwoDevices # Tests # ----------------------------------------------------------------------------- gmas_service = GamingAudioService( - gmap_role=GmapRole.UNICAST_GAME_GATEWAY, + gmap_role=GmapRole.UNICAST_GAME_GATEWAY + | GmapRole.UNICAST_GAME_TERMINAL + | GmapRole.BROADCAST_GAME_RECEIVER + | GmapRole.BROADCAST_GAME_SENDER, ugg_features=UggFeatures.UGG_MULTISINK, ugt_features=UgtFeatures.UGT_SOURCE, bgr_features=BgrFeatures.BGR_MULTISINK, @@ -68,7 +71,13 @@ async def gmap_client(): # ----------------------------------------------------------------------------- @pytest.mark.asyncio async def test_init_service(gmap_client: GamingAudioServiceProxy): - assert await gmap_client.gmap_role.read_value() == GmapRole.UNICAST_GAME_GATEWAY + assert ( + await gmap_client.gmap_role.read_value() + == GmapRole.UNICAST_GAME_GATEWAY + | GmapRole.UNICAST_GAME_TERMINAL + | GmapRole.BROADCAST_GAME_RECEIVER + | GmapRole.BROADCAST_GAME_SENDER + ) assert await gmap_client.ugg_features.read_value() == UggFeatures.UGG_MULTISINK assert await gmap_client.ugt_features.read_value() == UgtFeatures.UGT_SOURCE assert await gmap_client.bgr_features.read_value() == BgrFeatures.BGR_MULTISINK