Loading pandora/interfaces/pandora_experimental/dck.proto 0 → 100644 +26 −0 Original line number Diff line number Diff line // Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. syntax = "proto3"; option java_outer_classname = "DckProto"; package pandora; import "google/protobuf/empty.proto"; service Dck { // Register DCK Service. rpc Register(google.protobuf.Empty) returns (google.protobuf.Empty); } No newline at end of file pandora/interfaces/python/Android.bp +5 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,10 @@ genrule { "pandora_experimental/avrcp_grpc_aio.py", "pandora_experimental/avrcp_pb2.py", "pandora_experimental/avrcp_pb2.pyi", "pandora_experimental/dck_grpc.py", "pandora_experimental/dck_grpc_aio.py", "pandora_experimental/dck_pb2.py", "pandora_experimental/dck_pb2.pyi", "pandora_experimental/gatt_grpc.py", "pandora_experimental/gatt_grpc_aio.py", "pandora_experimental/gatt_pb2.py", Loading Loading @@ -97,6 +101,7 @@ filegroup { srcs: [ ":pandora_experimental-python-gen-src{pandora_experimental/asha_pb2.pyi}", ":pandora_experimental-python-gen-src{pandora_experimental/avrcp_pb2.pyi}", ":pandora_experimental-python-gen-src{pandora_experimental/dck_pb2.pyi}", ":pandora_experimental-python-gen-src{pandora_experimental/gatt_pb2.pyi}", ":pandora_experimental-python-gen-src{pandora_experimental/hfp_pb2.pyi}", ":pandora_experimental-python-gen-src{pandora_experimental/hid_pb2.pyi}", Loading pandora/server/bumble_experimental/dck.py +26 −0 Original line number Diff line number Diff line Loading @@ -12,13 +12,19 @@ # See the License for the specific language governing permissions and # limitations under the License. import grpc import logging from bumble.core import UUID as BumbleUUID, AdvertisingData from bumble.device import Device from bumble.gatt import TemplateService, Characteristic, CharacteristicValue from bumble.pandora import utils from bumble.l2cap import Channel from google.protobuf.empty_pb2 import Empty from pandora_experimental.dck_grpc_aio import DckServicer from typing import Optional class DckGattService(TemplateService): CCC_DK_UUID: BumbleUUID = BumbleUUID.from_16_bits(0xFFF5, 'Car Connectivity Consortium, LLC') Loading Loading @@ -75,3 +81,23 @@ class DckGattService(TemplateService): # 19.2 LE Procedures AdvData field of ADV_IND return bytes(AdvertisingData([(AdvertisingData.SERVICE_DATA_16_BIT_UUID, bytes(DckGattService.CCC_DK_UUID))])) class DckService(DckServicer): device: Device dck_gatt_service: Optional[DckGattService] def __init__(self, device: Device) -> None: self.log = utils.BumbleServerLoggerAdapter(logging.getLogger(), {"service_name": "Dck", "device": device}) self.device = device self.dck_gatt_service = None @utils.rpc def Register(self, request: Empty, context: grpc.ServicerContext) -> Empty: logging.info("Register") if not self.dck_gatt_service: self.dck_gatt_service = DckGattService(self.device) self.device.add_service(self.dck_gatt_service) # type: ignore[no-untyped-call] return Empty() Loading
pandora/interfaces/pandora_experimental/dck.proto 0 → 100644 +26 −0 Original line number Diff line number Diff line // Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. syntax = "proto3"; option java_outer_classname = "DckProto"; package pandora; import "google/protobuf/empty.proto"; service Dck { // Register DCK Service. rpc Register(google.protobuf.Empty) returns (google.protobuf.Empty); } No newline at end of file
pandora/interfaces/python/Android.bp +5 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,10 @@ genrule { "pandora_experimental/avrcp_grpc_aio.py", "pandora_experimental/avrcp_pb2.py", "pandora_experimental/avrcp_pb2.pyi", "pandora_experimental/dck_grpc.py", "pandora_experimental/dck_grpc_aio.py", "pandora_experimental/dck_pb2.py", "pandora_experimental/dck_pb2.pyi", "pandora_experimental/gatt_grpc.py", "pandora_experimental/gatt_grpc_aio.py", "pandora_experimental/gatt_pb2.py", Loading Loading @@ -97,6 +101,7 @@ filegroup { srcs: [ ":pandora_experimental-python-gen-src{pandora_experimental/asha_pb2.pyi}", ":pandora_experimental-python-gen-src{pandora_experimental/avrcp_pb2.pyi}", ":pandora_experimental-python-gen-src{pandora_experimental/dck_pb2.pyi}", ":pandora_experimental-python-gen-src{pandora_experimental/gatt_pb2.pyi}", ":pandora_experimental-python-gen-src{pandora_experimental/hfp_pb2.pyi}", ":pandora_experimental-python-gen-src{pandora_experimental/hid_pb2.pyi}", Loading
pandora/server/bumble_experimental/dck.py +26 −0 Original line number Diff line number Diff line Loading @@ -12,13 +12,19 @@ # See the License for the specific language governing permissions and # limitations under the License. import grpc import logging from bumble.core import UUID as BumbleUUID, AdvertisingData from bumble.device import Device from bumble.gatt import TemplateService, Characteristic, CharacteristicValue from bumble.pandora import utils from bumble.l2cap import Channel from google.protobuf.empty_pb2 import Empty from pandora_experimental.dck_grpc_aio import DckServicer from typing import Optional class DckGattService(TemplateService): CCC_DK_UUID: BumbleUUID = BumbleUUID.from_16_bits(0xFFF5, 'Car Connectivity Consortium, LLC') Loading Loading @@ -75,3 +81,23 @@ class DckGattService(TemplateService): # 19.2 LE Procedures AdvData field of ADV_IND return bytes(AdvertisingData([(AdvertisingData.SERVICE_DATA_16_BIT_UUID, bytes(DckGattService.CCC_DK_UUID))])) class DckService(DckServicer): device: Device dck_gatt_service: Optional[DckGattService] def __init__(self, device: Device) -> None: self.log = utils.BumbleServerLoggerAdapter(logging.getLogger(), {"service_name": "Dck", "device": device}) self.device = device self.dck_gatt_service = None @utils.rpc def Register(self, request: Empty, context: grpc.ServicerContext) -> Empty: logging.info("Register") if not self.dck_gatt_service: self.dck_gatt_service = DckGattService(self.device) self.device.add_service(self.dck_gatt_service) # type: ignore[no-untyped-call] return Empty()