1# Copyright 2021-2023 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15 16# ----------------------------------------------------------------------------- 17# Imports 18# ----------------------------------------------------------------------------- 19from __future__ import annotations 20 21from bumble import gatt 22from bumble import gatt_client 23from bumble.profiles import csip 24 25 26# ----------------------------------------------------------------------------- 27# Server 28# ----------------------------------------------------------------------------- 29class CommonAudioServiceService(gatt.TemplateService): 30 UUID = gatt.GATT_COMMON_AUDIO_SERVICE 31 32 def __init__( 33 self, 34 coordinated_set_identification_service: csip.CoordinatedSetIdentificationService, 35 ) -> None: 36 self.coordinated_set_identification_service = ( 37 coordinated_set_identification_service 38 ) 39 super().__init__( 40 characteristics=[], 41 included_services=[coordinated_set_identification_service], 42 ) 43 44 45# ----------------------------------------------------------------------------- 46# Client 47# ----------------------------------------------------------------------------- 48class CommonAudioServiceServiceProxy(gatt_client.ProfileServiceProxy): 49 SERVICE_CLASS = CommonAudioServiceService 50 51 def __init__(self, service_proxy: gatt_client.ServiceProxy) -> None: 52 self.service_proxy = service_proxy 53