-- cgit v1.2.3 From a4384bca1bb60592efb54c33b445aed08f1b1f0b Mon Sep 17 00:00:00 2001 From: Charlie Boutier Date: Tue, 5 Oct 2021 16:35:16 +0000 Subject: interact: fundation Change-Id: If5ee695f46ce84e5fca6c54a9399e8ee008a5840 --- .gitignore | 3 + __init__.py | 0 build.sh | 18 + interact/__init__.py | 9 + interact/l2cap.py | 59 +++ lib/__init__.py | 0 lib/proto/__init__.py | 0 lib/proto/common_pb2.py | 304 +++++++++++ lib/proto/common_pb2_grpc.py | 4 + lib/proto/l2cap_pb2.py | 1017 +++++++++++++++++++++++++++++++++++++ lib/proto/l2cap_pb2_grpc.py | 533 +++++++++++++++++++ lib/proto/neighbor_pb2.py | 481 ++++++++++++++++++ lib/proto/neighbor_pb2_grpc.py | 267 ++++++++++ lib/proto/rootservice_pb2.py | 288 +++++++++++ lib/proto/rootservice_pb2_grpc.py | 161 ++++++ proto/common.proto | 37 ++ proto/l2cap.proto | 129 +++++ proto/neighbor.proto | 61 +++ proto/rootservice.proto | 32 ++ 19 files changed, 3403 insertions(+) create mode 100644 .gitignore create mode 100644 __init__.py create mode 100755 build.sh create mode 100644 interact/__init__.py create mode 100644 interact/l2cap.py create mode 100644 lib/__init__.py create mode 100644 lib/proto/__init__.py create mode 100644 lib/proto/common_pb2.py create mode 100644 lib/proto/common_pb2_grpc.py create mode 100644 lib/proto/l2cap_pb2.py create mode 100644 lib/proto/l2cap_pb2_grpc.py create mode 100644 lib/proto/neighbor_pb2.py create mode 100644 lib/proto/neighbor_pb2_grpc.py create mode 100644 lib/proto/rootservice_pb2.py create mode 100644 lib/proto/rootservice_pb2_grpc.py create mode 100644 proto/common.proto create mode 100644 proto/l2cap.proto create mode 100644 proto/neighbor.proto create mode 100644 proto/rootservice.proto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bbf3300 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +virtualenv +out/ +__pycache__ \ No newline at end of file diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..d645542 --- /dev/null +++ b/build.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +PYTHON_OUT="lib" +PROTO_FOLDER="proto" + +mkdir ${PYTHON_OUT} + +python3 -m grpc_tools.protoc \ + -I . \ + --python_out=${PYTHON_OUT} \ + --grpc_python_out=${PYTHON_OUT} \ + "${PROTO_FOLDER}/l2cap.proto" \ + "${PROTO_FOLDER}/neighbor.proto" \ + "${PROTO_FOLDER}/common.proto" \ + "${PROTO_FOLDER}/rootservice.proto" + +touch "${PYTHON_OUT}/__init__.py" +touch "${PYTHON_OUT}/proto/__init__.py" \ No newline at end of file diff --git a/interact/__init__.py b/interact/__init__.py new file mode 100644 index 0000000..9b5830a --- /dev/null +++ b/interact/__init__.py @@ -0,0 +1,9 @@ +import grpc +from . import l2cap + +GRPC_PORT = 8999 + +def run(profile: str, interaction_id: str, pts_addr: bytes): + channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') + if profile == "L2CAP": + l2cap.interact(channel, interaction_id, pts_addr) \ No newline at end of file diff --git a/interact/l2cap.py b/interact/l2cap.py new file mode 100644 index 0000000..c31e042 --- /dev/null +++ b/interact/l2cap.py @@ -0,0 +1,59 @@ +import os + +from grpc import Channel +from lib.proto import l2cap_pb2_grpc +from lib.proto import neighbor_pb2_grpc + +from lib.proto.common_pb2 import BluetoothAddress +from lib.proto.l2cap_pb2 import CloseChannelRequest, OpenChannelRequest, SetEnableDynamicChannelRequest, RetransmissionFlowControlMode, DynamicChannelPacket, OpenChannelRequest +from lib.proto.neighbor_pb2 import EnableMsg +PSM = 1 # TODO: Add it to either utils.py or config file + + +def interact(channel: Channel, interaction_id: str, pts_addr: bytes): + print(f'mmi_id: {interaction_id}') + addr = BluetoothAddress(address=pts_addr) + l2cap = l2cap_pb2_grpc.L2capClassicModuleFacadeStub(channel) + neighbor = neighbor_pb2_grpc.NeighborFacadeStub(channel) + if interaction_id == "MMI_TESTER_ENABLE_CONNECTION": + neighbor.EnablePageScan(EnableMsg(enabled=True)) + l2cap.SetDynamicChannel( + SetEnableDynamicChannelRequest( + psm=PSM, + enable=True, + retransmission_mode=RetransmissionFlowControlMode.BASIC + ) + ) + if interaction_id == "MMI_IUT_SEND_CONFIG_REQ": + pass + if interaction_id == "MMI_IUT_SEND_L2CAP_DATA": + payload = b'\x00' + os.urandom(40) + b'\x00' + l2cap.SendDynamicChannelPacket( + DynamicChannelPacket( + remote=addr, + psm=PSM, + payload=payload + ) + ) + if interaction_id == "MMI_IUT_INITIATE_ACL_CONNECTION": + l2cap.SetDynamicChannel( + SetEnableDynamicChannelRequest( + psm=PSM, + enable=True, + retransmission_mode=RetransmissionFlowControlMode.BASIC + ) + ) + l2cap.OpenChannel( + OpenChannelRequest( + remote=addr, + psm=PSM, + mode=RetransmissionFlowControlMode.BASIC + ) + ) + if interaction_id == ("MMI_IUT_DISABLE_CONNECTION" or "MMI_IUT_SEND_DISCONNECT_RSP"): + print(f'Sending CLOSE CHANNEL') + l2cap.CloseChannel(CloseChannelRequest(psm=PSM)) + if interaction_id == "MMI_IUT_SEND_ACL_DISCONNECTON": + pass + if interaction_id == "MMI_IUT_SEND_CONFIG_RSP": + pass diff --git a/lib/__init__.py b/lib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/lib/proto/__init__.py b/lib/proto/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/lib/proto/common_pb2.py b/lib/proto/common_pb2.py new file mode 100644 index 0000000..6d55382 --- /dev/null +++ b/lib/proto/common_pb2.py @@ -0,0 +1,304 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proto/common.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='proto/common.proto', + package='bluetooth.facade', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x12proto/common.proto\x12\x10\x62luetooth.facade\"\x07\n\x05\x45mpty\"\x17\n\x04\x44\x61ta\x12\x0f\n\x07payload\x18\x01 \x01(\x0c\"#\n\x10\x42luetoothAddress\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0c\"\x89\x01\n\x18\x42luetoothAddressWithType\x12\x33\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\".bluetooth.facade.BluetoothAddress\x12\x38\n\x04type\x18\x02 \x01(\x0e\x32*.bluetooth.facade.BluetoothAddressTypeEnum*\x8a\x01\n\x18\x42luetoothAddressTypeEnum\x12\x19\n\x15PUBLIC_DEVICE_ADDRESS\x10\x00\x12\x19\n\x15RANDOM_DEVICE_ADDRESS\x10\x01\x12\x1b\n\x17PUBLIC_IDENTITY_ADDRESS\x10\x02\x12\x1b\n\x17RANDOM_IDENTITY_ADDRESS\x10\x03*\x9f\x01\n\x1b\x42luetoothOwnAddressTypeEnum\x12\x1d\n\x19USE_PUBLIC_DEVICE_ADDRESS\x10\x00\x12\x1d\n\x19USE_RANDOM_DEVICE_ADDRESS\x10\x01\x12 \n\x1cRESOLVABLE_OR_PUBLIC_ADDRESS\x10\x02\x12 \n\x1cRESOLVABLE_OR_RANDOM_ADDRESS\x10\x03*l\n\x1c\x42luetoothPeerAddressTypeEnum\x12%\n!PUBLIC_DEVICE_OR_IDENTITY_ADDRESS\x10\x00\x12%\n!RANDOM_DEVICE_OR_IDENTITY_ADDRESS\x10\x01\x62\x06proto3' +) + +_BLUETOOTHADDRESSTYPEENUM = _descriptor.EnumDescriptor( + name='BluetoothAddressTypeEnum', + full_name='bluetooth.facade.BluetoothAddressTypeEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='PUBLIC_DEVICE_ADDRESS', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='RANDOM_DEVICE_ADDRESS', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='PUBLIC_IDENTITY_ADDRESS', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='RANDOM_IDENTITY_ADDRESS', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=252, + serialized_end=390, +) +_sym_db.RegisterEnumDescriptor(_BLUETOOTHADDRESSTYPEENUM) + +BluetoothAddressTypeEnum = enum_type_wrapper.EnumTypeWrapper(_BLUETOOTHADDRESSTYPEENUM) +_BLUETOOTHOWNADDRESSTYPEENUM = _descriptor.EnumDescriptor( + name='BluetoothOwnAddressTypeEnum', + full_name='bluetooth.facade.BluetoothOwnAddressTypeEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='USE_PUBLIC_DEVICE_ADDRESS', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='USE_RANDOM_DEVICE_ADDRESS', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='RESOLVABLE_OR_PUBLIC_ADDRESS', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='RESOLVABLE_OR_RANDOM_ADDRESS', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=393, + serialized_end=552, +) +_sym_db.RegisterEnumDescriptor(_BLUETOOTHOWNADDRESSTYPEENUM) + +BluetoothOwnAddressTypeEnum = enum_type_wrapper.EnumTypeWrapper(_BLUETOOTHOWNADDRESSTYPEENUM) +_BLUETOOTHPEERADDRESSTYPEENUM = _descriptor.EnumDescriptor( + name='BluetoothPeerAddressTypeEnum', + full_name='bluetooth.facade.BluetoothPeerAddressTypeEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='PUBLIC_DEVICE_OR_IDENTITY_ADDRESS', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='RANDOM_DEVICE_OR_IDENTITY_ADDRESS', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=554, + serialized_end=662, +) +_sym_db.RegisterEnumDescriptor(_BLUETOOTHPEERADDRESSTYPEENUM) + +BluetoothPeerAddressTypeEnum = enum_type_wrapper.EnumTypeWrapper(_BLUETOOTHPEERADDRESSTYPEENUM) +PUBLIC_DEVICE_ADDRESS = 0 +RANDOM_DEVICE_ADDRESS = 1 +PUBLIC_IDENTITY_ADDRESS = 2 +RANDOM_IDENTITY_ADDRESS = 3 +USE_PUBLIC_DEVICE_ADDRESS = 0 +USE_RANDOM_DEVICE_ADDRESS = 1 +RESOLVABLE_OR_PUBLIC_ADDRESS = 2 +RESOLVABLE_OR_RANDOM_ADDRESS = 3 +PUBLIC_DEVICE_OR_IDENTITY_ADDRESS = 0 +RANDOM_DEVICE_OR_IDENTITY_ADDRESS = 1 + + + +_EMPTY = _descriptor.Descriptor( + name='Empty', + full_name='bluetooth.facade.Empty', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=40, + serialized_end=47, +) + + +_DATA = _descriptor.Descriptor( + name='Data', + full_name='bluetooth.facade.Data', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='payload', full_name='bluetooth.facade.Data.payload', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=49, + serialized_end=72, +) + + +_BLUETOOTHADDRESS = _descriptor.Descriptor( + name='BluetoothAddress', + full_name='bluetooth.facade.BluetoothAddress', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='address', full_name='bluetooth.facade.BluetoothAddress.address', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=74, + serialized_end=109, +) + + +_BLUETOOTHADDRESSWITHTYPE = _descriptor.Descriptor( + name='BluetoothAddressWithType', + full_name='bluetooth.facade.BluetoothAddressWithType', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='address', full_name='bluetooth.facade.BluetoothAddressWithType.address', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='type', full_name='bluetooth.facade.BluetoothAddressWithType.type', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=112, + serialized_end=249, +) + +_BLUETOOTHADDRESSWITHTYPE.fields_by_name['address'].message_type = _BLUETOOTHADDRESS +_BLUETOOTHADDRESSWITHTYPE.fields_by_name['type'].enum_type = _BLUETOOTHADDRESSTYPEENUM +DESCRIPTOR.message_types_by_name['Empty'] = _EMPTY +DESCRIPTOR.message_types_by_name['Data'] = _DATA +DESCRIPTOR.message_types_by_name['BluetoothAddress'] = _BLUETOOTHADDRESS +DESCRIPTOR.message_types_by_name['BluetoothAddressWithType'] = _BLUETOOTHADDRESSWITHTYPE +DESCRIPTOR.enum_types_by_name['BluetoothAddressTypeEnum'] = _BLUETOOTHADDRESSTYPEENUM +DESCRIPTOR.enum_types_by_name['BluetoothOwnAddressTypeEnum'] = _BLUETOOTHOWNADDRESSTYPEENUM +DESCRIPTOR.enum_types_by_name['BluetoothPeerAddressTypeEnum'] = _BLUETOOTHPEERADDRESSTYPEENUM +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +Empty = _reflection.GeneratedProtocolMessageType('Empty', (_message.Message,), { + 'DESCRIPTOR' : _EMPTY, + '__module__' : 'proto.common_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.facade.Empty) + }) +_sym_db.RegisterMessage(Empty) + +Data = _reflection.GeneratedProtocolMessageType('Data', (_message.Message,), { + 'DESCRIPTOR' : _DATA, + '__module__' : 'proto.common_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.facade.Data) + }) +_sym_db.RegisterMessage(Data) + +BluetoothAddress = _reflection.GeneratedProtocolMessageType('BluetoothAddress', (_message.Message,), { + 'DESCRIPTOR' : _BLUETOOTHADDRESS, + '__module__' : 'proto.common_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.facade.BluetoothAddress) + }) +_sym_db.RegisterMessage(BluetoothAddress) + +BluetoothAddressWithType = _reflection.GeneratedProtocolMessageType('BluetoothAddressWithType', (_message.Message,), { + 'DESCRIPTOR' : _BLUETOOTHADDRESSWITHTYPE, + '__module__' : 'proto.common_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.facade.BluetoothAddressWithType) + }) +_sym_db.RegisterMessage(BluetoothAddressWithType) + + +# @@protoc_insertion_point(module_scope) diff --git a/lib/proto/common_pb2_grpc.py b/lib/proto/common_pb2_grpc.py new file mode 100644 index 0000000..2daafff --- /dev/null +++ b/lib/proto/common_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/lib/proto/l2cap_pb2.py b/lib/proto/l2cap_pb2.py new file mode 100644 index 0000000..f0bdde7 --- /dev/null +++ b/lib/proto/l2cap_pb2.py @@ -0,0 +1,1017 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proto/l2cap.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from . import common_pb2 as proto_dot_common__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='proto/l2cap.proto', + package='bluetooth.l2cap.classic', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x11proto/l2cap.proto\x12\x17\x62luetooth.l2cap.classic\x1a\x12proto/common.proto\"\xae\x01\n\"LinkSecurityInterfaceCallbackEvent\x12\x33\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\".bluetooth.facade.BluetoothAddress\x12S\n\nevent_type\x18\x02 \x01(\x0e\x32?.bluetooth.l2cap.classic.LinkSecurityInterfaceCallbackEventType\")\n\x16RegisterChannelRequest\x12\x0f\n\x07\x63hannel\x18\x01 \x01(\r\"M\n\x17\x43onnectionCompleteEvent\x12\x32\n\x06remote\x18\x01 \x01(\x0b\x32\".bluetooth.facade.BluetoothAddress\"Z\n\x14\x43onnectionCloseEvent\x12\x32\n\x06remote\x18\x01 \x01(\x0b\x32\".bluetooth.facade.BluetoothAddress\x12\x0e\n\x06reason\x18\x02 \x01(\r\"\x9b\x01\n\x12OpenChannelRequest\x12\x32\n\x06remote\x18\x01 \x01(\x0b\x32\".bluetooth.facade.BluetoothAddress\x12\x0b\n\x03psm\x18\x02 \x01(\r\x12\x44\n\x04mode\x18\x03 \x01(\x0e\x32\x36.bluetooth.l2cap.classic.RetransmissionFlowControlMode\"\"\n\x13\x43loseChannelRequest\x12\x0b\n\x03psm\x18\x01 \x01(\r\"`\n\x12\x43hannelSignalEvent\x12\x0b\n\x03\x63id\x18\x01 \x01(\r\x12=\n\x04type\x18\x02 \x01(\x0e\x32/.bluetooth.l2cap.classic.ChannelSignalEventType\"`\n\x15SendL2capPacketResult\x12G\n\x0bresult_type\x18\x01 \x01(\x0e\x32\x32.bluetooth.l2cap.classic.SendL2capPacketResultType\"R\n\x0bL2capPacket\x12\r\n\x03psm\x18\x01 \x01(\rH\x00\x12\x13\n\tfixed_cid\x18\x02 \x01(\rH\x00\x12\x0f\n\x07payload\x18\x03 \x01(\x0c\x42\x0e\n\x0c\x63hannel_type\"\x92\x01\n\x1eSetEnableDynamicChannelRequest\x12\x0b\n\x03psm\x18\x01 \x01(\r\x12\x0e\n\x06\x65nable\x18\x02 \x01(\x08\x12S\n\x13retransmission_mode\x18\x03 \x01(\x0e\x32\x36.bluetooth.l2cap.classic.RetransmissionFlowControlMode\"h\n\x14\x44ynamicChannelPacket\x12\x32\n\x06remote\x18\x01 \x01(\x0b\x32\".bluetooth.facade.BluetoothAddress\x12\x0b\n\x03psm\x18\x02 \x01(\r\x12\x0f\n\x07payload\x18\x03 \x01(\x0c\"6\n\x17SetTrafficPausedRequest\x12\x0e\n\x06paused\x18\x01 \x01(\x08\x12\x0b\n\x03psm\x18\x02 \x01(\r\",\n\x1cGetChannelQueueDepthResponse\x12\x0c\n\x04size\x18\x01 \x01(\r*\xd0\x01\n&LinkSecurityInterfaceCallbackEventType\x12\x10\n\x0cON_CONNECTED\x10\x00\x12\x13\n\x0fON_DISCONNECTED\x10\x01\x12\x1e\n\x1aON_AUTHENTICATION_COMPLETE\x10\x02\x12\x18\n\x14ON_ENCRYPTION_CHANGE\x10\x03\x12\x1f\n\x1bON_READ_REMOTE_VERSION_INFO\x10\x04\x12$\n ON_READ_REMOTE_EXTENDED_FEATURES\x10\x05*G\n\x1dRetransmissionFlowControlMode\x12\t\n\x05\x42\x41SIC\x10\x00\x12\x08\n\x04\x45RTM\x10\x01\x12\x11\n\rERTM_OPTIONAL\x10\x02*<\n\x16\x43hannelSignalEventType\x12\x08\n\x04OPEN\x10\x00\x12\t\n\x05\x43LOSE\x10\x01\x12\r\n\tCONFIGURE\x10\x02*0\n\x19SendL2capPacketResultType\x12\x06\n\x02OK\x10\x00\x12\x0b\n\x07\x42\x41\x44_CID\x10\x01*\x9e\x01\n\x15\x43lassicSecurityPolicy\x12\x17\n\x13\x45NCRYPTED_TRANSPORT\x10\x00\x12%\n!AUTHENTICATED_ENCRYPTED_TRANSPORT\x10\x01\x12\x08\n\x04\x42\x45ST\x10\x02\x12;\n7_SDP_ONLY_NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK\x10\x03\x32\xc6\x0b\n\x18L2capClassicModuleFacade\x12h\n\x17\x46\x65tchConnectionComplete\x12\x17.bluetooth.facade.Empty\x1a\x30.bluetooth.l2cap.classic.ConnectionCompleteEvent\"\x00\x30\x01\x12\x62\n\x14\x46\x65tchConnectionClose\x12\x17.bluetooth.facade.Empty\x1a-.bluetooth.l2cap.classic.ConnectionCloseEvent\"\x00\x30\x01\x12U\n\x0bOpenChannel\x12+.bluetooth.l2cap.classic.OpenChannelRequest\x1a\x17.bluetooth.facade.Empty\"\x00\x12W\n\x0c\x43loseChannel\x12,.bluetooth.l2cap.classic.CloseChannelRequest\x1a\x17.bluetooth.facade.Empty\"\x00\x12S\n\x0e\x46\x65tchL2capData\x12\x17.bluetooth.facade.Empty\x1a$.bluetooth.l2cap.classic.L2capPacket\"\x00\x30\x01\x12g\n\x11SetDynamicChannel\x12\x37.bluetooth.l2cap.classic.SetEnableDynamicChannelRequest\x1a\x17.bluetooth.facade.Empty\"\x00\x12\x64\n\x18SendDynamicChannelPacket\x12-.bluetooth.l2cap.classic.DynamicChannelPacket\x1a\x17.bluetooth.facade.Empty\"\x00\x12_\n\x10SetTrafficPaused\x12\x30.bluetooth.l2cap.classic.SetTrafficPausedRequest\x1a\x17.bluetooth.facade.Empty\"\x00\x12h\n\x14GetChannelQueueDepth\x12\x17.bluetooth.facade.Empty\x1a\x35.bluetooth.l2cap.classic.GetChannelQueueDepthResponse\"\x00\x12^\n\x1dInitiateConnectionForSecurity\x12\".bluetooth.facade.BluetoothAddress\x1a\x17.bluetooth.facade.Empty\"\x00\x12y\n\x1d\x46\x65tchSecurityConnectionEvents\x12\x17.bluetooth.facade.Empty\x1a;.bluetooth.l2cap.classic.LinkSecurityInterfaceCallbackEvent\"\x00\x30\x01\x12`\n\x1fSecurityLinkEnsureAuthenticated\x12\".bluetooth.facade.BluetoothAddress\x1a\x17.bluetooth.facade.Empty\"\x00\x12Q\n\x10SecurityLinkHold\x12\".bluetooth.facade.BluetoothAddress\x1a\x17.bluetooth.facade.Empty\"\x00\x12W\n\x16SecurityLinkDisconnect\x12\".bluetooth.facade.BluetoothAddress\x1a\x17.bluetooth.facade.Empty\"\x00\x12T\n\x13SecurityLinkRelease\x12\".bluetooth.facade.BluetoothAddress\x1a\x17.bluetooth.facade.Empty\"\x00\x62\x06proto3' + , + dependencies=[proto_dot_common__pb2.DESCRIPTOR,]) + +_LINKSECURITYINTERFACECALLBACKEVENTTYPE = _descriptor.EnumDescriptor( + name='LinkSecurityInterfaceCallbackEventType', + full_name='bluetooth.l2cap.classic.LinkSecurityInterfaceCallbackEventType', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='ON_CONNECTED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ON_DISCONNECTED', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ON_AUTHENTICATION_COMPLETE', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ON_ENCRYPTION_CHANGE', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ON_READ_REMOTE_VERSION_INFO', index=4, number=4, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ON_READ_REMOTE_EXTENDED_FEATURES', index=5, number=5, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=1289, + serialized_end=1497, +) +_sym_db.RegisterEnumDescriptor(_LINKSECURITYINTERFACECALLBACKEVENTTYPE) + +LinkSecurityInterfaceCallbackEventType = enum_type_wrapper.EnumTypeWrapper(_LINKSECURITYINTERFACECALLBACKEVENTTYPE) +_RETRANSMISSIONFLOWCONTROLMODE = _descriptor.EnumDescriptor( + name='RetransmissionFlowControlMode', + full_name='bluetooth.l2cap.classic.RetransmissionFlowControlMode', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='BASIC', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ERTM', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ERTM_OPTIONAL', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=1499, + serialized_end=1570, +) +_sym_db.RegisterEnumDescriptor(_RETRANSMISSIONFLOWCONTROLMODE) + +RetransmissionFlowControlMode = enum_type_wrapper.EnumTypeWrapper(_RETRANSMISSIONFLOWCONTROLMODE) +_CHANNELSIGNALEVENTTYPE = _descriptor.EnumDescriptor( + name='ChannelSignalEventType', + full_name='bluetooth.l2cap.classic.ChannelSignalEventType', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='OPEN', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='CLOSE', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='CONFIGURE', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=1572, + serialized_end=1632, +) +_sym_db.RegisterEnumDescriptor(_CHANNELSIGNALEVENTTYPE) + +ChannelSignalEventType = enum_type_wrapper.EnumTypeWrapper(_CHANNELSIGNALEVENTTYPE) +_SENDL2CAPPACKETRESULTTYPE = _descriptor.EnumDescriptor( + name='SendL2capPacketResultType', + full_name='bluetooth.l2cap.classic.SendL2capPacketResultType', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='OK', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='BAD_CID', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=1634, + serialized_end=1682, +) +_sym_db.RegisterEnumDescriptor(_SENDL2CAPPACKETRESULTTYPE) + +SendL2capPacketResultType = enum_type_wrapper.EnumTypeWrapper(_SENDL2CAPPACKETRESULTTYPE) +_CLASSICSECURITYPOLICY = _descriptor.EnumDescriptor( + name='ClassicSecurityPolicy', + full_name='bluetooth.l2cap.classic.ClassicSecurityPolicy', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='ENCRYPTED_TRANSPORT', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='AUTHENTICATED_ENCRYPTED_TRANSPORT', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='BEST', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='_SDP_ONLY_NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=1685, + serialized_end=1843, +) +_sym_db.RegisterEnumDescriptor(_CLASSICSECURITYPOLICY) + +ClassicSecurityPolicy = enum_type_wrapper.EnumTypeWrapper(_CLASSICSECURITYPOLICY) +ON_CONNECTED = 0 +ON_DISCONNECTED = 1 +ON_AUTHENTICATION_COMPLETE = 2 +ON_ENCRYPTION_CHANGE = 3 +ON_READ_REMOTE_VERSION_INFO = 4 +ON_READ_REMOTE_EXTENDED_FEATURES = 5 +BASIC = 0 +ERTM = 1 +ERTM_OPTIONAL = 2 +OPEN = 0 +CLOSE = 1 +CONFIGURE = 2 +OK = 0 +BAD_CID = 1 +ENCRYPTED_TRANSPORT = 0 +AUTHENTICATED_ENCRYPTED_TRANSPORT = 1 +BEST = 2 +_SDP_ONLY_NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK = 3 + + + +_LINKSECURITYINTERFACECALLBACKEVENT = _descriptor.Descriptor( + name='LinkSecurityInterfaceCallbackEvent', + full_name='bluetooth.l2cap.classic.LinkSecurityInterfaceCallbackEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='address', full_name='bluetooth.l2cap.classic.LinkSecurityInterfaceCallbackEvent.address', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='event_type', full_name='bluetooth.l2cap.classic.LinkSecurityInterfaceCallbackEvent.event_type', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=67, + serialized_end=241, +) + + +_REGISTERCHANNELREQUEST = _descriptor.Descriptor( + name='RegisterChannelRequest', + full_name='bluetooth.l2cap.classic.RegisterChannelRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='channel', full_name='bluetooth.l2cap.classic.RegisterChannelRequest.channel', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=243, + serialized_end=284, +) + + +_CONNECTIONCOMPLETEEVENT = _descriptor.Descriptor( + name='ConnectionCompleteEvent', + full_name='bluetooth.l2cap.classic.ConnectionCompleteEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='remote', full_name='bluetooth.l2cap.classic.ConnectionCompleteEvent.remote', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=286, + serialized_end=363, +) + + +_CONNECTIONCLOSEEVENT = _descriptor.Descriptor( + name='ConnectionCloseEvent', + full_name='bluetooth.l2cap.classic.ConnectionCloseEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='remote', full_name='bluetooth.l2cap.classic.ConnectionCloseEvent.remote', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='reason', full_name='bluetooth.l2cap.classic.ConnectionCloseEvent.reason', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=365, + serialized_end=455, +) + + +_OPENCHANNELREQUEST = _descriptor.Descriptor( + name='OpenChannelRequest', + full_name='bluetooth.l2cap.classic.OpenChannelRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='remote', full_name='bluetooth.l2cap.classic.OpenChannelRequest.remote', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='psm', full_name='bluetooth.l2cap.classic.OpenChannelRequest.psm', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='mode', full_name='bluetooth.l2cap.classic.OpenChannelRequest.mode', index=2, + number=3, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=458, + serialized_end=613, +) + + +_CLOSECHANNELREQUEST = _descriptor.Descriptor( + name='CloseChannelRequest', + full_name='bluetooth.l2cap.classic.CloseChannelRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='psm', full_name='bluetooth.l2cap.classic.CloseChannelRequest.psm', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=615, + serialized_end=649, +) + + +_CHANNELSIGNALEVENT = _descriptor.Descriptor( + name='ChannelSignalEvent', + full_name='bluetooth.l2cap.classic.ChannelSignalEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='cid', full_name='bluetooth.l2cap.classic.ChannelSignalEvent.cid', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='type', full_name='bluetooth.l2cap.classic.ChannelSignalEvent.type', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=651, + serialized_end=747, +) + + +_SENDL2CAPPACKETRESULT = _descriptor.Descriptor( + name='SendL2capPacketResult', + full_name='bluetooth.l2cap.classic.SendL2capPacketResult', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='result_type', full_name='bluetooth.l2cap.classic.SendL2capPacketResult.result_type', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=749, + serialized_end=845, +) + + +_L2CAPPACKET = _descriptor.Descriptor( + name='L2capPacket', + full_name='bluetooth.l2cap.classic.L2capPacket', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='psm', full_name='bluetooth.l2cap.classic.L2capPacket.psm', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='fixed_cid', full_name='bluetooth.l2cap.classic.L2capPacket.fixed_cid', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='payload', full_name='bluetooth.l2cap.classic.L2capPacket.payload', index=2, + number=3, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='channel_type', full_name='bluetooth.l2cap.classic.L2capPacket.channel_type', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=847, + serialized_end=929, +) + + +_SETENABLEDYNAMICCHANNELREQUEST = _descriptor.Descriptor( + name='SetEnableDynamicChannelRequest', + full_name='bluetooth.l2cap.classic.SetEnableDynamicChannelRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='psm', full_name='bluetooth.l2cap.classic.SetEnableDynamicChannelRequest.psm', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='enable', full_name='bluetooth.l2cap.classic.SetEnableDynamicChannelRequest.enable', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='retransmission_mode', full_name='bluetooth.l2cap.classic.SetEnableDynamicChannelRequest.retransmission_mode', index=2, + number=3, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=932, + serialized_end=1078, +) + + +_DYNAMICCHANNELPACKET = _descriptor.Descriptor( + name='DynamicChannelPacket', + full_name='bluetooth.l2cap.classic.DynamicChannelPacket', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='remote', full_name='bluetooth.l2cap.classic.DynamicChannelPacket.remote', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='psm', full_name='bluetooth.l2cap.classic.DynamicChannelPacket.psm', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='payload', full_name='bluetooth.l2cap.classic.DynamicChannelPacket.payload', index=2, + number=3, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1080, + serialized_end=1184, +) + + +_SETTRAFFICPAUSEDREQUEST = _descriptor.Descriptor( + name='SetTrafficPausedRequest', + full_name='bluetooth.l2cap.classic.SetTrafficPausedRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='paused', full_name='bluetooth.l2cap.classic.SetTrafficPausedRequest.paused', index=0, + number=1, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='psm', full_name='bluetooth.l2cap.classic.SetTrafficPausedRequest.psm', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1186, + serialized_end=1240, +) + + +_GETCHANNELQUEUEDEPTHRESPONSE = _descriptor.Descriptor( + name='GetChannelQueueDepthResponse', + full_name='bluetooth.l2cap.classic.GetChannelQueueDepthResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='size', full_name='bluetooth.l2cap.classic.GetChannelQueueDepthResponse.size', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1242, + serialized_end=1286, +) + +_LINKSECURITYINTERFACECALLBACKEVENT.fields_by_name['address'].message_type = proto_dot_common__pb2._BLUETOOTHADDRESS +_LINKSECURITYINTERFACECALLBACKEVENT.fields_by_name['event_type'].enum_type = _LINKSECURITYINTERFACECALLBACKEVENTTYPE +_CONNECTIONCOMPLETEEVENT.fields_by_name['remote'].message_type = proto_dot_common__pb2._BLUETOOTHADDRESS +_CONNECTIONCLOSEEVENT.fields_by_name['remote'].message_type = proto_dot_common__pb2._BLUETOOTHADDRESS +_OPENCHANNELREQUEST.fields_by_name['remote'].message_type = proto_dot_common__pb2._BLUETOOTHADDRESS +_OPENCHANNELREQUEST.fields_by_name['mode'].enum_type = _RETRANSMISSIONFLOWCONTROLMODE +_CHANNELSIGNALEVENT.fields_by_name['type'].enum_type = _CHANNELSIGNALEVENTTYPE +_SENDL2CAPPACKETRESULT.fields_by_name['result_type'].enum_type = _SENDL2CAPPACKETRESULTTYPE +_L2CAPPACKET.oneofs_by_name['channel_type'].fields.append( + _L2CAPPACKET.fields_by_name['psm']) +_L2CAPPACKET.fields_by_name['psm'].containing_oneof = _L2CAPPACKET.oneofs_by_name['channel_type'] +_L2CAPPACKET.oneofs_by_name['channel_type'].fields.append( + _L2CAPPACKET.fields_by_name['fixed_cid']) +_L2CAPPACKET.fields_by_name['fixed_cid'].containing_oneof = _L2CAPPACKET.oneofs_by_name['channel_type'] +_SETENABLEDYNAMICCHANNELREQUEST.fields_by_name['retransmission_mode'].enum_type = _RETRANSMISSIONFLOWCONTROLMODE +_DYNAMICCHANNELPACKET.fields_by_name['remote'].message_type = proto_dot_common__pb2._BLUETOOTHADDRESS +DESCRIPTOR.message_types_by_name['LinkSecurityInterfaceCallbackEvent'] = _LINKSECURITYINTERFACECALLBACKEVENT +DESCRIPTOR.message_types_by_name['RegisterChannelRequest'] = _REGISTERCHANNELREQUEST +DESCRIPTOR.message_types_by_name['ConnectionCompleteEvent'] = _CONNECTIONCOMPLETEEVENT +DESCRIPTOR.message_types_by_name['ConnectionCloseEvent'] = _CONNECTIONCLOSEEVENT +DESCRIPTOR.message_types_by_name['OpenChannelRequest'] = _OPENCHANNELREQUEST +DESCRIPTOR.message_types_by_name['CloseChannelRequest'] = _CLOSECHANNELREQUEST +DESCRIPTOR.message_types_by_name['ChannelSignalEvent'] = _CHANNELSIGNALEVENT +DESCRIPTOR.message_types_by_name['SendL2capPacketResult'] = _SENDL2CAPPACKETRESULT +DESCRIPTOR.message_types_by_name['L2capPacket'] = _L2CAPPACKET +DESCRIPTOR.message_types_by_name['SetEnableDynamicChannelRequest'] = _SETENABLEDYNAMICCHANNELREQUEST +DESCRIPTOR.message_types_by_name['DynamicChannelPacket'] = _DYNAMICCHANNELPACKET +DESCRIPTOR.message_types_by_name['SetTrafficPausedRequest'] = _SETTRAFFICPAUSEDREQUEST +DESCRIPTOR.message_types_by_name['GetChannelQueueDepthResponse'] = _GETCHANNELQUEUEDEPTHRESPONSE +DESCRIPTOR.enum_types_by_name['LinkSecurityInterfaceCallbackEventType'] = _LINKSECURITYINTERFACECALLBACKEVENTTYPE +DESCRIPTOR.enum_types_by_name['RetransmissionFlowControlMode'] = _RETRANSMISSIONFLOWCONTROLMODE +DESCRIPTOR.enum_types_by_name['ChannelSignalEventType'] = _CHANNELSIGNALEVENTTYPE +DESCRIPTOR.enum_types_by_name['SendL2capPacketResultType'] = _SENDL2CAPPACKETRESULTTYPE +DESCRIPTOR.enum_types_by_name['ClassicSecurityPolicy'] = _CLASSICSECURITYPOLICY +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +LinkSecurityInterfaceCallbackEvent = _reflection.GeneratedProtocolMessageType('LinkSecurityInterfaceCallbackEvent', (_message.Message,), { + 'DESCRIPTOR' : _LINKSECURITYINTERFACECALLBACKEVENT, + '__module__' : 'proto.l2cap_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.LinkSecurityInterfaceCallbackEvent) + }) +_sym_db.RegisterMessage(LinkSecurityInterfaceCallbackEvent) + +RegisterChannelRequest = _reflection.GeneratedProtocolMessageType('RegisterChannelRequest', (_message.Message,), { + 'DESCRIPTOR' : _REGISTERCHANNELREQUEST, + '__module__' : 'proto.l2cap_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.RegisterChannelRequest) + }) +_sym_db.RegisterMessage(RegisterChannelRequest) + +ConnectionCompleteEvent = _reflection.GeneratedProtocolMessageType('ConnectionCompleteEvent', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTIONCOMPLETEEVENT, + '__module__' : 'proto.l2cap_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.ConnectionCompleteEvent) + }) +_sym_db.RegisterMessage(ConnectionCompleteEvent) + +ConnectionCloseEvent = _reflection.GeneratedProtocolMessageType('ConnectionCloseEvent', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTIONCLOSEEVENT, + '__module__' : 'proto.l2cap_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.ConnectionCloseEvent) + }) +_sym_db.RegisterMessage(ConnectionCloseEvent) + +OpenChannelRequest = _reflection.GeneratedProtocolMessageType('OpenChannelRequest', (_message.Message,), { + 'DESCRIPTOR' : _OPENCHANNELREQUEST, + '__module__' : 'proto.l2cap_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.OpenChannelRequest) + }) +_sym_db.RegisterMessage(OpenChannelRequest) + +CloseChannelRequest = _reflection.GeneratedProtocolMessageType('CloseChannelRequest', (_message.Message,), { + 'DESCRIPTOR' : _CLOSECHANNELREQUEST, + '__module__' : 'proto.l2cap_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.CloseChannelRequest) + }) +_sym_db.RegisterMessage(CloseChannelRequest) + +ChannelSignalEvent = _reflection.GeneratedProtocolMessageType('ChannelSignalEvent', (_message.Message,), { + 'DESCRIPTOR' : _CHANNELSIGNALEVENT, + '__module__' : 'proto.l2cap_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.ChannelSignalEvent) + }) +_sym_db.RegisterMessage(ChannelSignalEvent) + +SendL2capPacketResult = _reflection.GeneratedProtocolMessageType('SendL2capPacketResult', (_message.Message,), { + 'DESCRIPTOR' : _SENDL2CAPPACKETRESULT, + '__module__' : 'proto.l2cap_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.SendL2capPacketResult) + }) +_sym_db.RegisterMessage(SendL2capPacketResult) + +L2capPacket = _reflection.GeneratedProtocolMessageType('L2capPacket', (_message.Message,), { + 'DESCRIPTOR' : _L2CAPPACKET, + '__module__' : 'proto.l2cap_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.L2capPacket) + }) +_sym_db.RegisterMessage(L2capPacket) + +SetEnableDynamicChannelRequest = _reflection.GeneratedProtocolMessageType('SetEnableDynamicChannelRequest', (_message.Message,), { + 'DESCRIPTOR' : _SETENABLEDYNAMICCHANNELREQUEST, + '__module__' : 'proto.l2cap_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.SetEnableDynamicChannelRequest) + }) +_sym_db.RegisterMessage(SetEnableDynamicChannelRequest) + +DynamicChannelPacket = _reflection.GeneratedProtocolMessageType('DynamicChannelPacket', (_message.Message,), { + 'DESCRIPTOR' : _DYNAMICCHANNELPACKET, + '__module__' : 'proto.l2cap_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.DynamicChannelPacket) + }) +_sym_db.RegisterMessage(DynamicChannelPacket) + +SetTrafficPausedRequest = _reflection.GeneratedProtocolMessageType('SetTrafficPausedRequest', (_message.Message,), { + 'DESCRIPTOR' : _SETTRAFFICPAUSEDREQUEST, + '__module__' : 'proto.l2cap_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.SetTrafficPausedRequest) + }) +_sym_db.RegisterMessage(SetTrafficPausedRequest) + +GetChannelQueueDepthResponse = _reflection.GeneratedProtocolMessageType('GetChannelQueueDepthResponse', (_message.Message,), { + 'DESCRIPTOR' : _GETCHANNELQUEUEDEPTHRESPONSE, + '__module__' : 'proto.l2cap_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.GetChannelQueueDepthResponse) + }) +_sym_db.RegisterMessage(GetChannelQueueDepthResponse) + + + +_L2CAPCLASSICMODULEFACADE = _descriptor.ServiceDescriptor( + name='L2capClassicModuleFacade', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade', + file=DESCRIPTOR, + index=0, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=1846, + serialized_end=3324, + methods=[ + _descriptor.MethodDescriptor( + name='FetchConnectionComplete', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.FetchConnectionComplete', + index=0, + containing_service=None, + input_type=proto_dot_common__pb2._EMPTY, + output_type=_CONNECTIONCOMPLETEEVENT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='FetchConnectionClose', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.FetchConnectionClose', + index=1, + containing_service=None, + input_type=proto_dot_common__pb2._EMPTY, + output_type=_CONNECTIONCLOSEEVENT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='OpenChannel', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.OpenChannel', + index=2, + containing_service=None, + input_type=_OPENCHANNELREQUEST, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='CloseChannel', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.CloseChannel', + index=3, + containing_service=None, + input_type=_CLOSECHANNELREQUEST, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='FetchL2capData', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.FetchL2capData', + index=4, + containing_service=None, + input_type=proto_dot_common__pb2._EMPTY, + output_type=_L2CAPPACKET, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetDynamicChannel', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.SetDynamicChannel', + index=5, + containing_service=None, + input_type=_SETENABLEDYNAMICCHANNELREQUEST, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SendDynamicChannelPacket', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.SendDynamicChannelPacket', + index=6, + containing_service=None, + input_type=_DYNAMICCHANNELPACKET, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetTrafficPaused', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.SetTrafficPaused', + index=7, + containing_service=None, + input_type=_SETTRAFFICPAUSEDREQUEST, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetChannelQueueDepth', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.GetChannelQueueDepth', + index=8, + containing_service=None, + input_type=proto_dot_common__pb2._EMPTY, + output_type=_GETCHANNELQUEUEDEPTHRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='InitiateConnectionForSecurity', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.InitiateConnectionForSecurity', + index=9, + containing_service=None, + input_type=proto_dot_common__pb2._BLUETOOTHADDRESS, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='FetchSecurityConnectionEvents', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.FetchSecurityConnectionEvents', + index=10, + containing_service=None, + input_type=proto_dot_common__pb2._EMPTY, + output_type=_LINKSECURITYINTERFACECALLBACKEVENT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SecurityLinkEnsureAuthenticated', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.SecurityLinkEnsureAuthenticated', + index=11, + containing_service=None, + input_type=proto_dot_common__pb2._BLUETOOTHADDRESS, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SecurityLinkHold', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.SecurityLinkHold', + index=12, + containing_service=None, + input_type=proto_dot_common__pb2._BLUETOOTHADDRESS, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SecurityLinkDisconnect', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.SecurityLinkDisconnect', + index=13, + containing_service=None, + input_type=proto_dot_common__pb2._BLUETOOTHADDRESS, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SecurityLinkRelease', + full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.SecurityLinkRelease', + index=14, + containing_service=None, + input_type=proto_dot_common__pb2._BLUETOOTHADDRESS, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), +]) +_sym_db.RegisterServiceDescriptor(_L2CAPCLASSICMODULEFACADE) + +DESCRIPTOR.services_by_name['L2capClassicModuleFacade'] = _L2CAPCLASSICMODULEFACADE + +# @@protoc_insertion_point(module_scope) diff --git a/lib/proto/l2cap_pb2_grpc.py b/lib/proto/l2cap_pb2_grpc.py new file mode 100644 index 0000000..74b9a86 --- /dev/null +++ b/lib/proto/l2cap_pb2_grpc.py @@ -0,0 +1,533 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from . import common_pb2 as proto_dot_common__pb2 +from . import l2cap_pb2 as proto_dot_l2cap__pb2 + + +class L2capClassicModuleFacadeStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.FetchConnectionComplete = channel.unary_stream( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchConnectionComplete', + request_serializer=proto_dot_common__pb2.Empty.SerializeToString, + response_deserializer=proto_dot_l2cap__pb2.ConnectionCompleteEvent.FromString, + ) + self.FetchConnectionClose = channel.unary_stream( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchConnectionClose', + request_serializer=proto_dot_common__pb2.Empty.SerializeToString, + response_deserializer=proto_dot_l2cap__pb2.ConnectionCloseEvent.FromString, + ) + self.OpenChannel = channel.unary_unary( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/OpenChannel', + request_serializer=proto_dot_l2cap__pb2.OpenChannelRequest.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + self.CloseChannel = channel.unary_unary( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/CloseChannel', + request_serializer=proto_dot_l2cap__pb2.CloseChannelRequest.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + self.FetchL2capData = channel.unary_stream( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchL2capData', + request_serializer=proto_dot_common__pb2.Empty.SerializeToString, + response_deserializer=proto_dot_l2cap__pb2.L2capPacket.FromString, + ) + self.SetDynamicChannel = channel.unary_unary( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SetDynamicChannel', + request_serializer=proto_dot_l2cap__pb2.SetEnableDynamicChannelRequest.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + self.SendDynamicChannelPacket = channel.unary_unary( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SendDynamicChannelPacket', + request_serializer=proto_dot_l2cap__pb2.DynamicChannelPacket.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + self.SetTrafficPaused = channel.unary_unary( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SetTrafficPaused', + request_serializer=proto_dot_l2cap__pb2.SetTrafficPausedRequest.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + self.GetChannelQueueDepth = channel.unary_unary( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/GetChannelQueueDepth', + request_serializer=proto_dot_common__pb2.Empty.SerializeToString, + response_deserializer=proto_dot_l2cap__pb2.GetChannelQueueDepthResponse.FromString, + ) + self.InitiateConnectionForSecurity = channel.unary_unary( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/InitiateConnectionForSecurity', + request_serializer=proto_dot_common__pb2.BluetoothAddress.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + self.FetchSecurityConnectionEvents = channel.unary_stream( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchSecurityConnectionEvents', + request_serializer=proto_dot_common__pb2.Empty.SerializeToString, + response_deserializer=proto_dot_l2cap__pb2.LinkSecurityInterfaceCallbackEvent.FromString, + ) + self.SecurityLinkEnsureAuthenticated = channel.unary_unary( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkEnsureAuthenticated', + request_serializer=proto_dot_common__pb2.BluetoothAddress.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + self.SecurityLinkHold = channel.unary_unary( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkHold', + request_serializer=proto_dot_common__pb2.BluetoothAddress.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + self.SecurityLinkDisconnect = channel.unary_unary( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkDisconnect', + request_serializer=proto_dot_common__pb2.BluetoothAddress.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + self.SecurityLinkRelease = channel.unary_unary( + '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkRelease', + request_serializer=proto_dot_common__pb2.BluetoothAddress.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + + +class L2capClassicModuleFacadeServicer(object): + """Missing associated documentation comment in .proto file.""" + + def FetchConnectionComplete(self, request, context): + """Testing Android Bluetooth stack only. Optional for other stack. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FetchConnectionClose(self, request, context): + """Testing Android Bluetooth stack only. Optional for other stack. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def OpenChannel(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def CloseChannel(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FetchL2capData(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SetDynamicChannel(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SendDynamicChannelPacket(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SetTrafficPaused(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetChannelQueueDepth(self, request, context): + """Get the buffer size of channel queue end for L2CAP user (how many packets we can buffer + before L2CAP user dequeues. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def InitiateConnectionForSecurity(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FetchSecurityConnectionEvents(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SecurityLinkEnsureAuthenticated(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SecurityLinkHold(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SecurityLinkDisconnect(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SecurityLinkRelease(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_L2capClassicModuleFacadeServicer_to_server(servicer, server): + rpc_method_handlers = { + 'FetchConnectionComplete': grpc.unary_stream_rpc_method_handler( + servicer.FetchConnectionComplete, + request_deserializer=proto_dot_common__pb2.Empty.FromString, + response_serializer=proto_dot_l2cap__pb2.ConnectionCompleteEvent.SerializeToString, + ), + 'FetchConnectionClose': grpc.unary_stream_rpc_method_handler( + servicer.FetchConnectionClose, + request_deserializer=proto_dot_common__pb2.Empty.FromString, + response_serializer=proto_dot_l2cap__pb2.ConnectionCloseEvent.SerializeToString, + ), + 'OpenChannel': grpc.unary_unary_rpc_method_handler( + servicer.OpenChannel, + request_deserializer=proto_dot_l2cap__pb2.OpenChannelRequest.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + 'CloseChannel': grpc.unary_unary_rpc_method_handler( + servicer.CloseChannel, + request_deserializer=proto_dot_l2cap__pb2.CloseChannelRequest.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + 'FetchL2capData': grpc.unary_stream_rpc_method_handler( + servicer.FetchL2capData, + request_deserializer=proto_dot_common__pb2.Empty.FromString, + response_serializer=proto_dot_l2cap__pb2.L2capPacket.SerializeToString, + ), + 'SetDynamicChannel': grpc.unary_unary_rpc_method_handler( + servicer.SetDynamicChannel, + request_deserializer=proto_dot_l2cap__pb2.SetEnableDynamicChannelRequest.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + 'SendDynamicChannelPacket': grpc.unary_unary_rpc_method_handler( + servicer.SendDynamicChannelPacket, + request_deserializer=proto_dot_l2cap__pb2.DynamicChannelPacket.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + 'SetTrafficPaused': grpc.unary_unary_rpc_method_handler( + servicer.SetTrafficPaused, + request_deserializer=proto_dot_l2cap__pb2.SetTrafficPausedRequest.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + 'GetChannelQueueDepth': grpc.unary_unary_rpc_method_handler( + servicer.GetChannelQueueDepth, + request_deserializer=proto_dot_common__pb2.Empty.FromString, + response_serializer=proto_dot_l2cap__pb2.GetChannelQueueDepthResponse.SerializeToString, + ), + 'InitiateConnectionForSecurity': grpc.unary_unary_rpc_method_handler( + servicer.InitiateConnectionForSecurity, + request_deserializer=proto_dot_common__pb2.BluetoothAddress.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + 'FetchSecurityConnectionEvents': grpc.unary_stream_rpc_method_handler( + servicer.FetchSecurityConnectionEvents, + request_deserializer=proto_dot_common__pb2.Empty.FromString, + response_serializer=proto_dot_l2cap__pb2.LinkSecurityInterfaceCallbackEvent.SerializeToString, + ), + 'SecurityLinkEnsureAuthenticated': grpc.unary_unary_rpc_method_handler( + servicer.SecurityLinkEnsureAuthenticated, + request_deserializer=proto_dot_common__pb2.BluetoothAddress.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + 'SecurityLinkHold': grpc.unary_unary_rpc_method_handler( + servicer.SecurityLinkHold, + request_deserializer=proto_dot_common__pb2.BluetoothAddress.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + 'SecurityLinkDisconnect': grpc.unary_unary_rpc_method_handler( + servicer.SecurityLinkDisconnect, + request_deserializer=proto_dot_common__pb2.BluetoothAddress.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + 'SecurityLinkRelease': grpc.unary_unary_rpc_method_handler( + servicer.SecurityLinkRelease, + request_deserializer=proto_dot_common__pb2.BluetoothAddress.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'bluetooth.l2cap.classic.L2capClassicModuleFacade', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class L2capClassicModuleFacade(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def FetchConnectionComplete(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchConnectionComplete', + proto_dot_common__pb2.Empty.SerializeToString, + proto_dot_l2cap__pb2.ConnectionCompleteEvent.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def FetchConnectionClose(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchConnectionClose', + proto_dot_common__pb2.Empty.SerializeToString, + proto_dot_l2cap__pb2.ConnectionCloseEvent.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def OpenChannel(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/OpenChannel', + proto_dot_l2cap__pb2.OpenChannelRequest.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def CloseChannel(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/CloseChannel', + proto_dot_l2cap__pb2.CloseChannelRequest.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def FetchL2capData(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchL2capData', + proto_dot_common__pb2.Empty.SerializeToString, + proto_dot_l2cap__pb2.L2capPacket.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SetDynamicChannel(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SetDynamicChannel', + proto_dot_l2cap__pb2.SetEnableDynamicChannelRequest.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SendDynamicChannelPacket(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SendDynamicChannelPacket', + proto_dot_l2cap__pb2.DynamicChannelPacket.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SetTrafficPaused(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SetTrafficPaused', + proto_dot_l2cap__pb2.SetTrafficPausedRequest.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetChannelQueueDepth(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/GetChannelQueueDepth', + proto_dot_common__pb2.Empty.SerializeToString, + proto_dot_l2cap__pb2.GetChannelQueueDepthResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def InitiateConnectionForSecurity(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/InitiateConnectionForSecurity', + proto_dot_common__pb2.BluetoothAddress.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def FetchSecurityConnectionEvents(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchSecurityConnectionEvents', + proto_dot_common__pb2.Empty.SerializeToString, + proto_dot_l2cap__pb2.LinkSecurityInterfaceCallbackEvent.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SecurityLinkEnsureAuthenticated(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkEnsureAuthenticated', + proto_dot_common__pb2.BluetoothAddress.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SecurityLinkHold(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkHold', + proto_dot_common__pb2.BluetoothAddress.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SecurityLinkDisconnect(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkDisconnect', + proto_dot_common__pb2.BluetoothAddress.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SecurityLinkRelease(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkRelease', + proto_dot_common__pb2.BluetoothAddress.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/lib/proto/neighbor_pb2.py b/lib/proto/neighbor_pb2.py new file mode 100644 index 0000000..be9e5ba --- /dev/null +++ b/lib/proto/neighbor_pb2.py @@ -0,0 +1,481 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proto/neighbor.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from . import common_pb2 as proto_dot_common__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='proto/neighbor.proto', + package='bluetooth.neighbor', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x14proto/neighbor.proto\x12\x12\x62luetooth.neighbor\x1a\x12proto/common.proto\"\x1c\n\tEnableMsg\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\"L\n\x13\x44iscoverabilitiyMsg\x12\x35\n\x04mode\x18\x01 \x01(\x0e\x32\'.bluetooth.neighbor.DiscoverabilityMode\"\xab\x01\n\nInquiryMsg\x12=\n\x0cinquiry_mode\x18\x01 \x01(\x0e\x32\'.bluetooth.neighbor.DiscoverabilityMode\x12\x33\n\x0bresult_mode\x18\x02 \x01(\x0e\x32\x1e.bluetooth.neighbor.ResultMode\x12\x14\n\x0clength_1_28s\x18\x03 \x01(\r\x12\x13\n\x0bmax_results\x18\x04 \x01(\r\"\"\n\x10InquiryResultMsg\x12\x0e\n\x06packet\x18\x01 \x01(\x0c\"`\n\x14RemoteNameRequestMsg\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0c\x12!\n\x19page_scan_repetition_mode\x18\x02 \x01(\r\x12\x14\n\x0c\x63lock_offset\x18\x03 \x01(\r\"F\n\x15RemoteNameResponseMsg\x12\x0e\n\x06status\x18\x01 \x01(\r\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\x0c\x12\x0c\n\x04name\x18\x03 \x01(\x0c*8\n\x13\x44iscoverabilityMode\x12\x07\n\x03OFF\x10\x00\x12\x0b\n\x07LIMITED\x10\x01\x12\x0b\n\x07GENERAL\x10\x02*2\n\nResultMode\x12\x0c\n\x08STANDARD\x10\x00\x12\x08\n\x04RSSI\x10\x01\x12\x0c\n\x08\x45XTENDED\x10\x02\x32\xe6\x04\n\x0eNeighborFacade\x12M\n\x11SetConnectability\x12\x1d.bluetooth.neighbor.EnableMsg\x1a\x17.bluetooth.facade.Empty\"\x00\x12X\n\x12SetDiscoverability\x12\'.bluetooth.neighbor.DiscoverabilitiyMsg\x1a\x17.bluetooth.facade.Empty\"\x00\x12Z\n\x0eSetInquiryMode\x12\x1e.bluetooth.neighbor.InquiryMsg\x1a$.bluetooth.neighbor.InquiryResultMsg\"\x00\x30\x01\x12U\n\x0eReadRemoteName\x12(.bluetooth.neighbor.RemoteNameRequestMsg\x1a\x17.bluetooth.facade.Empty\"\x00\x12]\n\x13GetRemoteNameEvents\x12\x17.bluetooth.facade.Empty\x1a).bluetooth.neighbor.RemoteNameResponseMsg\"\x00\x30\x01\x12M\n\x11\x45nableInquiryScan\x12\x1d.bluetooth.neighbor.EnableMsg\x1a\x17.bluetooth.facade.Empty\"\x00\x12J\n\x0e\x45nablePageScan\x12\x1d.bluetooth.neighbor.EnableMsg\x1a\x17.bluetooth.facade.Empty\"\x00\x62\x06proto3' + , + dependencies=[proto_dot_common__pb2.DESCRIPTOR,]) + +_DISCOVERABILITYMODE = _descriptor.EnumDescriptor( + name='DiscoverabilityMode', + full_name='bluetooth.neighbor.DiscoverabilityMode', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='OFF', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='LIMITED', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='GENERAL', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=552, + serialized_end=608, +) +_sym_db.RegisterEnumDescriptor(_DISCOVERABILITYMODE) + +DiscoverabilityMode = enum_type_wrapper.EnumTypeWrapper(_DISCOVERABILITYMODE) +_RESULTMODE = _descriptor.EnumDescriptor( + name='ResultMode', + full_name='bluetooth.neighbor.ResultMode', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='STANDARD', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='RSSI', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='EXTENDED', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=610, + serialized_end=660, +) +_sym_db.RegisterEnumDescriptor(_RESULTMODE) + +ResultMode = enum_type_wrapper.EnumTypeWrapper(_RESULTMODE) +OFF = 0 +LIMITED = 1 +GENERAL = 2 +STANDARD = 0 +RSSI = 1 +EXTENDED = 2 + + + +_ENABLEMSG = _descriptor.Descriptor( + name='EnableMsg', + full_name='bluetooth.neighbor.EnableMsg', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='enabled', full_name='bluetooth.neighbor.EnableMsg.enabled', index=0, + number=1, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=64, + serialized_end=92, +) + + +_DISCOVERABILITIYMSG = _descriptor.Descriptor( + name='DiscoverabilitiyMsg', + full_name='bluetooth.neighbor.DiscoverabilitiyMsg', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='mode', full_name='bluetooth.neighbor.DiscoverabilitiyMsg.mode', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=94, + serialized_end=170, +) + + +_INQUIRYMSG = _descriptor.Descriptor( + name='InquiryMsg', + full_name='bluetooth.neighbor.InquiryMsg', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='inquiry_mode', full_name='bluetooth.neighbor.InquiryMsg.inquiry_mode', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='result_mode', full_name='bluetooth.neighbor.InquiryMsg.result_mode', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='length_1_28s', full_name='bluetooth.neighbor.InquiryMsg.length_1_28s', index=2, + number=3, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='max_results', full_name='bluetooth.neighbor.InquiryMsg.max_results', index=3, + number=4, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=173, + serialized_end=344, +) + + +_INQUIRYRESULTMSG = _descriptor.Descriptor( + name='InquiryResultMsg', + full_name='bluetooth.neighbor.InquiryResultMsg', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='packet', full_name='bluetooth.neighbor.InquiryResultMsg.packet', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=346, + serialized_end=380, +) + + +_REMOTENAMEREQUESTMSG = _descriptor.Descriptor( + name='RemoteNameRequestMsg', + full_name='bluetooth.neighbor.RemoteNameRequestMsg', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='address', full_name='bluetooth.neighbor.RemoteNameRequestMsg.address', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='page_scan_repetition_mode', full_name='bluetooth.neighbor.RemoteNameRequestMsg.page_scan_repetition_mode', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='clock_offset', full_name='bluetooth.neighbor.RemoteNameRequestMsg.clock_offset', index=2, + number=3, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=382, + serialized_end=478, +) + + +_REMOTENAMERESPONSEMSG = _descriptor.Descriptor( + name='RemoteNameResponseMsg', + full_name='bluetooth.neighbor.RemoteNameResponseMsg', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='status', full_name='bluetooth.neighbor.RemoteNameResponseMsg.status', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='address', full_name='bluetooth.neighbor.RemoteNameResponseMsg.address', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='name', full_name='bluetooth.neighbor.RemoteNameResponseMsg.name', index=2, + number=3, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=480, + serialized_end=550, +) + +_DISCOVERABILITIYMSG.fields_by_name['mode'].enum_type = _DISCOVERABILITYMODE +_INQUIRYMSG.fields_by_name['inquiry_mode'].enum_type = _DISCOVERABILITYMODE +_INQUIRYMSG.fields_by_name['result_mode'].enum_type = _RESULTMODE +DESCRIPTOR.message_types_by_name['EnableMsg'] = _ENABLEMSG +DESCRIPTOR.message_types_by_name['DiscoverabilitiyMsg'] = _DISCOVERABILITIYMSG +DESCRIPTOR.message_types_by_name['InquiryMsg'] = _INQUIRYMSG +DESCRIPTOR.message_types_by_name['InquiryResultMsg'] = _INQUIRYRESULTMSG +DESCRIPTOR.message_types_by_name['RemoteNameRequestMsg'] = _REMOTENAMEREQUESTMSG +DESCRIPTOR.message_types_by_name['RemoteNameResponseMsg'] = _REMOTENAMERESPONSEMSG +DESCRIPTOR.enum_types_by_name['DiscoverabilityMode'] = _DISCOVERABILITYMODE +DESCRIPTOR.enum_types_by_name['ResultMode'] = _RESULTMODE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +EnableMsg = _reflection.GeneratedProtocolMessageType('EnableMsg', (_message.Message,), { + 'DESCRIPTOR' : _ENABLEMSG, + '__module__' : 'proto.neighbor_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.neighbor.EnableMsg) + }) +_sym_db.RegisterMessage(EnableMsg) + +DiscoverabilitiyMsg = _reflection.GeneratedProtocolMessageType('DiscoverabilitiyMsg', (_message.Message,), { + 'DESCRIPTOR' : _DISCOVERABILITIYMSG, + '__module__' : 'proto.neighbor_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.neighbor.DiscoverabilitiyMsg) + }) +_sym_db.RegisterMessage(DiscoverabilitiyMsg) + +InquiryMsg = _reflection.GeneratedProtocolMessageType('InquiryMsg', (_message.Message,), { + 'DESCRIPTOR' : _INQUIRYMSG, + '__module__' : 'proto.neighbor_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.neighbor.InquiryMsg) + }) +_sym_db.RegisterMessage(InquiryMsg) + +InquiryResultMsg = _reflection.GeneratedProtocolMessageType('InquiryResultMsg', (_message.Message,), { + 'DESCRIPTOR' : _INQUIRYRESULTMSG, + '__module__' : 'proto.neighbor_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.neighbor.InquiryResultMsg) + }) +_sym_db.RegisterMessage(InquiryResultMsg) + +RemoteNameRequestMsg = _reflection.GeneratedProtocolMessageType('RemoteNameRequestMsg', (_message.Message,), { + 'DESCRIPTOR' : _REMOTENAMEREQUESTMSG, + '__module__' : 'proto.neighbor_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.neighbor.RemoteNameRequestMsg) + }) +_sym_db.RegisterMessage(RemoteNameRequestMsg) + +RemoteNameResponseMsg = _reflection.GeneratedProtocolMessageType('RemoteNameResponseMsg', (_message.Message,), { + 'DESCRIPTOR' : _REMOTENAMERESPONSEMSG, + '__module__' : 'proto.neighbor_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.neighbor.RemoteNameResponseMsg) + }) +_sym_db.RegisterMessage(RemoteNameResponseMsg) + + + +_NEIGHBORFACADE = _descriptor.ServiceDescriptor( + name='NeighborFacade', + full_name='bluetooth.neighbor.NeighborFacade', + file=DESCRIPTOR, + index=0, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=663, + serialized_end=1277, + methods=[ + _descriptor.MethodDescriptor( + name='SetConnectability', + full_name='bluetooth.neighbor.NeighborFacade.SetConnectability', + index=0, + containing_service=None, + input_type=_ENABLEMSG, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetDiscoverability', + full_name='bluetooth.neighbor.NeighborFacade.SetDiscoverability', + index=1, + containing_service=None, + input_type=_DISCOVERABILITIYMSG, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetInquiryMode', + full_name='bluetooth.neighbor.NeighborFacade.SetInquiryMode', + index=2, + containing_service=None, + input_type=_INQUIRYMSG, + output_type=_INQUIRYRESULTMSG, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ReadRemoteName', + full_name='bluetooth.neighbor.NeighborFacade.ReadRemoteName', + index=3, + containing_service=None, + input_type=_REMOTENAMEREQUESTMSG, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetRemoteNameEvents', + full_name='bluetooth.neighbor.NeighborFacade.GetRemoteNameEvents', + index=4, + containing_service=None, + input_type=proto_dot_common__pb2._EMPTY, + output_type=_REMOTENAMERESPONSEMSG, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='EnableInquiryScan', + full_name='bluetooth.neighbor.NeighborFacade.EnableInquiryScan', + index=5, + containing_service=None, + input_type=_ENABLEMSG, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='EnablePageScan', + full_name='bluetooth.neighbor.NeighborFacade.EnablePageScan', + index=6, + containing_service=None, + input_type=_ENABLEMSG, + output_type=proto_dot_common__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), +]) +_sym_db.RegisterServiceDescriptor(_NEIGHBORFACADE) + +DESCRIPTOR.services_by_name['NeighborFacade'] = _NEIGHBORFACADE + +# @@protoc_insertion_point(module_scope) diff --git a/lib/proto/neighbor_pb2_grpc.py b/lib/proto/neighbor_pb2_grpc.py new file mode 100644 index 0000000..fc71c18 --- /dev/null +++ b/lib/proto/neighbor_pb2_grpc.py @@ -0,0 +1,267 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from . import common_pb2 as proto_dot_common__pb2 +from . import neighbor_pb2 as proto_dot_neighbor__pb2 + + +class NeighborFacadeStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SetConnectability = channel.unary_unary( + '/bluetooth.neighbor.NeighborFacade/SetConnectability', + request_serializer=proto_dot_neighbor__pb2.EnableMsg.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + self.SetDiscoverability = channel.unary_unary( + '/bluetooth.neighbor.NeighborFacade/SetDiscoverability', + request_serializer=proto_dot_neighbor__pb2.DiscoverabilitiyMsg.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + self.SetInquiryMode = channel.unary_stream( + '/bluetooth.neighbor.NeighborFacade/SetInquiryMode', + request_serializer=proto_dot_neighbor__pb2.InquiryMsg.SerializeToString, + response_deserializer=proto_dot_neighbor__pb2.InquiryResultMsg.FromString, + ) + self.ReadRemoteName = channel.unary_unary( + '/bluetooth.neighbor.NeighborFacade/ReadRemoteName', + request_serializer=proto_dot_neighbor__pb2.RemoteNameRequestMsg.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + self.GetRemoteNameEvents = channel.unary_stream( + '/bluetooth.neighbor.NeighborFacade/GetRemoteNameEvents', + request_serializer=proto_dot_common__pb2.Empty.SerializeToString, + response_deserializer=proto_dot_neighbor__pb2.RemoteNameResponseMsg.FromString, + ) + self.EnableInquiryScan = channel.unary_unary( + '/bluetooth.neighbor.NeighborFacade/EnableInquiryScan', + request_serializer=proto_dot_neighbor__pb2.EnableMsg.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + self.EnablePageScan = channel.unary_unary( + '/bluetooth.neighbor.NeighborFacade/EnablePageScan', + request_serializer=proto_dot_neighbor__pb2.EnableMsg.SerializeToString, + response_deserializer=proto_dot_common__pb2.Empty.FromString, + ) + + +class NeighborFacadeServicer(object): + """Missing associated documentation comment in .proto file.""" + + def SetConnectability(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SetDiscoverability(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SetInquiryMode(self, request, context): + """Sets inquiry mode and fetches inquiry result HCI packet + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ReadRemoteName(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetRemoteNameEvents(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def EnableInquiryScan(self, request, context): + """TODO: Should we use a blocking call for ReadRemoteName instead? (Note: blocking model may not work for GD stack) + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def EnablePageScan(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_NeighborFacadeServicer_to_server(servicer, server): + rpc_method_handlers = { + 'SetConnectability': grpc.unary_unary_rpc_method_handler( + servicer.SetConnectability, + request_deserializer=proto_dot_neighbor__pb2.EnableMsg.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + 'SetDiscoverability': grpc.unary_unary_rpc_method_handler( + servicer.SetDiscoverability, + request_deserializer=proto_dot_neighbor__pb2.DiscoverabilitiyMsg.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + 'SetInquiryMode': grpc.unary_stream_rpc_method_handler( + servicer.SetInquiryMode, + request_deserializer=proto_dot_neighbor__pb2.InquiryMsg.FromString, + response_serializer=proto_dot_neighbor__pb2.InquiryResultMsg.SerializeToString, + ), + 'ReadRemoteName': grpc.unary_unary_rpc_method_handler( + servicer.ReadRemoteName, + request_deserializer=proto_dot_neighbor__pb2.RemoteNameRequestMsg.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + 'GetRemoteNameEvents': grpc.unary_stream_rpc_method_handler( + servicer.GetRemoteNameEvents, + request_deserializer=proto_dot_common__pb2.Empty.FromString, + response_serializer=proto_dot_neighbor__pb2.RemoteNameResponseMsg.SerializeToString, + ), + 'EnableInquiryScan': grpc.unary_unary_rpc_method_handler( + servicer.EnableInquiryScan, + request_deserializer=proto_dot_neighbor__pb2.EnableMsg.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + 'EnablePageScan': grpc.unary_unary_rpc_method_handler( + servicer.EnablePageScan, + request_deserializer=proto_dot_neighbor__pb2.EnableMsg.FromString, + response_serializer=proto_dot_common__pb2.Empty.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'bluetooth.neighbor.NeighborFacade', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class NeighborFacade(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def SetConnectability(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.neighbor.NeighborFacade/SetConnectability', + proto_dot_neighbor__pb2.EnableMsg.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SetDiscoverability(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.neighbor.NeighborFacade/SetDiscoverability', + proto_dot_neighbor__pb2.DiscoverabilitiyMsg.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SetInquiryMode(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/bluetooth.neighbor.NeighborFacade/SetInquiryMode', + proto_dot_neighbor__pb2.InquiryMsg.SerializeToString, + proto_dot_neighbor__pb2.InquiryResultMsg.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def ReadRemoteName(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.neighbor.NeighborFacade/ReadRemoteName', + proto_dot_neighbor__pb2.RemoteNameRequestMsg.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetRemoteNameEvents(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/bluetooth.neighbor.NeighborFacade/GetRemoteNameEvents', + proto_dot_common__pb2.Empty.SerializeToString, + proto_dot_neighbor__pb2.RemoteNameResponseMsg.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def EnableInquiryScan(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.neighbor.NeighborFacade/EnableInquiryScan', + proto_dot_neighbor__pb2.EnableMsg.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def EnablePageScan(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.neighbor.NeighborFacade/EnablePageScan', + proto_dot_neighbor__pb2.EnableMsg.SerializeToString, + proto_dot_common__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/lib/proto/rootservice_pb2.py b/lib/proto/rootservice_pb2.py new file mode 100644 index 0000000..5944a74 --- /dev/null +++ b/lib/proto/rootservice_pb2.py @@ -0,0 +1,288 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proto/rootservice.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from . import common_pb2 as proto_dot_common__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='proto/rootservice.proto', + package='bluetooth.facade', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x17proto/rootservice.proto\x12\x10\x62luetooth.facade\x1a\x12proto/common.proto\"Q\n\x11StartStackRequest\x12<\n\x11module_under_test\x18\x01 \x01(\x0e\x32!.bluetooth.facade.BluetoothModule\"\x14\n\x12StartStackResponse\"\x12\n\x10StopStackRequest\"\x13\n\x11StopStackResponse*Z\n\x0f\x42luetoothModule\x12\x07\n\x03HAL\x10\x00\x12\x07\n\x03HCI\x10\x01\x12\x12\n\x0eHCI_INTERFACES\x10\x02\x12\t\n\x05L2CAP\x10\x03\x12\x0c\n\x08SECURITY\x10\x04\x12\x08\n\x04SHIM\x10\x05\x32\xbf\x01\n\nRootFacade\x12Y\n\nStartStack\x12#.bluetooth.facade.StartStackRequest\x1a$.bluetooth.facade.StartStackResponse\"\x00\x12V\n\tStopStack\x12\".bluetooth.facade.StopStackRequest\x1a#.bluetooth.facade.StopStackResponse\"\x00\x32\x65\n\x10ReadOnlyProperty\x12Q\n\x10ReadLocalAddress\x12\x17.bluetooth.facade.Empty\x1a\".bluetooth.facade.BluetoothAddress\"\x00\x62\x06proto3' + , + dependencies=[proto_dot_common__pb2.DESCRIPTOR,]) + +_BLUETOOTHMODULE = _descriptor.EnumDescriptor( + name='BluetoothModule', + full_name='bluetooth.facade.BluetoothModule', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='HAL', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='HCI', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='HCI_INTERFACES', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='L2CAP', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SECURITY', index=4, number=4, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SHIM', index=5, number=5, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=211, + serialized_end=301, +) +_sym_db.RegisterEnumDescriptor(_BLUETOOTHMODULE) + +BluetoothModule = enum_type_wrapper.EnumTypeWrapper(_BLUETOOTHMODULE) +HAL = 0 +HCI = 1 +HCI_INTERFACES = 2 +L2CAP = 3 +SECURITY = 4 +SHIM = 5 + + + +_STARTSTACKREQUEST = _descriptor.Descriptor( + name='StartStackRequest', + full_name='bluetooth.facade.StartStackRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='module_under_test', full_name='bluetooth.facade.StartStackRequest.module_under_test', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=65, + serialized_end=146, +) + + +_STARTSTACKRESPONSE = _descriptor.Descriptor( + name='StartStackResponse', + full_name='bluetooth.facade.StartStackResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=148, + serialized_end=168, +) + + +_STOPSTACKREQUEST = _descriptor.Descriptor( + name='StopStackRequest', + full_name='bluetooth.facade.StopStackRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=170, + serialized_end=188, +) + + +_STOPSTACKRESPONSE = _descriptor.Descriptor( + name='StopStackResponse', + full_name='bluetooth.facade.StopStackResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=190, + serialized_end=209, +) + +_STARTSTACKREQUEST.fields_by_name['module_under_test'].enum_type = _BLUETOOTHMODULE +DESCRIPTOR.message_types_by_name['StartStackRequest'] = _STARTSTACKREQUEST +DESCRIPTOR.message_types_by_name['StartStackResponse'] = _STARTSTACKRESPONSE +DESCRIPTOR.message_types_by_name['StopStackRequest'] = _STOPSTACKREQUEST +DESCRIPTOR.message_types_by_name['StopStackResponse'] = _STOPSTACKRESPONSE +DESCRIPTOR.enum_types_by_name['BluetoothModule'] = _BLUETOOTHMODULE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +StartStackRequest = _reflection.GeneratedProtocolMessageType('StartStackRequest', (_message.Message,), { + 'DESCRIPTOR' : _STARTSTACKREQUEST, + '__module__' : 'proto.rootservice_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.facade.StartStackRequest) + }) +_sym_db.RegisterMessage(StartStackRequest) + +StartStackResponse = _reflection.GeneratedProtocolMessageType('StartStackResponse', (_message.Message,), { + 'DESCRIPTOR' : _STARTSTACKRESPONSE, + '__module__' : 'proto.rootservice_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.facade.StartStackResponse) + }) +_sym_db.RegisterMessage(StartStackResponse) + +StopStackRequest = _reflection.GeneratedProtocolMessageType('StopStackRequest', (_message.Message,), { + 'DESCRIPTOR' : _STOPSTACKREQUEST, + '__module__' : 'proto.rootservice_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.facade.StopStackRequest) + }) +_sym_db.RegisterMessage(StopStackRequest) + +StopStackResponse = _reflection.GeneratedProtocolMessageType('StopStackResponse', (_message.Message,), { + 'DESCRIPTOR' : _STOPSTACKRESPONSE, + '__module__' : 'proto.rootservice_pb2' + # @@protoc_insertion_point(class_scope:bluetooth.facade.StopStackResponse) + }) +_sym_db.RegisterMessage(StopStackResponse) + + + +_ROOTFACADE = _descriptor.ServiceDescriptor( + name='RootFacade', + full_name='bluetooth.facade.RootFacade', + file=DESCRIPTOR, + index=0, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=304, + serialized_end=495, + methods=[ + _descriptor.MethodDescriptor( + name='StartStack', + full_name='bluetooth.facade.RootFacade.StartStack', + index=0, + containing_service=None, + input_type=_STARTSTACKREQUEST, + output_type=_STARTSTACKRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='StopStack', + full_name='bluetooth.facade.RootFacade.StopStack', + index=1, + containing_service=None, + input_type=_STOPSTACKREQUEST, + output_type=_STOPSTACKRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), +]) +_sym_db.RegisterServiceDescriptor(_ROOTFACADE) + +DESCRIPTOR.services_by_name['RootFacade'] = _ROOTFACADE + + +_READONLYPROPERTY = _descriptor.ServiceDescriptor( + name='ReadOnlyProperty', + full_name='bluetooth.facade.ReadOnlyProperty', + file=DESCRIPTOR, + index=1, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=497, + serialized_end=598, + methods=[ + _descriptor.MethodDescriptor( + name='ReadLocalAddress', + full_name='bluetooth.facade.ReadOnlyProperty.ReadLocalAddress', + index=0, + containing_service=None, + input_type=proto_dot_common__pb2._EMPTY, + output_type=proto_dot_common__pb2._BLUETOOTHADDRESS, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), +]) +_sym_db.RegisterServiceDescriptor(_READONLYPROPERTY) + +DESCRIPTOR.services_by_name['ReadOnlyProperty'] = _READONLYPROPERTY + +# @@protoc_insertion_point(module_scope) diff --git a/lib/proto/rootservice_pb2_grpc.py b/lib/proto/rootservice_pb2_grpc.py new file mode 100644 index 0000000..961bd9f --- /dev/null +++ b/lib/proto/rootservice_pb2_grpc.py @@ -0,0 +1,161 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from . import common_pb2 as proto_dot_common__pb2 +from . import rootservice_pb2 as proto_dot_rootservice__pb2 + + +class RootFacadeStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.StartStack = channel.unary_unary( + '/bluetooth.facade.RootFacade/StartStack', + request_serializer=proto_dot_rootservice__pb2.StartStackRequest.SerializeToString, + response_deserializer=proto_dot_rootservice__pb2.StartStackResponse.FromString, + ) + self.StopStack = channel.unary_unary( + '/bluetooth.facade.RootFacade/StopStack', + request_serializer=proto_dot_rootservice__pb2.StopStackRequest.SerializeToString, + response_deserializer=proto_dot_rootservice__pb2.StopStackResponse.FromString, + ) + + +class RootFacadeServicer(object): + """Missing associated documentation comment in .proto file.""" + + def StartStack(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def StopStack(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_RootFacadeServicer_to_server(servicer, server): + rpc_method_handlers = { + 'StartStack': grpc.unary_unary_rpc_method_handler( + servicer.StartStack, + request_deserializer=proto_dot_rootservice__pb2.StartStackRequest.FromString, + response_serializer=proto_dot_rootservice__pb2.StartStackResponse.SerializeToString, + ), + 'StopStack': grpc.unary_unary_rpc_method_handler( + servicer.StopStack, + request_deserializer=proto_dot_rootservice__pb2.StopStackRequest.FromString, + response_serializer=proto_dot_rootservice__pb2.StopStackResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'bluetooth.facade.RootFacade', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class RootFacade(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def StartStack(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.facade.RootFacade/StartStack', + proto_dot_rootservice__pb2.StartStackRequest.SerializeToString, + proto_dot_rootservice__pb2.StartStackResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def StopStack(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.facade.RootFacade/StopStack', + proto_dot_rootservice__pb2.StopStackRequest.SerializeToString, + proto_dot_rootservice__pb2.StopStackResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + +class ReadOnlyPropertyStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.ReadLocalAddress = channel.unary_unary( + '/bluetooth.facade.ReadOnlyProperty/ReadLocalAddress', + request_serializer=proto_dot_common__pb2.Empty.SerializeToString, + response_deserializer=proto_dot_common__pb2.BluetoothAddress.FromString, + ) + + +class ReadOnlyPropertyServicer(object): + """Missing associated documentation comment in .proto file.""" + + def ReadLocalAddress(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_ReadOnlyPropertyServicer_to_server(servicer, server): + rpc_method_handlers = { + 'ReadLocalAddress': grpc.unary_unary_rpc_method_handler( + servicer.ReadLocalAddress, + request_deserializer=proto_dot_common__pb2.Empty.FromString, + response_serializer=proto_dot_common__pb2.BluetoothAddress.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'bluetooth.facade.ReadOnlyProperty', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class ReadOnlyProperty(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def ReadLocalAddress(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/bluetooth.facade.ReadOnlyProperty/ReadLocalAddress', + proto_dot_common__pb2.Empty.SerializeToString, + proto_dot_common__pb2.BluetoothAddress.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/proto/common.proto b/proto/common.proto new file mode 100644 index 0000000..a68bff2 --- /dev/null +++ b/proto/common.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; + +package bluetooth.facade; + +message Empty {} + +message Data { + bytes payload = 1; +} + +message BluetoothAddress { + bytes address = 1; +} + +enum BluetoothAddressTypeEnum { + PUBLIC_DEVICE_ADDRESS = 0x0; + RANDOM_DEVICE_ADDRESS = 0x1; + PUBLIC_IDENTITY_ADDRESS = 0x2; + RANDOM_IDENTITY_ADDRESS = 0x3; +} + +enum BluetoothOwnAddressTypeEnum { + USE_PUBLIC_DEVICE_ADDRESS = 0x0; + USE_RANDOM_DEVICE_ADDRESS = 0x1; + RESOLVABLE_OR_PUBLIC_ADDRESS = 0x2; + RESOLVABLE_OR_RANDOM_ADDRESS = 0x3; +} + +message BluetoothAddressWithType { + BluetoothAddress address = 1; + BluetoothAddressTypeEnum type = 2; +} + +enum BluetoothPeerAddressTypeEnum { + PUBLIC_DEVICE_OR_IDENTITY_ADDRESS = 0x0; + RANDOM_DEVICE_OR_IDENTITY_ADDRESS = 0x1; +} \ No newline at end of file diff --git a/proto/l2cap.proto b/proto/l2cap.proto new file mode 100644 index 0000000..4aa4422 --- /dev/null +++ b/proto/l2cap.proto @@ -0,0 +1,129 @@ +syntax = "proto3"; + +package bluetooth.l2cap.classic; + +import "proto/common.proto"; + +service L2capClassicModuleFacade { + rpc FetchConnectionComplete(facade.Empty) returns (stream ConnectionCompleteEvent) { + // Testing Android Bluetooth stack only. Optional for other stack. + } + rpc FetchConnectionClose(facade.Empty) returns (stream ConnectionCloseEvent) { + // Testing Android Bluetooth stack only. Optional for other stack. + } + rpc OpenChannel(OpenChannelRequest) returns (facade.Empty) {} + rpc CloseChannel(CloseChannelRequest) returns (facade.Empty) {} + rpc FetchL2capData(facade.Empty) returns (stream L2capPacket) {} + rpc SetDynamicChannel(SetEnableDynamicChannelRequest) returns (facade.Empty) {} + rpc SendDynamicChannelPacket(DynamicChannelPacket) returns (facade.Empty) {} + rpc SetTrafficPaused(SetTrafficPausedRequest) returns (facade.Empty) {} + rpc GetChannelQueueDepth(facade.Empty) returns (GetChannelQueueDepthResponse) { + // Get the buffer size of channel queue end for L2CAP user (how many packets we can buffer + // before L2CAP user dequeues. + } + rpc InitiateConnectionForSecurity(facade.BluetoothAddress) returns (facade.Empty) {} + rpc FetchSecurityConnectionEvents(facade.Empty) returns (stream LinkSecurityInterfaceCallbackEvent) {} + rpc SecurityLinkEnsureAuthenticated(facade.BluetoothAddress) returns (facade.Empty) {} + rpc SecurityLinkHold(facade.BluetoothAddress) returns (facade.Empty) {} + rpc SecurityLinkDisconnect(facade.BluetoothAddress) returns (facade.Empty) {} + rpc SecurityLinkRelease(facade.BluetoothAddress) returns (facade.Empty) {} +} + +enum LinkSecurityInterfaceCallbackEventType { + ON_CONNECTED = 0; + ON_DISCONNECTED = 1; + ON_AUTHENTICATION_COMPLETE = 2; + ON_ENCRYPTION_CHANGE = 3; + ON_READ_REMOTE_VERSION_INFO = 4; + ON_READ_REMOTE_EXTENDED_FEATURES = 5; +} + +message LinkSecurityInterfaceCallbackEvent { + facade.BluetoothAddress address = 1; + LinkSecurityInterfaceCallbackEventType event_type = 2; +} + +message RegisterChannelRequest { + uint32 channel = 1; +} + +message ConnectionCompleteEvent { + facade.BluetoothAddress remote = 1; +} + +message ConnectionCloseEvent { + facade.BluetoothAddress remote = 1; + uint32 reason = 2; +} + +enum RetransmissionFlowControlMode { + BASIC = 0; + ERTM = 1; + ERTM_OPTIONAL = 2; +} + +message OpenChannelRequest { + facade.BluetoothAddress remote = 1; + uint32 psm = 2; + RetransmissionFlowControlMode mode = 3; +} + +message CloseChannelRequest { + uint32 psm = 1; +} + +enum ChannelSignalEventType { + OPEN = 0; + CLOSE = 1; + CONFIGURE = 2; +} + +message ChannelSignalEvent { + uint32 cid = 1; + ChannelSignalEventType type = 2; +} + +enum SendL2capPacketResultType { + OK = 0; + BAD_CID = 1; +} + +message SendL2capPacketResult { + SendL2capPacketResultType result_type = 1; +} + +message L2capPacket { + oneof channel_type { + uint32 psm = 1; + uint32 fixed_cid = 2; + } + bytes payload = 3; +} + +message SetEnableDynamicChannelRequest { + uint32 psm = 1; + bool enable = 2; + RetransmissionFlowControlMode retransmission_mode = 3; +} + +message DynamicChannelPacket { + facade.BluetoothAddress remote = 1; + uint32 psm = 2; + bytes payload = 3; +} + +message SetTrafficPausedRequest { + bool paused = 1; + uint32 psm = 2; +} + +message GetChannelQueueDepthResponse { + uint32 size = 1; +} + +enum ClassicSecurityPolicy { + ENCRYPTED_TRANSPORT = 0; + AUTHENTICATED_ENCRYPTED_TRANSPORT = 1; + BEST = 2; + _SDP_ONLY_NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK = 3; +} diff --git a/proto/neighbor.proto b/proto/neighbor.proto new file mode 100644 index 0000000..6fb7b05 --- /dev/null +++ b/proto/neighbor.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; + +package bluetooth.neighbor; + +import "proto/common.proto"; + +service NeighborFacade { + rpc SetConnectability(EnableMsg) returns (facade.Empty) {} + rpc SetDiscoverability(DiscoverabilitiyMsg) returns (facade.Empty) {} + rpc SetInquiryMode(InquiryMsg) returns (stream InquiryResultMsg) { + // Sets inquiry mode and fetches inquiry result HCI packet + } + rpc ReadRemoteName(RemoteNameRequestMsg) returns (facade.Empty) {} + rpc GetRemoteNameEvents(facade.Empty) returns (stream RemoteNameResponseMsg) {} + // TODO: Should we use a blocking call for ReadRemoteName instead? (Note: blocking model may not work for GD stack) + rpc EnableInquiryScan(EnableMsg) returns (facade.Empty) {} + rpc EnablePageScan(EnableMsg) returns (facade.Empty) {} +} + +message EnableMsg { + bool enabled = 1; +} + +enum DiscoverabilityMode { + OFF = 0; + LIMITED = 1; + GENERAL = 2; +} + +message DiscoverabilitiyMsg { + DiscoverabilityMode mode = 1; +} + +enum ResultMode { + STANDARD = 0; + RSSI = 1; + EXTENDED = 2; +} + +message InquiryMsg { + DiscoverabilityMode inquiry_mode = 1; + ResultMode result_mode = 2; + uint32 length_1_28s = 3; + uint32 max_results = 4; // 0 is unlimited +} + +message InquiryResultMsg { + bytes packet = 1; +} + +message RemoteNameRequestMsg { + bytes address = 1; + uint32 page_scan_repetition_mode = 2; // r0, r1, r2 + uint32 clock_offset = 3; +} + +message RemoteNameResponseMsg { + uint32 status = 1; + bytes address = 2; + bytes name = 3; +} diff --git a/proto/rootservice.proto b/proto/rootservice.proto new file mode 100644 index 0000000..2ab245d --- /dev/null +++ b/proto/rootservice.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +package bluetooth.facade; + +import "proto/common.proto"; + +service RootFacade { + rpc StartStack(StartStackRequest) returns (StartStackResponse) {} + rpc StopStack(StopStackRequest) returns (StopStackResponse) {} +} + +enum BluetoothModule { + HAL = 0; + HCI = 1; + HCI_INTERFACES = 2; + L2CAP = 3; + SECURITY = 4; + SHIM = 5; +} + +message StartStackRequest { + BluetoothModule module_under_test = 1; +} + +message StartStackResponse {} + +message StopStackRequest {} + +message StopStackResponse {} + +service ReadOnlyProperty { + rpc ReadLocalAddress(Empty) returns (BluetoothAddress) {} +} \ No newline at end of file -- cgit v1.2.3 From 2e4202b9f163798e2b85c177e39853b80388568d Mon Sep 17 00:00:00 2001 From: David Duarte Date: Tue, 19 Oct 2021 14:21:39 +0000 Subject: grpc: Generate custom services Change-Id: I3784f9bf473e335a53f1e5d15a4426a1f2cfbd55 --- .gitignore | 4 +- README.md | 8 + build.sh | 18 - facade/__init__.py | 0 interact/__init__.py | 2 +- interact/l2cap.py | 51 +- lib/__init__.py | 0 lib/proto/__init__.py | 0 lib/proto/common_pb2.py | 304 ----------- lib/proto/common_pb2_grpc.py | 4 - lib/proto/l2cap_pb2.py | 1017 ------------------------------------- lib/proto/l2cap_pb2_grpc.py | 533 ------------------- lib/proto/neighbor_pb2.py | 481 ------------------ lib/proto/neighbor_pb2_grpc.py | 267 ---------- lib/proto/rootservice_pb2.py | 288 ----------- lib/proto/rootservice_pb2_grpc.py | 161 ------ proto/common.proto | 37 -- proto/facade/common.proto | 37 ++ proto/facade/l2cap.proto | 129 +++++ proto/facade/neighbor.proto | 61 +++ proto/facade/rootservice.proto | 32 ++ proto/l2cap.proto | 129 ----- proto/neighbor.proto | 61 --- proto/rootservice.proto | 32 -- protoc-gen-custom_grpc | 79 +++ requirements.txt | 3 + setup.py | 59 +++ 27 files changed, 432 insertions(+), 3365 deletions(-) create mode 100644 README.md delete mode 100755 build.sh create mode 100644 facade/__init__.py delete mode 100644 lib/__init__.py delete mode 100644 lib/proto/__init__.py delete mode 100644 lib/proto/common_pb2.py delete mode 100644 lib/proto/common_pb2_grpc.py delete mode 100644 lib/proto/l2cap_pb2.py delete mode 100644 lib/proto/l2cap_pb2_grpc.py delete mode 100644 lib/proto/neighbor_pb2.py delete mode 100644 lib/proto/neighbor_pb2_grpc.py delete mode 100644 lib/proto/rootservice_pb2.py delete mode 100644 lib/proto/rootservice_pb2_grpc.py delete mode 100644 proto/common.proto create mode 100644 proto/facade/common.proto create mode 100644 proto/facade/l2cap.proto create mode 100644 proto/facade/neighbor.proto create mode 100644 proto/facade/rootservice.proto delete mode 100644 proto/l2cap.proto delete mode 100644 proto/neighbor.proto delete mode 100644 proto/rootservice.proto create mode 100755 protoc-gen-custom_grpc create mode 100644 requirements.txt create mode 100755 setup.py diff --git a/.gitignore b/.gitignore index bbf3300..3b6e253 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ virtualenv out/ -__pycache__ \ No newline at end of file +__pycache__ +facade/* +!facade/__init__.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..298b0d2 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# mmi2grpc + +## Build grpc interfaces + +```bash +./setup.py build_grpc +``` + diff --git a/build.sh b/build.sh deleted file mode 100755 index d645542..0000000 --- a/build.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -PYTHON_OUT="lib" -PROTO_FOLDER="proto" - -mkdir ${PYTHON_OUT} - -python3 -m grpc_tools.protoc \ - -I . \ - --python_out=${PYTHON_OUT} \ - --grpc_python_out=${PYTHON_OUT} \ - "${PROTO_FOLDER}/l2cap.proto" \ - "${PROTO_FOLDER}/neighbor.proto" \ - "${PROTO_FOLDER}/common.proto" \ - "${PROTO_FOLDER}/rootservice.proto" - -touch "${PYTHON_OUT}/__init__.py" -touch "${PYTHON_OUT}/proto/__init__.py" \ No newline at end of file diff --git a/facade/__init__.py b/facade/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/interact/__init__.py b/interact/__init__.py index 9b5830a..0f08de1 100644 --- a/interact/__init__.py +++ b/interact/__init__.py @@ -6,4 +6,4 @@ GRPC_PORT = 8999 def run(profile: str, interaction_id: str, pts_addr: bytes): channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') if profile == "L2CAP": - l2cap.interact(channel, interaction_id, pts_addr) \ No newline at end of file + l2cap.interact(channel, interaction_id, pts_addr) diff --git a/interact/l2cap.py b/interact/l2cap.py index c31e042..4ee8e7d 100644 --- a/interact/l2cap.py +++ b/interact/l2cap.py @@ -1,58 +1,47 @@ import os from grpc import Channel -from lib.proto import l2cap_pb2_grpc -from lib.proto import neighbor_pb2_grpc -from lib.proto.common_pb2 import BluetoothAddress -from lib.proto.l2cap_pb2 import CloseChannelRequest, OpenChannelRequest, SetEnableDynamicChannelRequest, RetransmissionFlowControlMode, DynamicChannelPacket, OpenChannelRequest -from lib.proto.neighbor_pb2 import EnableMsg -PSM = 1 # TODO: Add it to either utils.py or config file +from facade import l2cap_grpc, neighbor_grpc +from facade.common_pb2 import BluetoothAddress +from facade.l2cap_pb2 import RetransmissionFlowControlMode +PSM = 1 # TODO: Add it to either utils.py or config file def interact(channel: Channel, interaction_id: str, pts_addr: bytes): print(f'mmi_id: {interaction_id}') addr = BluetoothAddress(address=pts_addr) - l2cap = l2cap_pb2_grpc.L2capClassicModuleFacadeStub(channel) - neighbor = neighbor_pb2_grpc.NeighborFacadeStub(channel) + l2cap = l2cap_grpc.L2capClassicModuleFacade(channel) + neighbor = neighbor_grpc.NeighborFacade(channel) if interaction_id == "MMI_TESTER_ENABLE_CONNECTION": - neighbor.EnablePageScan(EnableMsg(enabled=True)) + neighbor.EnablePageScan(enabled=True) l2cap.SetDynamicChannel( - SetEnableDynamicChannelRequest( - psm=PSM, - enable=True, - retransmission_mode=RetransmissionFlowControlMode.BASIC - ) + psm=PSM, + enable=True, + retransmission_mode=RetransmissionFlowControlMode.BASIC ) if interaction_id == "MMI_IUT_SEND_CONFIG_REQ": pass if interaction_id == "MMI_IUT_SEND_L2CAP_DATA": payload = b'\x00' + os.urandom(40) + b'\x00' l2cap.SendDynamicChannelPacket( - DynamicChannelPacket( - remote=addr, - psm=PSM, - payload=payload - ) + remote=addr, + psm=PSM, + payload=payload ) if interaction_id == "MMI_IUT_INITIATE_ACL_CONNECTION": l2cap.SetDynamicChannel( - SetEnableDynamicChannelRequest( - psm=PSM, - enable=True, - retransmission_mode=RetransmissionFlowControlMode.BASIC - ) + psm=PSM, + enable=True, + retransmission_mode=RetransmissionFlowControlMode.BASIC ) l2cap.OpenChannel( - OpenChannelRequest( - remote=addr, - psm=PSM, - mode=RetransmissionFlowControlMode.BASIC - ) + remote=addr, + psm=PSM, + mode=RetransmissionFlowControlMode.BASIC ) if interaction_id == ("MMI_IUT_DISABLE_CONNECTION" or "MMI_IUT_SEND_DISCONNECT_RSP"): - print(f'Sending CLOSE CHANNEL') - l2cap.CloseChannel(CloseChannelRequest(psm=PSM)) + l2cap.CloseChannel(psm=PSM) if interaction_id == "MMI_IUT_SEND_ACL_DISCONNECTON": pass if interaction_id == "MMI_IUT_SEND_CONFIG_RSP": diff --git a/lib/__init__.py b/lib/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/lib/proto/__init__.py b/lib/proto/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/lib/proto/common_pb2.py b/lib/proto/common_pb2.py deleted file mode 100644 index 6d55382..0000000 --- a/lib/proto/common_pb2.py +++ /dev/null @@ -1,304 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: proto/common.proto -"""Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='proto/common.proto', - package='bluetooth.facade', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x12proto/common.proto\x12\x10\x62luetooth.facade\"\x07\n\x05\x45mpty\"\x17\n\x04\x44\x61ta\x12\x0f\n\x07payload\x18\x01 \x01(\x0c\"#\n\x10\x42luetoothAddress\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0c\"\x89\x01\n\x18\x42luetoothAddressWithType\x12\x33\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\".bluetooth.facade.BluetoothAddress\x12\x38\n\x04type\x18\x02 \x01(\x0e\x32*.bluetooth.facade.BluetoothAddressTypeEnum*\x8a\x01\n\x18\x42luetoothAddressTypeEnum\x12\x19\n\x15PUBLIC_DEVICE_ADDRESS\x10\x00\x12\x19\n\x15RANDOM_DEVICE_ADDRESS\x10\x01\x12\x1b\n\x17PUBLIC_IDENTITY_ADDRESS\x10\x02\x12\x1b\n\x17RANDOM_IDENTITY_ADDRESS\x10\x03*\x9f\x01\n\x1b\x42luetoothOwnAddressTypeEnum\x12\x1d\n\x19USE_PUBLIC_DEVICE_ADDRESS\x10\x00\x12\x1d\n\x19USE_RANDOM_DEVICE_ADDRESS\x10\x01\x12 \n\x1cRESOLVABLE_OR_PUBLIC_ADDRESS\x10\x02\x12 \n\x1cRESOLVABLE_OR_RANDOM_ADDRESS\x10\x03*l\n\x1c\x42luetoothPeerAddressTypeEnum\x12%\n!PUBLIC_DEVICE_OR_IDENTITY_ADDRESS\x10\x00\x12%\n!RANDOM_DEVICE_OR_IDENTITY_ADDRESS\x10\x01\x62\x06proto3' -) - -_BLUETOOTHADDRESSTYPEENUM = _descriptor.EnumDescriptor( - name='BluetoothAddressTypeEnum', - full_name='bluetooth.facade.BluetoothAddressTypeEnum', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='PUBLIC_DEVICE_ADDRESS', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='RANDOM_DEVICE_ADDRESS', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='PUBLIC_IDENTITY_ADDRESS', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='RANDOM_IDENTITY_ADDRESS', index=3, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=252, - serialized_end=390, -) -_sym_db.RegisterEnumDescriptor(_BLUETOOTHADDRESSTYPEENUM) - -BluetoothAddressTypeEnum = enum_type_wrapper.EnumTypeWrapper(_BLUETOOTHADDRESSTYPEENUM) -_BLUETOOTHOWNADDRESSTYPEENUM = _descriptor.EnumDescriptor( - name='BluetoothOwnAddressTypeEnum', - full_name='bluetooth.facade.BluetoothOwnAddressTypeEnum', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='USE_PUBLIC_DEVICE_ADDRESS', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='USE_RANDOM_DEVICE_ADDRESS', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='RESOLVABLE_OR_PUBLIC_ADDRESS', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='RESOLVABLE_OR_RANDOM_ADDRESS', index=3, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=393, - serialized_end=552, -) -_sym_db.RegisterEnumDescriptor(_BLUETOOTHOWNADDRESSTYPEENUM) - -BluetoothOwnAddressTypeEnum = enum_type_wrapper.EnumTypeWrapper(_BLUETOOTHOWNADDRESSTYPEENUM) -_BLUETOOTHPEERADDRESSTYPEENUM = _descriptor.EnumDescriptor( - name='BluetoothPeerAddressTypeEnum', - full_name='bluetooth.facade.BluetoothPeerAddressTypeEnum', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='PUBLIC_DEVICE_OR_IDENTITY_ADDRESS', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='RANDOM_DEVICE_OR_IDENTITY_ADDRESS', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=554, - serialized_end=662, -) -_sym_db.RegisterEnumDescriptor(_BLUETOOTHPEERADDRESSTYPEENUM) - -BluetoothPeerAddressTypeEnum = enum_type_wrapper.EnumTypeWrapper(_BLUETOOTHPEERADDRESSTYPEENUM) -PUBLIC_DEVICE_ADDRESS = 0 -RANDOM_DEVICE_ADDRESS = 1 -PUBLIC_IDENTITY_ADDRESS = 2 -RANDOM_IDENTITY_ADDRESS = 3 -USE_PUBLIC_DEVICE_ADDRESS = 0 -USE_RANDOM_DEVICE_ADDRESS = 1 -RESOLVABLE_OR_PUBLIC_ADDRESS = 2 -RESOLVABLE_OR_RANDOM_ADDRESS = 3 -PUBLIC_DEVICE_OR_IDENTITY_ADDRESS = 0 -RANDOM_DEVICE_OR_IDENTITY_ADDRESS = 1 - - - -_EMPTY = _descriptor.Descriptor( - name='Empty', - full_name='bluetooth.facade.Empty', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=40, - serialized_end=47, -) - - -_DATA = _descriptor.Descriptor( - name='Data', - full_name='bluetooth.facade.Data', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='payload', full_name='bluetooth.facade.Data.payload', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=49, - serialized_end=72, -) - - -_BLUETOOTHADDRESS = _descriptor.Descriptor( - name='BluetoothAddress', - full_name='bluetooth.facade.BluetoothAddress', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='address', full_name='bluetooth.facade.BluetoothAddress.address', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=74, - serialized_end=109, -) - - -_BLUETOOTHADDRESSWITHTYPE = _descriptor.Descriptor( - name='BluetoothAddressWithType', - full_name='bluetooth.facade.BluetoothAddressWithType', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='address', full_name='bluetooth.facade.BluetoothAddressWithType.address', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='type', full_name='bluetooth.facade.BluetoothAddressWithType.type', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=112, - serialized_end=249, -) - -_BLUETOOTHADDRESSWITHTYPE.fields_by_name['address'].message_type = _BLUETOOTHADDRESS -_BLUETOOTHADDRESSWITHTYPE.fields_by_name['type'].enum_type = _BLUETOOTHADDRESSTYPEENUM -DESCRIPTOR.message_types_by_name['Empty'] = _EMPTY -DESCRIPTOR.message_types_by_name['Data'] = _DATA -DESCRIPTOR.message_types_by_name['BluetoothAddress'] = _BLUETOOTHADDRESS -DESCRIPTOR.message_types_by_name['BluetoothAddressWithType'] = _BLUETOOTHADDRESSWITHTYPE -DESCRIPTOR.enum_types_by_name['BluetoothAddressTypeEnum'] = _BLUETOOTHADDRESSTYPEENUM -DESCRIPTOR.enum_types_by_name['BluetoothOwnAddressTypeEnum'] = _BLUETOOTHOWNADDRESSTYPEENUM -DESCRIPTOR.enum_types_by_name['BluetoothPeerAddressTypeEnum'] = _BLUETOOTHPEERADDRESSTYPEENUM -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Empty = _reflection.GeneratedProtocolMessageType('Empty', (_message.Message,), { - 'DESCRIPTOR' : _EMPTY, - '__module__' : 'proto.common_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.facade.Empty) - }) -_sym_db.RegisterMessage(Empty) - -Data = _reflection.GeneratedProtocolMessageType('Data', (_message.Message,), { - 'DESCRIPTOR' : _DATA, - '__module__' : 'proto.common_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.facade.Data) - }) -_sym_db.RegisterMessage(Data) - -BluetoothAddress = _reflection.GeneratedProtocolMessageType('BluetoothAddress', (_message.Message,), { - 'DESCRIPTOR' : _BLUETOOTHADDRESS, - '__module__' : 'proto.common_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.facade.BluetoothAddress) - }) -_sym_db.RegisterMessage(BluetoothAddress) - -BluetoothAddressWithType = _reflection.GeneratedProtocolMessageType('BluetoothAddressWithType', (_message.Message,), { - 'DESCRIPTOR' : _BLUETOOTHADDRESSWITHTYPE, - '__module__' : 'proto.common_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.facade.BluetoothAddressWithType) - }) -_sym_db.RegisterMessage(BluetoothAddressWithType) - - -# @@protoc_insertion_point(module_scope) diff --git a/lib/proto/common_pb2_grpc.py b/lib/proto/common_pb2_grpc.py deleted file mode 100644 index 2daafff..0000000 --- a/lib/proto/common_pb2_grpc.py +++ /dev/null @@ -1,4 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - diff --git a/lib/proto/l2cap_pb2.py b/lib/proto/l2cap_pb2.py deleted file mode 100644 index f0bdde7..0000000 --- a/lib/proto/l2cap_pb2.py +++ /dev/null @@ -1,1017 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: proto/l2cap.proto -"""Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from . import common_pb2 as proto_dot_common__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='proto/l2cap.proto', - package='bluetooth.l2cap.classic', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x11proto/l2cap.proto\x12\x17\x62luetooth.l2cap.classic\x1a\x12proto/common.proto\"\xae\x01\n\"LinkSecurityInterfaceCallbackEvent\x12\x33\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\".bluetooth.facade.BluetoothAddress\x12S\n\nevent_type\x18\x02 \x01(\x0e\x32?.bluetooth.l2cap.classic.LinkSecurityInterfaceCallbackEventType\")\n\x16RegisterChannelRequest\x12\x0f\n\x07\x63hannel\x18\x01 \x01(\r\"M\n\x17\x43onnectionCompleteEvent\x12\x32\n\x06remote\x18\x01 \x01(\x0b\x32\".bluetooth.facade.BluetoothAddress\"Z\n\x14\x43onnectionCloseEvent\x12\x32\n\x06remote\x18\x01 \x01(\x0b\x32\".bluetooth.facade.BluetoothAddress\x12\x0e\n\x06reason\x18\x02 \x01(\r\"\x9b\x01\n\x12OpenChannelRequest\x12\x32\n\x06remote\x18\x01 \x01(\x0b\x32\".bluetooth.facade.BluetoothAddress\x12\x0b\n\x03psm\x18\x02 \x01(\r\x12\x44\n\x04mode\x18\x03 \x01(\x0e\x32\x36.bluetooth.l2cap.classic.RetransmissionFlowControlMode\"\"\n\x13\x43loseChannelRequest\x12\x0b\n\x03psm\x18\x01 \x01(\r\"`\n\x12\x43hannelSignalEvent\x12\x0b\n\x03\x63id\x18\x01 \x01(\r\x12=\n\x04type\x18\x02 \x01(\x0e\x32/.bluetooth.l2cap.classic.ChannelSignalEventType\"`\n\x15SendL2capPacketResult\x12G\n\x0bresult_type\x18\x01 \x01(\x0e\x32\x32.bluetooth.l2cap.classic.SendL2capPacketResultType\"R\n\x0bL2capPacket\x12\r\n\x03psm\x18\x01 \x01(\rH\x00\x12\x13\n\tfixed_cid\x18\x02 \x01(\rH\x00\x12\x0f\n\x07payload\x18\x03 \x01(\x0c\x42\x0e\n\x0c\x63hannel_type\"\x92\x01\n\x1eSetEnableDynamicChannelRequest\x12\x0b\n\x03psm\x18\x01 \x01(\r\x12\x0e\n\x06\x65nable\x18\x02 \x01(\x08\x12S\n\x13retransmission_mode\x18\x03 \x01(\x0e\x32\x36.bluetooth.l2cap.classic.RetransmissionFlowControlMode\"h\n\x14\x44ynamicChannelPacket\x12\x32\n\x06remote\x18\x01 \x01(\x0b\x32\".bluetooth.facade.BluetoothAddress\x12\x0b\n\x03psm\x18\x02 \x01(\r\x12\x0f\n\x07payload\x18\x03 \x01(\x0c\"6\n\x17SetTrafficPausedRequest\x12\x0e\n\x06paused\x18\x01 \x01(\x08\x12\x0b\n\x03psm\x18\x02 \x01(\r\",\n\x1cGetChannelQueueDepthResponse\x12\x0c\n\x04size\x18\x01 \x01(\r*\xd0\x01\n&LinkSecurityInterfaceCallbackEventType\x12\x10\n\x0cON_CONNECTED\x10\x00\x12\x13\n\x0fON_DISCONNECTED\x10\x01\x12\x1e\n\x1aON_AUTHENTICATION_COMPLETE\x10\x02\x12\x18\n\x14ON_ENCRYPTION_CHANGE\x10\x03\x12\x1f\n\x1bON_READ_REMOTE_VERSION_INFO\x10\x04\x12$\n ON_READ_REMOTE_EXTENDED_FEATURES\x10\x05*G\n\x1dRetransmissionFlowControlMode\x12\t\n\x05\x42\x41SIC\x10\x00\x12\x08\n\x04\x45RTM\x10\x01\x12\x11\n\rERTM_OPTIONAL\x10\x02*<\n\x16\x43hannelSignalEventType\x12\x08\n\x04OPEN\x10\x00\x12\t\n\x05\x43LOSE\x10\x01\x12\r\n\tCONFIGURE\x10\x02*0\n\x19SendL2capPacketResultType\x12\x06\n\x02OK\x10\x00\x12\x0b\n\x07\x42\x41\x44_CID\x10\x01*\x9e\x01\n\x15\x43lassicSecurityPolicy\x12\x17\n\x13\x45NCRYPTED_TRANSPORT\x10\x00\x12%\n!AUTHENTICATED_ENCRYPTED_TRANSPORT\x10\x01\x12\x08\n\x04\x42\x45ST\x10\x02\x12;\n7_SDP_ONLY_NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK\x10\x03\x32\xc6\x0b\n\x18L2capClassicModuleFacade\x12h\n\x17\x46\x65tchConnectionComplete\x12\x17.bluetooth.facade.Empty\x1a\x30.bluetooth.l2cap.classic.ConnectionCompleteEvent\"\x00\x30\x01\x12\x62\n\x14\x46\x65tchConnectionClose\x12\x17.bluetooth.facade.Empty\x1a-.bluetooth.l2cap.classic.ConnectionCloseEvent\"\x00\x30\x01\x12U\n\x0bOpenChannel\x12+.bluetooth.l2cap.classic.OpenChannelRequest\x1a\x17.bluetooth.facade.Empty\"\x00\x12W\n\x0c\x43loseChannel\x12,.bluetooth.l2cap.classic.CloseChannelRequest\x1a\x17.bluetooth.facade.Empty\"\x00\x12S\n\x0e\x46\x65tchL2capData\x12\x17.bluetooth.facade.Empty\x1a$.bluetooth.l2cap.classic.L2capPacket\"\x00\x30\x01\x12g\n\x11SetDynamicChannel\x12\x37.bluetooth.l2cap.classic.SetEnableDynamicChannelRequest\x1a\x17.bluetooth.facade.Empty\"\x00\x12\x64\n\x18SendDynamicChannelPacket\x12-.bluetooth.l2cap.classic.DynamicChannelPacket\x1a\x17.bluetooth.facade.Empty\"\x00\x12_\n\x10SetTrafficPaused\x12\x30.bluetooth.l2cap.classic.SetTrafficPausedRequest\x1a\x17.bluetooth.facade.Empty\"\x00\x12h\n\x14GetChannelQueueDepth\x12\x17.bluetooth.facade.Empty\x1a\x35.bluetooth.l2cap.classic.GetChannelQueueDepthResponse\"\x00\x12^\n\x1dInitiateConnectionForSecurity\x12\".bluetooth.facade.BluetoothAddress\x1a\x17.bluetooth.facade.Empty\"\x00\x12y\n\x1d\x46\x65tchSecurityConnectionEvents\x12\x17.bluetooth.facade.Empty\x1a;.bluetooth.l2cap.classic.LinkSecurityInterfaceCallbackEvent\"\x00\x30\x01\x12`\n\x1fSecurityLinkEnsureAuthenticated\x12\".bluetooth.facade.BluetoothAddress\x1a\x17.bluetooth.facade.Empty\"\x00\x12Q\n\x10SecurityLinkHold\x12\".bluetooth.facade.BluetoothAddress\x1a\x17.bluetooth.facade.Empty\"\x00\x12W\n\x16SecurityLinkDisconnect\x12\".bluetooth.facade.BluetoothAddress\x1a\x17.bluetooth.facade.Empty\"\x00\x12T\n\x13SecurityLinkRelease\x12\".bluetooth.facade.BluetoothAddress\x1a\x17.bluetooth.facade.Empty\"\x00\x62\x06proto3' - , - dependencies=[proto_dot_common__pb2.DESCRIPTOR,]) - -_LINKSECURITYINTERFACECALLBACKEVENTTYPE = _descriptor.EnumDescriptor( - name='LinkSecurityInterfaceCallbackEventType', - full_name='bluetooth.l2cap.classic.LinkSecurityInterfaceCallbackEventType', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='ON_CONNECTED', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ON_DISCONNECTED', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ON_AUTHENTICATION_COMPLETE', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ON_ENCRYPTION_CHANGE', index=3, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ON_READ_REMOTE_VERSION_INFO', index=4, number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ON_READ_REMOTE_EXTENDED_FEATURES', index=5, number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=1289, - serialized_end=1497, -) -_sym_db.RegisterEnumDescriptor(_LINKSECURITYINTERFACECALLBACKEVENTTYPE) - -LinkSecurityInterfaceCallbackEventType = enum_type_wrapper.EnumTypeWrapper(_LINKSECURITYINTERFACECALLBACKEVENTTYPE) -_RETRANSMISSIONFLOWCONTROLMODE = _descriptor.EnumDescriptor( - name='RetransmissionFlowControlMode', - full_name='bluetooth.l2cap.classic.RetransmissionFlowControlMode', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='BASIC', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ERTM', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ERTM_OPTIONAL', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=1499, - serialized_end=1570, -) -_sym_db.RegisterEnumDescriptor(_RETRANSMISSIONFLOWCONTROLMODE) - -RetransmissionFlowControlMode = enum_type_wrapper.EnumTypeWrapper(_RETRANSMISSIONFLOWCONTROLMODE) -_CHANNELSIGNALEVENTTYPE = _descriptor.EnumDescriptor( - name='ChannelSignalEventType', - full_name='bluetooth.l2cap.classic.ChannelSignalEventType', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='OPEN', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='CLOSE', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='CONFIGURE', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=1572, - serialized_end=1632, -) -_sym_db.RegisterEnumDescriptor(_CHANNELSIGNALEVENTTYPE) - -ChannelSignalEventType = enum_type_wrapper.EnumTypeWrapper(_CHANNELSIGNALEVENTTYPE) -_SENDL2CAPPACKETRESULTTYPE = _descriptor.EnumDescriptor( - name='SendL2capPacketResultType', - full_name='bluetooth.l2cap.classic.SendL2capPacketResultType', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='OK', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='BAD_CID', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=1634, - serialized_end=1682, -) -_sym_db.RegisterEnumDescriptor(_SENDL2CAPPACKETRESULTTYPE) - -SendL2capPacketResultType = enum_type_wrapper.EnumTypeWrapper(_SENDL2CAPPACKETRESULTTYPE) -_CLASSICSECURITYPOLICY = _descriptor.EnumDescriptor( - name='ClassicSecurityPolicy', - full_name='bluetooth.l2cap.classic.ClassicSecurityPolicy', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='ENCRYPTED_TRANSPORT', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='AUTHENTICATED_ENCRYPTED_TRANSPORT', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='BEST', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='_SDP_ONLY_NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK', index=3, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=1685, - serialized_end=1843, -) -_sym_db.RegisterEnumDescriptor(_CLASSICSECURITYPOLICY) - -ClassicSecurityPolicy = enum_type_wrapper.EnumTypeWrapper(_CLASSICSECURITYPOLICY) -ON_CONNECTED = 0 -ON_DISCONNECTED = 1 -ON_AUTHENTICATION_COMPLETE = 2 -ON_ENCRYPTION_CHANGE = 3 -ON_READ_REMOTE_VERSION_INFO = 4 -ON_READ_REMOTE_EXTENDED_FEATURES = 5 -BASIC = 0 -ERTM = 1 -ERTM_OPTIONAL = 2 -OPEN = 0 -CLOSE = 1 -CONFIGURE = 2 -OK = 0 -BAD_CID = 1 -ENCRYPTED_TRANSPORT = 0 -AUTHENTICATED_ENCRYPTED_TRANSPORT = 1 -BEST = 2 -_SDP_ONLY_NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK = 3 - - - -_LINKSECURITYINTERFACECALLBACKEVENT = _descriptor.Descriptor( - name='LinkSecurityInterfaceCallbackEvent', - full_name='bluetooth.l2cap.classic.LinkSecurityInterfaceCallbackEvent', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='address', full_name='bluetooth.l2cap.classic.LinkSecurityInterfaceCallbackEvent.address', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='event_type', full_name='bluetooth.l2cap.classic.LinkSecurityInterfaceCallbackEvent.event_type', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=67, - serialized_end=241, -) - - -_REGISTERCHANNELREQUEST = _descriptor.Descriptor( - name='RegisterChannelRequest', - full_name='bluetooth.l2cap.classic.RegisterChannelRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='channel', full_name='bluetooth.l2cap.classic.RegisterChannelRequest.channel', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=243, - serialized_end=284, -) - - -_CONNECTIONCOMPLETEEVENT = _descriptor.Descriptor( - name='ConnectionCompleteEvent', - full_name='bluetooth.l2cap.classic.ConnectionCompleteEvent', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='remote', full_name='bluetooth.l2cap.classic.ConnectionCompleteEvent.remote', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=286, - serialized_end=363, -) - - -_CONNECTIONCLOSEEVENT = _descriptor.Descriptor( - name='ConnectionCloseEvent', - full_name='bluetooth.l2cap.classic.ConnectionCloseEvent', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='remote', full_name='bluetooth.l2cap.classic.ConnectionCloseEvent.remote', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='reason', full_name='bluetooth.l2cap.classic.ConnectionCloseEvent.reason', index=1, - number=2, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=365, - serialized_end=455, -) - - -_OPENCHANNELREQUEST = _descriptor.Descriptor( - name='OpenChannelRequest', - full_name='bluetooth.l2cap.classic.OpenChannelRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='remote', full_name='bluetooth.l2cap.classic.OpenChannelRequest.remote', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='psm', full_name='bluetooth.l2cap.classic.OpenChannelRequest.psm', index=1, - number=2, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='mode', full_name='bluetooth.l2cap.classic.OpenChannelRequest.mode', index=2, - number=3, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=458, - serialized_end=613, -) - - -_CLOSECHANNELREQUEST = _descriptor.Descriptor( - name='CloseChannelRequest', - full_name='bluetooth.l2cap.classic.CloseChannelRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='psm', full_name='bluetooth.l2cap.classic.CloseChannelRequest.psm', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=615, - serialized_end=649, -) - - -_CHANNELSIGNALEVENT = _descriptor.Descriptor( - name='ChannelSignalEvent', - full_name='bluetooth.l2cap.classic.ChannelSignalEvent', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='cid', full_name='bluetooth.l2cap.classic.ChannelSignalEvent.cid', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='type', full_name='bluetooth.l2cap.classic.ChannelSignalEvent.type', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=651, - serialized_end=747, -) - - -_SENDL2CAPPACKETRESULT = _descriptor.Descriptor( - name='SendL2capPacketResult', - full_name='bluetooth.l2cap.classic.SendL2capPacketResult', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='result_type', full_name='bluetooth.l2cap.classic.SendL2capPacketResult.result_type', index=0, - number=1, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=749, - serialized_end=845, -) - - -_L2CAPPACKET = _descriptor.Descriptor( - name='L2capPacket', - full_name='bluetooth.l2cap.classic.L2capPacket', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='psm', full_name='bluetooth.l2cap.classic.L2capPacket.psm', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='fixed_cid', full_name='bluetooth.l2cap.classic.L2capPacket.fixed_cid', index=1, - number=2, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='payload', full_name='bluetooth.l2cap.classic.L2capPacket.payload', index=2, - number=3, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='channel_type', full_name='bluetooth.l2cap.classic.L2capPacket.channel_type', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=847, - serialized_end=929, -) - - -_SETENABLEDYNAMICCHANNELREQUEST = _descriptor.Descriptor( - name='SetEnableDynamicChannelRequest', - full_name='bluetooth.l2cap.classic.SetEnableDynamicChannelRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='psm', full_name='bluetooth.l2cap.classic.SetEnableDynamicChannelRequest.psm', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='enable', full_name='bluetooth.l2cap.classic.SetEnableDynamicChannelRequest.enable', index=1, - number=2, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='retransmission_mode', full_name='bluetooth.l2cap.classic.SetEnableDynamicChannelRequest.retransmission_mode', index=2, - number=3, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=932, - serialized_end=1078, -) - - -_DYNAMICCHANNELPACKET = _descriptor.Descriptor( - name='DynamicChannelPacket', - full_name='bluetooth.l2cap.classic.DynamicChannelPacket', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='remote', full_name='bluetooth.l2cap.classic.DynamicChannelPacket.remote', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='psm', full_name='bluetooth.l2cap.classic.DynamicChannelPacket.psm', index=1, - number=2, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='payload', full_name='bluetooth.l2cap.classic.DynamicChannelPacket.payload', index=2, - number=3, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1080, - serialized_end=1184, -) - - -_SETTRAFFICPAUSEDREQUEST = _descriptor.Descriptor( - name='SetTrafficPausedRequest', - full_name='bluetooth.l2cap.classic.SetTrafficPausedRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='paused', full_name='bluetooth.l2cap.classic.SetTrafficPausedRequest.paused', index=0, - number=1, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='psm', full_name='bluetooth.l2cap.classic.SetTrafficPausedRequest.psm', index=1, - number=2, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1186, - serialized_end=1240, -) - - -_GETCHANNELQUEUEDEPTHRESPONSE = _descriptor.Descriptor( - name='GetChannelQueueDepthResponse', - full_name='bluetooth.l2cap.classic.GetChannelQueueDepthResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='size', full_name='bluetooth.l2cap.classic.GetChannelQueueDepthResponse.size', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1242, - serialized_end=1286, -) - -_LINKSECURITYINTERFACECALLBACKEVENT.fields_by_name['address'].message_type = proto_dot_common__pb2._BLUETOOTHADDRESS -_LINKSECURITYINTERFACECALLBACKEVENT.fields_by_name['event_type'].enum_type = _LINKSECURITYINTERFACECALLBACKEVENTTYPE -_CONNECTIONCOMPLETEEVENT.fields_by_name['remote'].message_type = proto_dot_common__pb2._BLUETOOTHADDRESS -_CONNECTIONCLOSEEVENT.fields_by_name['remote'].message_type = proto_dot_common__pb2._BLUETOOTHADDRESS -_OPENCHANNELREQUEST.fields_by_name['remote'].message_type = proto_dot_common__pb2._BLUETOOTHADDRESS -_OPENCHANNELREQUEST.fields_by_name['mode'].enum_type = _RETRANSMISSIONFLOWCONTROLMODE -_CHANNELSIGNALEVENT.fields_by_name['type'].enum_type = _CHANNELSIGNALEVENTTYPE -_SENDL2CAPPACKETRESULT.fields_by_name['result_type'].enum_type = _SENDL2CAPPACKETRESULTTYPE -_L2CAPPACKET.oneofs_by_name['channel_type'].fields.append( - _L2CAPPACKET.fields_by_name['psm']) -_L2CAPPACKET.fields_by_name['psm'].containing_oneof = _L2CAPPACKET.oneofs_by_name['channel_type'] -_L2CAPPACKET.oneofs_by_name['channel_type'].fields.append( - _L2CAPPACKET.fields_by_name['fixed_cid']) -_L2CAPPACKET.fields_by_name['fixed_cid'].containing_oneof = _L2CAPPACKET.oneofs_by_name['channel_type'] -_SETENABLEDYNAMICCHANNELREQUEST.fields_by_name['retransmission_mode'].enum_type = _RETRANSMISSIONFLOWCONTROLMODE -_DYNAMICCHANNELPACKET.fields_by_name['remote'].message_type = proto_dot_common__pb2._BLUETOOTHADDRESS -DESCRIPTOR.message_types_by_name['LinkSecurityInterfaceCallbackEvent'] = _LINKSECURITYINTERFACECALLBACKEVENT -DESCRIPTOR.message_types_by_name['RegisterChannelRequest'] = _REGISTERCHANNELREQUEST -DESCRIPTOR.message_types_by_name['ConnectionCompleteEvent'] = _CONNECTIONCOMPLETEEVENT -DESCRIPTOR.message_types_by_name['ConnectionCloseEvent'] = _CONNECTIONCLOSEEVENT -DESCRIPTOR.message_types_by_name['OpenChannelRequest'] = _OPENCHANNELREQUEST -DESCRIPTOR.message_types_by_name['CloseChannelRequest'] = _CLOSECHANNELREQUEST -DESCRIPTOR.message_types_by_name['ChannelSignalEvent'] = _CHANNELSIGNALEVENT -DESCRIPTOR.message_types_by_name['SendL2capPacketResult'] = _SENDL2CAPPACKETRESULT -DESCRIPTOR.message_types_by_name['L2capPacket'] = _L2CAPPACKET -DESCRIPTOR.message_types_by_name['SetEnableDynamicChannelRequest'] = _SETENABLEDYNAMICCHANNELREQUEST -DESCRIPTOR.message_types_by_name['DynamicChannelPacket'] = _DYNAMICCHANNELPACKET -DESCRIPTOR.message_types_by_name['SetTrafficPausedRequest'] = _SETTRAFFICPAUSEDREQUEST -DESCRIPTOR.message_types_by_name['GetChannelQueueDepthResponse'] = _GETCHANNELQUEUEDEPTHRESPONSE -DESCRIPTOR.enum_types_by_name['LinkSecurityInterfaceCallbackEventType'] = _LINKSECURITYINTERFACECALLBACKEVENTTYPE -DESCRIPTOR.enum_types_by_name['RetransmissionFlowControlMode'] = _RETRANSMISSIONFLOWCONTROLMODE -DESCRIPTOR.enum_types_by_name['ChannelSignalEventType'] = _CHANNELSIGNALEVENTTYPE -DESCRIPTOR.enum_types_by_name['SendL2capPacketResultType'] = _SENDL2CAPPACKETRESULTTYPE -DESCRIPTOR.enum_types_by_name['ClassicSecurityPolicy'] = _CLASSICSECURITYPOLICY -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -LinkSecurityInterfaceCallbackEvent = _reflection.GeneratedProtocolMessageType('LinkSecurityInterfaceCallbackEvent', (_message.Message,), { - 'DESCRIPTOR' : _LINKSECURITYINTERFACECALLBACKEVENT, - '__module__' : 'proto.l2cap_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.LinkSecurityInterfaceCallbackEvent) - }) -_sym_db.RegisterMessage(LinkSecurityInterfaceCallbackEvent) - -RegisterChannelRequest = _reflection.GeneratedProtocolMessageType('RegisterChannelRequest', (_message.Message,), { - 'DESCRIPTOR' : _REGISTERCHANNELREQUEST, - '__module__' : 'proto.l2cap_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.RegisterChannelRequest) - }) -_sym_db.RegisterMessage(RegisterChannelRequest) - -ConnectionCompleteEvent = _reflection.GeneratedProtocolMessageType('ConnectionCompleteEvent', (_message.Message,), { - 'DESCRIPTOR' : _CONNECTIONCOMPLETEEVENT, - '__module__' : 'proto.l2cap_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.ConnectionCompleteEvent) - }) -_sym_db.RegisterMessage(ConnectionCompleteEvent) - -ConnectionCloseEvent = _reflection.GeneratedProtocolMessageType('ConnectionCloseEvent', (_message.Message,), { - 'DESCRIPTOR' : _CONNECTIONCLOSEEVENT, - '__module__' : 'proto.l2cap_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.ConnectionCloseEvent) - }) -_sym_db.RegisterMessage(ConnectionCloseEvent) - -OpenChannelRequest = _reflection.GeneratedProtocolMessageType('OpenChannelRequest', (_message.Message,), { - 'DESCRIPTOR' : _OPENCHANNELREQUEST, - '__module__' : 'proto.l2cap_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.OpenChannelRequest) - }) -_sym_db.RegisterMessage(OpenChannelRequest) - -CloseChannelRequest = _reflection.GeneratedProtocolMessageType('CloseChannelRequest', (_message.Message,), { - 'DESCRIPTOR' : _CLOSECHANNELREQUEST, - '__module__' : 'proto.l2cap_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.CloseChannelRequest) - }) -_sym_db.RegisterMessage(CloseChannelRequest) - -ChannelSignalEvent = _reflection.GeneratedProtocolMessageType('ChannelSignalEvent', (_message.Message,), { - 'DESCRIPTOR' : _CHANNELSIGNALEVENT, - '__module__' : 'proto.l2cap_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.ChannelSignalEvent) - }) -_sym_db.RegisterMessage(ChannelSignalEvent) - -SendL2capPacketResult = _reflection.GeneratedProtocolMessageType('SendL2capPacketResult', (_message.Message,), { - 'DESCRIPTOR' : _SENDL2CAPPACKETRESULT, - '__module__' : 'proto.l2cap_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.SendL2capPacketResult) - }) -_sym_db.RegisterMessage(SendL2capPacketResult) - -L2capPacket = _reflection.GeneratedProtocolMessageType('L2capPacket', (_message.Message,), { - 'DESCRIPTOR' : _L2CAPPACKET, - '__module__' : 'proto.l2cap_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.L2capPacket) - }) -_sym_db.RegisterMessage(L2capPacket) - -SetEnableDynamicChannelRequest = _reflection.GeneratedProtocolMessageType('SetEnableDynamicChannelRequest', (_message.Message,), { - 'DESCRIPTOR' : _SETENABLEDYNAMICCHANNELREQUEST, - '__module__' : 'proto.l2cap_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.SetEnableDynamicChannelRequest) - }) -_sym_db.RegisterMessage(SetEnableDynamicChannelRequest) - -DynamicChannelPacket = _reflection.GeneratedProtocolMessageType('DynamicChannelPacket', (_message.Message,), { - 'DESCRIPTOR' : _DYNAMICCHANNELPACKET, - '__module__' : 'proto.l2cap_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.DynamicChannelPacket) - }) -_sym_db.RegisterMessage(DynamicChannelPacket) - -SetTrafficPausedRequest = _reflection.GeneratedProtocolMessageType('SetTrafficPausedRequest', (_message.Message,), { - 'DESCRIPTOR' : _SETTRAFFICPAUSEDREQUEST, - '__module__' : 'proto.l2cap_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.SetTrafficPausedRequest) - }) -_sym_db.RegisterMessage(SetTrafficPausedRequest) - -GetChannelQueueDepthResponse = _reflection.GeneratedProtocolMessageType('GetChannelQueueDepthResponse', (_message.Message,), { - 'DESCRIPTOR' : _GETCHANNELQUEUEDEPTHRESPONSE, - '__module__' : 'proto.l2cap_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.l2cap.classic.GetChannelQueueDepthResponse) - }) -_sym_db.RegisterMessage(GetChannelQueueDepthResponse) - - - -_L2CAPCLASSICMODULEFACADE = _descriptor.ServiceDescriptor( - name='L2capClassicModuleFacade', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade', - file=DESCRIPTOR, - index=0, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=1846, - serialized_end=3324, - methods=[ - _descriptor.MethodDescriptor( - name='FetchConnectionComplete', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.FetchConnectionComplete', - index=0, - containing_service=None, - input_type=proto_dot_common__pb2._EMPTY, - output_type=_CONNECTIONCOMPLETEEVENT, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='FetchConnectionClose', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.FetchConnectionClose', - index=1, - containing_service=None, - input_type=proto_dot_common__pb2._EMPTY, - output_type=_CONNECTIONCLOSEEVENT, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='OpenChannel', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.OpenChannel', - index=2, - containing_service=None, - input_type=_OPENCHANNELREQUEST, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='CloseChannel', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.CloseChannel', - index=3, - containing_service=None, - input_type=_CLOSECHANNELREQUEST, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='FetchL2capData', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.FetchL2capData', - index=4, - containing_service=None, - input_type=proto_dot_common__pb2._EMPTY, - output_type=_L2CAPPACKET, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='SetDynamicChannel', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.SetDynamicChannel', - index=5, - containing_service=None, - input_type=_SETENABLEDYNAMICCHANNELREQUEST, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='SendDynamicChannelPacket', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.SendDynamicChannelPacket', - index=6, - containing_service=None, - input_type=_DYNAMICCHANNELPACKET, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='SetTrafficPaused', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.SetTrafficPaused', - index=7, - containing_service=None, - input_type=_SETTRAFFICPAUSEDREQUEST, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='GetChannelQueueDepth', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.GetChannelQueueDepth', - index=8, - containing_service=None, - input_type=proto_dot_common__pb2._EMPTY, - output_type=_GETCHANNELQUEUEDEPTHRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='InitiateConnectionForSecurity', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.InitiateConnectionForSecurity', - index=9, - containing_service=None, - input_type=proto_dot_common__pb2._BLUETOOTHADDRESS, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='FetchSecurityConnectionEvents', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.FetchSecurityConnectionEvents', - index=10, - containing_service=None, - input_type=proto_dot_common__pb2._EMPTY, - output_type=_LINKSECURITYINTERFACECALLBACKEVENT, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='SecurityLinkEnsureAuthenticated', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.SecurityLinkEnsureAuthenticated', - index=11, - containing_service=None, - input_type=proto_dot_common__pb2._BLUETOOTHADDRESS, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='SecurityLinkHold', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.SecurityLinkHold', - index=12, - containing_service=None, - input_type=proto_dot_common__pb2._BLUETOOTHADDRESS, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='SecurityLinkDisconnect', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.SecurityLinkDisconnect', - index=13, - containing_service=None, - input_type=proto_dot_common__pb2._BLUETOOTHADDRESS, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='SecurityLinkRelease', - full_name='bluetooth.l2cap.classic.L2capClassicModuleFacade.SecurityLinkRelease', - index=14, - containing_service=None, - input_type=proto_dot_common__pb2._BLUETOOTHADDRESS, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_L2CAPCLASSICMODULEFACADE) - -DESCRIPTOR.services_by_name['L2capClassicModuleFacade'] = _L2CAPCLASSICMODULEFACADE - -# @@protoc_insertion_point(module_scope) diff --git a/lib/proto/l2cap_pb2_grpc.py b/lib/proto/l2cap_pb2_grpc.py deleted file mode 100644 index 74b9a86..0000000 --- a/lib/proto/l2cap_pb2_grpc.py +++ /dev/null @@ -1,533 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from . import common_pb2 as proto_dot_common__pb2 -from . import l2cap_pb2 as proto_dot_l2cap__pb2 - - -class L2capClassicModuleFacadeStub(object): - """Missing associated documentation comment in .proto file.""" - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.FetchConnectionComplete = channel.unary_stream( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchConnectionComplete', - request_serializer=proto_dot_common__pb2.Empty.SerializeToString, - response_deserializer=proto_dot_l2cap__pb2.ConnectionCompleteEvent.FromString, - ) - self.FetchConnectionClose = channel.unary_stream( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchConnectionClose', - request_serializer=proto_dot_common__pb2.Empty.SerializeToString, - response_deserializer=proto_dot_l2cap__pb2.ConnectionCloseEvent.FromString, - ) - self.OpenChannel = channel.unary_unary( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/OpenChannel', - request_serializer=proto_dot_l2cap__pb2.OpenChannelRequest.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - self.CloseChannel = channel.unary_unary( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/CloseChannel', - request_serializer=proto_dot_l2cap__pb2.CloseChannelRequest.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - self.FetchL2capData = channel.unary_stream( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchL2capData', - request_serializer=proto_dot_common__pb2.Empty.SerializeToString, - response_deserializer=proto_dot_l2cap__pb2.L2capPacket.FromString, - ) - self.SetDynamicChannel = channel.unary_unary( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SetDynamicChannel', - request_serializer=proto_dot_l2cap__pb2.SetEnableDynamicChannelRequest.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - self.SendDynamicChannelPacket = channel.unary_unary( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SendDynamicChannelPacket', - request_serializer=proto_dot_l2cap__pb2.DynamicChannelPacket.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - self.SetTrafficPaused = channel.unary_unary( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SetTrafficPaused', - request_serializer=proto_dot_l2cap__pb2.SetTrafficPausedRequest.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - self.GetChannelQueueDepth = channel.unary_unary( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/GetChannelQueueDepth', - request_serializer=proto_dot_common__pb2.Empty.SerializeToString, - response_deserializer=proto_dot_l2cap__pb2.GetChannelQueueDepthResponse.FromString, - ) - self.InitiateConnectionForSecurity = channel.unary_unary( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/InitiateConnectionForSecurity', - request_serializer=proto_dot_common__pb2.BluetoothAddress.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - self.FetchSecurityConnectionEvents = channel.unary_stream( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchSecurityConnectionEvents', - request_serializer=proto_dot_common__pb2.Empty.SerializeToString, - response_deserializer=proto_dot_l2cap__pb2.LinkSecurityInterfaceCallbackEvent.FromString, - ) - self.SecurityLinkEnsureAuthenticated = channel.unary_unary( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkEnsureAuthenticated', - request_serializer=proto_dot_common__pb2.BluetoothAddress.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - self.SecurityLinkHold = channel.unary_unary( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkHold', - request_serializer=proto_dot_common__pb2.BluetoothAddress.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - self.SecurityLinkDisconnect = channel.unary_unary( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkDisconnect', - request_serializer=proto_dot_common__pb2.BluetoothAddress.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - self.SecurityLinkRelease = channel.unary_unary( - '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkRelease', - request_serializer=proto_dot_common__pb2.BluetoothAddress.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - - -class L2capClassicModuleFacadeServicer(object): - """Missing associated documentation comment in .proto file.""" - - def FetchConnectionComplete(self, request, context): - """Testing Android Bluetooth stack only. Optional for other stack. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def FetchConnectionClose(self, request, context): - """Testing Android Bluetooth stack only. Optional for other stack. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def OpenChannel(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def CloseChannel(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def FetchL2capData(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def SetDynamicChannel(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def SendDynamicChannelPacket(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def SetTrafficPaused(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def GetChannelQueueDepth(self, request, context): - """Get the buffer size of channel queue end for L2CAP user (how many packets we can buffer - before L2CAP user dequeues. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def InitiateConnectionForSecurity(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def FetchSecurityConnectionEvents(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def SecurityLinkEnsureAuthenticated(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def SecurityLinkHold(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def SecurityLinkDisconnect(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def SecurityLinkRelease(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_L2capClassicModuleFacadeServicer_to_server(servicer, server): - rpc_method_handlers = { - 'FetchConnectionComplete': grpc.unary_stream_rpc_method_handler( - servicer.FetchConnectionComplete, - request_deserializer=proto_dot_common__pb2.Empty.FromString, - response_serializer=proto_dot_l2cap__pb2.ConnectionCompleteEvent.SerializeToString, - ), - 'FetchConnectionClose': grpc.unary_stream_rpc_method_handler( - servicer.FetchConnectionClose, - request_deserializer=proto_dot_common__pb2.Empty.FromString, - response_serializer=proto_dot_l2cap__pb2.ConnectionCloseEvent.SerializeToString, - ), - 'OpenChannel': grpc.unary_unary_rpc_method_handler( - servicer.OpenChannel, - request_deserializer=proto_dot_l2cap__pb2.OpenChannelRequest.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - 'CloseChannel': grpc.unary_unary_rpc_method_handler( - servicer.CloseChannel, - request_deserializer=proto_dot_l2cap__pb2.CloseChannelRequest.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - 'FetchL2capData': grpc.unary_stream_rpc_method_handler( - servicer.FetchL2capData, - request_deserializer=proto_dot_common__pb2.Empty.FromString, - response_serializer=proto_dot_l2cap__pb2.L2capPacket.SerializeToString, - ), - 'SetDynamicChannel': grpc.unary_unary_rpc_method_handler( - servicer.SetDynamicChannel, - request_deserializer=proto_dot_l2cap__pb2.SetEnableDynamicChannelRequest.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - 'SendDynamicChannelPacket': grpc.unary_unary_rpc_method_handler( - servicer.SendDynamicChannelPacket, - request_deserializer=proto_dot_l2cap__pb2.DynamicChannelPacket.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - 'SetTrafficPaused': grpc.unary_unary_rpc_method_handler( - servicer.SetTrafficPaused, - request_deserializer=proto_dot_l2cap__pb2.SetTrafficPausedRequest.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - 'GetChannelQueueDepth': grpc.unary_unary_rpc_method_handler( - servicer.GetChannelQueueDepth, - request_deserializer=proto_dot_common__pb2.Empty.FromString, - response_serializer=proto_dot_l2cap__pb2.GetChannelQueueDepthResponse.SerializeToString, - ), - 'InitiateConnectionForSecurity': grpc.unary_unary_rpc_method_handler( - servicer.InitiateConnectionForSecurity, - request_deserializer=proto_dot_common__pb2.BluetoothAddress.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - 'FetchSecurityConnectionEvents': grpc.unary_stream_rpc_method_handler( - servicer.FetchSecurityConnectionEvents, - request_deserializer=proto_dot_common__pb2.Empty.FromString, - response_serializer=proto_dot_l2cap__pb2.LinkSecurityInterfaceCallbackEvent.SerializeToString, - ), - 'SecurityLinkEnsureAuthenticated': grpc.unary_unary_rpc_method_handler( - servicer.SecurityLinkEnsureAuthenticated, - request_deserializer=proto_dot_common__pb2.BluetoothAddress.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - 'SecurityLinkHold': grpc.unary_unary_rpc_method_handler( - servicer.SecurityLinkHold, - request_deserializer=proto_dot_common__pb2.BluetoothAddress.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - 'SecurityLinkDisconnect': grpc.unary_unary_rpc_method_handler( - servicer.SecurityLinkDisconnect, - request_deserializer=proto_dot_common__pb2.BluetoothAddress.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - 'SecurityLinkRelease': grpc.unary_unary_rpc_method_handler( - servicer.SecurityLinkRelease, - request_deserializer=proto_dot_common__pb2.BluetoothAddress.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'bluetooth.l2cap.classic.L2capClassicModuleFacade', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class L2capClassicModuleFacade(object): - """Missing associated documentation comment in .proto file.""" - - @staticmethod - def FetchConnectionComplete(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_stream(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchConnectionComplete', - proto_dot_common__pb2.Empty.SerializeToString, - proto_dot_l2cap__pb2.ConnectionCompleteEvent.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def FetchConnectionClose(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_stream(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchConnectionClose', - proto_dot_common__pb2.Empty.SerializeToString, - proto_dot_l2cap__pb2.ConnectionCloseEvent.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def OpenChannel(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/OpenChannel', - proto_dot_l2cap__pb2.OpenChannelRequest.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def CloseChannel(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/CloseChannel', - proto_dot_l2cap__pb2.CloseChannelRequest.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def FetchL2capData(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_stream(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchL2capData', - proto_dot_common__pb2.Empty.SerializeToString, - proto_dot_l2cap__pb2.L2capPacket.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def SetDynamicChannel(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SetDynamicChannel', - proto_dot_l2cap__pb2.SetEnableDynamicChannelRequest.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def SendDynamicChannelPacket(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SendDynamicChannelPacket', - proto_dot_l2cap__pb2.DynamicChannelPacket.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def SetTrafficPaused(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SetTrafficPaused', - proto_dot_l2cap__pb2.SetTrafficPausedRequest.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def GetChannelQueueDepth(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/GetChannelQueueDepth', - proto_dot_common__pb2.Empty.SerializeToString, - proto_dot_l2cap__pb2.GetChannelQueueDepthResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def InitiateConnectionForSecurity(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/InitiateConnectionForSecurity', - proto_dot_common__pb2.BluetoothAddress.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def FetchSecurityConnectionEvents(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_stream(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/FetchSecurityConnectionEvents', - proto_dot_common__pb2.Empty.SerializeToString, - proto_dot_l2cap__pb2.LinkSecurityInterfaceCallbackEvent.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def SecurityLinkEnsureAuthenticated(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkEnsureAuthenticated', - proto_dot_common__pb2.BluetoothAddress.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def SecurityLinkHold(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkHold', - proto_dot_common__pb2.BluetoothAddress.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def SecurityLinkDisconnect(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkDisconnect', - proto_dot_common__pb2.BluetoothAddress.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def SecurityLinkRelease(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.l2cap.classic.L2capClassicModuleFacade/SecurityLinkRelease', - proto_dot_common__pb2.BluetoothAddress.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/lib/proto/neighbor_pb2.py b/lib/proto/neighbor_pb2.py deleted file mode 100644 index be9e5ba..0000000 --- a/lib/proto/neighbor_pb2.py +++ /dev/null @@ -1,481 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: proto/neighbor.proto -"""Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from . import common_pb2 as proto_dot_common__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='proto/neighbor.proto', - package='bluetooth.neighbor', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x14proto/neighbor.proto\x12\x12\x62luetooth.neighbor\x1a\x12proto/common.proto\"\x1c\n\tEnableMsg\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\"L\n\x13\x44iscoverabilitiyMsg\x12\x35\n\x04mode\x18\x01 \x01(\x0e\x32\'.bluetooth.neighbor.DiscoverabilityMode\"\xab\x01\n\nInquiryMsg\x12=\n\x0cinquiry_mode\x18\x01 \x01(\x0e\x32\'.bluetooth.neighbor.DiscoverabilityMode\x12\x33\n\x0bresult_mode\x18\x02 \x01(\x0e\x32\x1e.bluetooth.neighbor.ResultMode\x12\x14\n\x0clength_1_28s\x18\x03 \x01(\r\x12\x13\n\x0bmax_results\x18\x04 \x01(\r\"\"\n\x10InquiryResultMsg\x12\x0e\n\x06packet\x18\x01 \x01(\x0c\"`\n\x14RemoteNameRequestMsg\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0c\x12!\n\x19page_scan_repetition_mode\x18\x02 \x01(\r\x12\x14\n\x0c\x63lock_offset\x18\x03 \x01(\r\"F\n\x15RemoteNameResponseMsg\x12\x0e\n\x06status\x18\x01 \x01(\r\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\x0c\x12\x0c\n\x04name\x18\x03 \x01(\x0c*8\n\x13\x44iscoverabilityMode\x12\x07\n\x03OFF\x10\x00\x12\x0b\n\x07LIMITED\x10\x01\x12\x0b\n\x07GENERAL\x10\x02*2\n\nResultMode\x12\x0c\n\x08STANDARD\x10\x00\x12\x08\n\x04RSSI\x10\x01\x12\x0c\n\x08\x45XTENDED\x10\x02\x32\xe6\x04\n\x0eNeighborFacade\x12M\n\x11SetConnectability\x12\x1d.bluetooth.neighbor.EnableMsg\x1a\x17.bluetooth.facade.Empty\"\x00\x12X\n\x12SetDiscoverability\x12\'.bluetooth.neighbor.DiscoverabilitiyMsg\x1a\x17.bluetooth.facade.Empty\"\x00\x12Z\n\x0eSetInquiryMode\x12\x1e.bluetooth.neighbor.InquiryMsg\x1a$.bluetooth.neighbor.InquiryResultMsg\"\x00\x30\x01\x12U\n\x0eReadRemoteName\x12(.bluetooth.neighbor.RemoteNameRequestMsg\x1a\x17.bluetooth.facade.Empty\"\x00\x12]\n\x13GetRemoteNameEvents\x12\x17.bluetooth.facade.Empty\x1a).bluetooth.neighbor.RemoteNameResponseMsg\"\x00\x30\x01\x12M\n\x11\x45nableInquiryScan\x12\x1d.bluetooth.neighbor.EnableMsg\x1a\x17.bluetooth.facade.Empty\"\x00\x12J\n\x0e\x45nablePageScan\x12\x1d.bluetooth.neighbor.EnableMsg\x1a\x17.bluetooth.facade.Empty\"\x00\x62\x06proto3' - , - dependencies=[proto_dot_common__pb2.DESCRIPTOR,]) - -_DISCOVERABILITYMODE = _descriptor.EnumDescriptor( - name='DiscoverabilityMode', - full_name='bluetooth.neighbor.DiscoverabilityMode', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='OFF', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='LIMITED', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='GENERAL', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=552, - serialized_end=608, -) -_sym_db.RegisterEnumDescriptor(_DISCOVERABILITYMODE) - -DiscoverabilityMode = enum_type_wrapper.EnumTypeWrapper(_DISCOVERABILITYMODE) -_RESULTMODE = _descriptor.EnumDescriptor( - name='ResultMode', - full_name='bluetooth.neighbor.ResultMode', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='STANDARD', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='RSSI', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='EXTENDED', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=610, - serialized_end=660, -) -_sym_db.RegisterEnumDescriptor(_RESULTMODE) - -ResultMode = enum_type_wrapper.EnumTypeWrapper(_RESULTMODE) -OFF = 0 -LIMITED = 1 -GENERAL = 2 -STANDARD = 0 -RSSI = 1 -EXTENDED = 2 - - - -_ENABLEMSG = _descriptor.Descriptor( - name='EnableMsg', - full_name='bluetooth.neighbor.EnableMsg', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='enabled', full_name='bluetooth.neighbor.EnableMsg.enabled', index=0, - number=1, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=64, - serialized_end=92, -) - - -_DISCOVERABILITIYMSG = _descriptor.Descriptor( - name='DiscoverabilitiyMsg', - full_name='bluetooth.neighbor.DiscoverabilitiyMsg', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='mode', full_name='bluetooth.neighbor.DiscoverabilitiyMsg.mode', index=0, - number=1, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=94, - serialized_end=170, -) - - -_INQUIRYMSG = _descriptor.Descriptor( - name='InquiryMsg', - full_name='bluetooth.neighbor.InquiryMsg', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='inquiry_mode', full_name='bluetooth.neighbor.InquiryMsg.inquiry_mode', index=0, - number=1, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='result_mode', full_name='bluetooth.neighbor.InquiryMsg.result_mode', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='length_1_28s', full_name='bluetooth.neighbor.InquiryMsg.length_1_28s', index=2, - number=3, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max_results', full_name='bluetooth.neighbor.InquiryMsg.max_results', index=3, - number=4, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=173, - serialized_end=344, -) - - -_INQUIRYRESULTMSG = _descriptor.Descriptor( - name='InquiryResultMsg', - full_name='bluetooth.neighbor.InquiryResultMsg', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='packet', full_name='bluetooth.neighbor.InquiryResultMsg.packet', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=346, - serialized_end=380, -) - - -_REMOTENAMEREQUESTMSG = _descriptor.Descriptor( - name='RemoteNameRequestMsg', - full_name='bluetooth.neighbor.RemoteNameRequestMsg', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='address', full_name='bluetooth.neighbor.RemoteNameRequestMsg.address', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='page_scan_repetition_mode', full_name='bluetooth.neighbor.RemoteNameRequestMsg.page_scan_repetition_mode', index=1, - number=2, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='clock_offset', full_name='bluetooth.neighbor.RemoteNameRequestMsg.clock_offset', index=2, - number=3, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=382, - serialized_end=478, -) - - -_REMOTENAMERESPONSEMSG = _descriptor.Descriptor( - name='RemoteNameResponseMsg', - full_name='bluetooth.neighbor.RemoteNameResponseMsg', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='status', full_name='bluetooth.neighbor.RemoteNameResponseMsg.status', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='address', full_name='bluetooth.neighbor.RemoteNameResponseMsg.address', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='name', full_name='bluetooth.neighbor.RemoteNameResponseMsg.name', index=2, - number=3, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=480, - serialized_end=550, -) - -_DISCOVERABILITIYMSG.fields_by_name['mode'].enum_type = _DISCOVERABILITYMODE -_INQUIRYMSG.fields_by_name['inquiry_mode'].enum_type = _DISCOVERABILITYMODE -_INQUIRYMSG.fields_by_name['result_mode'].enum_type = _RESULTMODE -DESCRIPTOR.message_types_by_name['EnableMsg'] = _ENABLEMSG -DESCRIPTOR.message_types_by_name['DiscoverabilitiyMsg'] = _DISCOVERABILITIYMSG -DESCRIPTOR.message_types_by_name['InquiryMsg'] = _INQUIRYMSG -DESCRIPTOR.message_types_by_name['InquiryResultMsg'] = _INQUIRYRESULTMSG -DESCRIPTOR.message_types_by_name['RemoteNameRequestMsg'] = _REMOTENAMEREQUESTMSG -DESCRIPTOR.message_types_by_name['RemoteNameResponseMsg'] = _REMOTENAMERESPONSEMSG -DESCRIPTOR.enum_types_by_name['DiscoverabilityMode'] = _DISCOVERABILITYMODE -DESCRIPTOR.enum_types_by_name['ResultMode'] = _RESULTMODE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -EnableMsg = _reflection.GeneratedProtocolMessageType('EnableMsg', (_message.Message,), { - 'DESCRIPTOR' : _ENABLEMSG, - '__module__' : 'proto.neighbor_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.neighbor.EnableMsg) - }) -_sym_db.RegisterMessage(EnableMsg) - -DiscoverabilitiyMsg = _reflection.GeneratedProtocolMessageType('DiscoverabilitiyMsg', (_message.Message,), { - 'DESCRIPTOR' : _DISCOVERABILITIYMSG, - '__module__' : 'proto.neighbor_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.neighbor.DiscoverabilitiyMsg) - }) -_sym_db.RegisterMessage(DiscoverabilitiyMsg) - -InquiryMsg = _reflection.GeneratedProtocolMessageType('InquiryMsg', (_message.Message,), { - 'DESCRIPTOR' : _INQUIRYMSG, - '__module__' : 'proto.neighbor_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.neighbor.InquiryMsg) - }) -_sym_db.RegisterMessage(InquiryMsg) - -InquiryResultMsg = _reflection.GeneratedProtocolMessageType('InquiryResultMsg', (_message.Message,), { - 'DESCRIPTOR' : _INQUIRYRESULTMSG, - '__module__' : 'proto.neighbor_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.neighbor.InquiryResultMsg) - }) -_sym_db.RegisterMessage(InquiryResultMsg) - -RemoteNameRequestMsg = _reflection.GeneratedProtocolMessageType('RemoteNameRequestMsg', (_message.Message,), { - 'DESCRIPTOR' : _REMOTENAMEREQUESTMSG, - '__module__' : 'proto.neighbor_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.neighbor.RemoteNameRequestMsg) - }) -_sym_db.RegisterMessage(RemoteNameRequestMsg) - -RemoteNameResponseMsg = _reflection.GeneratedProtocolMessageType('RemoteNameResponseMsg', (_message.Message,), { - 'DESCRIPTOR' : _REMOTENAMERESPONSEMSG, - '__module__' : 'proto.neighbor_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.neighbor.RemoteNameResponseMsg) - }) -_sym_db.RegisterMessage(RemoteNameResponseMsg) - - - -_NEIGHBORFACADE = _descriptor.ServiceDescriptor( - name='NeighborFacade', - full_name='bluetooth.neighbor.NeighborFacade', - file=DESCRIPTOR, - index=0, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=663, - serialized_end=1277, - methods=[ - _descriptor.MethodDescriptor( - name='SetConnectability', - full_name='bluetooth.neighbor.NeighborFacade.SetConnectability', - index=0, - containing_service=None, - input_type=_ENABLEMSG, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='SetDiscoverability', - full_name='bluetooth.neighbor.NeighborFacade.SetDiscoverability', - index=1, - containing_service=None, - input_type=_DISCOVERABILITIYMSG, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='SetInquiryMode', - full_name='bluetooth.neighbor.NeighborFacade.SetInquiryMode', - index=2, - containing_service=None, - input_type=_INQUIRYMSG, - output_type=_INQUIRYRESULTMSG, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='ReadRemoteName', - full_name='bluetooth.neighbor.NeighborFacade.ReadRemoteName', - index=3, - containing_service=None, - input_type=_REMOTENAMEREQUESTMSG, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='GetRemoteNameEvents', - full_name='bluetooth.neighbor.NeighborFacade.GetRemoteNameEvents', - index=4, - containing_service=None, - input_type=proto_dot_common__pb2._EMPTY, - output_type=_REMOTENAMERESPONSEMSG, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='EnableInquiryScan', - full_name='bluetooth.neighbor.NeighborFacade.EnableInquiryScan', - index=5, - containing_service=None, - input_type=_ENABLEMSG, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='EnablePageScan', - full_name='bluetooth.neighbor.NeighborFacade.EnablePageScan', - index=6, - containing_service=None, - input_type=_ENABLEMSG, - output_type=proto_dot_common__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_NEIGHBORFACADE) - -DESCRIPTOR.services_by_name['NeighborFacade'] = _NEIGHBORFACADE - -# @@protoc_insertion_point(module_scope) diff --git a/lib/proto/neighbor_pb2_grpc.py b/lib/proto/neighbor_pb2_grpc.py deleted file mode 100644 index fc71c18..0000000 --- a/lib/proto/neighbor_pb2_grpc.py +++ /dev/null @@ -1,267 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from . import common_pb2 as proto_dot_common__pb2 -from . import neighbor_pb2 as proto_dot_neighbor__pb2 - - -class NeighborFacadeStub(object): - """Missing associated documentation comment in .proto file.""" - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.SetConnectability = channel.unary_unary( - '/bluetooth.neighbor.NeighborFacade/SetConnectability', - request_serializer=proto_dot_neighbor__pb2.EnableMsg.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - self.SetDiscoverability = channel.unary_unary( - '/bluetooth.neighbor.NeighborFacade/SetDiscoverability', - request_serializer=proto_dot_neighbor__pb2.DiscoverabilitiyMsg.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - self.SetInquiryMode = channel.unary_stream( - '/bluetooth.neighbor.NeighborFacade/SetInquiryMode', - request_serializer=proto_dot_neighbor__pb2.InquiryMsg.SerializeToString, - response_deserializer=proto_dot_neighbor__pb2.InquiryResultMsg.FromString, - ) - self.ReadRemoteName = channel.unary_unary( - '/bluetooth.neighbor.NeighborFacade/ReadRemoteName', - request_serializer=proto_dot_neighbor__pb2.RemoteNameRequestMsg.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - self.GetRemoteNameEvents = channel.unary_stream( - '/bluetooth.neighbor.NeighborFacade/GetRemoteNameEvents', - request_serializer=proto_dot_common__pb2.Empty.SerializeToString, - response_deserializer=proto_dot_neighbor__pb2.RemoteNameResponseMsg.FromString, - ) - self.EnableInquiryScan = channel.unary_unary( - '/bluetooth.neighbor.NeighborFacade/EnableInquiryScan', - request_serializer=proto_dot_neighbor__pb2.EnableMsg.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - self.EnablePageScan = channel.unary_unary( - '/bluetooth.neighbor.NeighborFacade/EnablePageScan', - request_serializer=proto_dot_neighbor__pb2.EnableMsg.SerializeToString, - response_deserializer=proto_dot_common__pb2.Empty.FromString, - ) - - -class NeighborFacadeServicer(object): - """Missing associated documentation comment in .proto file.""" - - def SetConnectability(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def SetDiscoverability(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def SetInquiryMode(self, request, context): - """Sets inquiry mode and fetches inquiry result HCI packet - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def ReadRemoteName(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def GetRemoteNameEvents(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def EnableInquiryScan(self, request, context): - """TODO: Should we use a blocking call for ReadRemoteName instead? (Note: blocking model may not work for GD stack) - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def EnablePageScan(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_NeighborFacadeServicer_to_server(servicer, server): - rpc_method_handlers = { - 'SetConnectability': grpc.unary_unary_rpc_method_handler( - servicer.SetConnectability, - request_deserializer=proto_dot_neighbor__pb2.EnableMsg.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - 'SetDiscoverability': grpc.unary_unary_rpc_method_handler( - servicer.SetDiscoverability, - request_deserializer=proto_dot_neighbor__pb2.DiscoverabilitiyMsg.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - 'SetInquiryMode': grpc.unary_stream_rpc_method_handler( - servicer.SetInquiryMode, - request_deserializer=proto_dot_neighbor__pb2.InquiryMsg.FromString, - response_serializer=proto_dot_neighbor__pb2.InquiryResultMsg.SerializeToString, - ), - 'ReadRemoteName': grpc.unary_unary_rpc_method_handler( - servicer.ReadRemoteName, - request_deserializer=proto_dot_neighbor__pb2.RemoteNameRequestMsg.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - 'GetRemoteNameEvents': grpc.unary_stream_rpc_method_handler( - servicer.GetRemoteNameEvents, - request_deserializer=proto_dot_common__pb2.Empty.FromString, - response_serializer=proto_dot_neighbor__pb2.RemoteNameResponseMsg.SerializeToString, - ), - 'EnableInquiryScan': grpc.unary_unary_rpc_method_handler( - servicer.EnableInquiryScan, - request_deserializer=proto_dot_neighbor__pb2.EnableMsg.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - 'EnablePageScan': grpc.unary_unary_rpc_method_handler( - servicer.EnablePageScan, - request_deserializer=proto_dot_neighbor__pb2.EnableMsg.FromString, - response_serializer=proto_dot_common__pb2.Empty.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'bluetooth.neighbor.NeighborFacade', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class NeighborFacade(object): - """Missing associated documentation comment in .proto file.""" - - @staticmethod - def SetConnectability(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.neighbor.NeighborFacade/SetConnectability', - proto_dot_neighbor__pb2.EnableMsg.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def SetDiscoverability(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.neighbor.NeighborFacade/SetDiscoverability', - proto_dot_neighbor__pb2.DiscoverabilitiyMsg.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def SetInquiryMode(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_stream(request, target, '/bluetooth.neighbor.NeighborFacade/SetInquiryMode', - proto_dot_neighbor__pb2.InquiryMsg.SerializeToString, - proto_dot_neighbor__pb2.InquiryResultMsg.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def ReadRemoteName(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.neighbor.NeighborFacade/ReadRemoteName', - proto_dot_neighbor__pb2.RemoteNameRequestMsg.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def GetRemoteNameEvents(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_stream(request, target, '/bluetooth.neighbor.NeighborFacade/GetRemoteNameEvents', - proto_dot_common__pb2.Empty.SerializeToString, - proto_dot_neighbor__pb2.RemoteNameResponseMsg.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def EnableInquiryScan(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.neighbor.NeighborFacade/EnableInquiryScan', - proto_dot_neighbor__pb2.EnableMsg.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def EnablePageScan(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.neighbor.NeighborFacade/EnablePageScan', - proto_dot_neighbor__pb2.EnableMsg.SerializeToString, - proto_dot_common__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/lib/proto/rootservice_pb2.py b/lib/proto/rootservice_pb2.py deleted file mode 100644 index 5944a74..0000000 --- a/lib/proto/rootservice_pb2.py +++ /dev/null @@ -1,288 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: proto/rootservice.proto -"""Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from . import common_pb2 as proto_dot_common__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='proto/rootservice.proto', - package='bluetooth.facade', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x17proto/rootservice.proto\x12\x10\x62luetooth.facade\x1a\x12proto/common.proto\"Q\n\x11StartStackRequest\x12<\n\x11module_under_test\x18\x01 \x01(\x0e\x32!.bluetooth.facade.BluetoothModule\"\x14\n\x12StartStackResponse\"\x12\n\x10StopStackRequest\"\x13\n\x11StopStackResponse*Z\n\x0f\x42luetoothModule\x12\x07\n\x03HAL\x10\x00\x12\x07\n\x03HCI\x10\x01\x12\x12\n\x0eHCI_INTERFACES\x10\x02\x12\t\n\x05L2CAP\x10\x03\x12\x0c\n\x08SECURITY\x10\x04\x12\x08\n\x04SHIM\x10\x05\x32\xbf\x01\n\nRootFacade\x12Y\n\nStartStack\x12#.bluetooth.facade.StartStackRequest\x1a$.bluetooth.facade.StartStackResponse\"\x00\x12V\n\tStopStack\x12\".bluetooth.facade.StopStackRequest\x1a#.bluetooth.facade.StopStackResponse\"\x00\x32\x65\n\x10ReadOnlyProperty\x12Q\n\x10ReadLocalAddress\x12\x17.bluetooth.facade.Empty\x1a\".bluetooth.facade.BluetoothAddress\"\x00\x62\x06proto3' - , - dependencies=[proto_dot_common__pb2.DESCRIPTOR,]) - -_BLUETOOTHMODULE = _descriptor.EnumDescriptor( - name='BluetoothModule', - full_name='bluetooth.facade.BluetoothModule', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='HAL', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='HCI', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='HCI_INTERFACES', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='L2CAP', index=3, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SECURITY', index=4, number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SHIM', index=5, number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=211, - serialized_end=301, -) -_sym_db.RegisterEnumDescriptor(_BLUETOOTHMODULE) - -BluetoothModule = enum_type_wrapper.EnumTypeWrapper(_BLUETOOTHMODULE) -HAL = 0 -HCI = 1 -HCI_INTERFACES = 2 -L2CAP = 3 -SECURITY = 4 -SHIM = 5 - - - -_STARTSTACKREQUEST = _descriptor.Descriptor( - name='StartStackRequest', - full_name='bluetooth.facade.StartStackRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='module_under_test', full_name='bluetooth.facade.StartStackRequest.module_under_test', index=0, - number=1, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=65, - serialized_end=146, -) - - -_STARTSTACKRESPONSE = _descriptor.Descriptor( - name='StartStackResponse', - full_name='bluetooth.facade.StartStackResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=148, - serialized_end=168, -) - - -_STOPSTACKREQUEST = _descriptor.Descriptor( - name='StopStackRequest', - full_name='bluetooth.facade.StopStackRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=170, - serialized_end=188, -) - - -_STOPSTACKRESPONSE = _descriptor.Descriptor( - name='StopStackResponse', - full_name='bluetooth.facade.StopStackResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=190, - serialized_end=209, -) - -_STARTSTACKREQUEST.fields_by_name['module_under_test'].enum_type = _BLUETOOTHMODULE -DESCRIPTOR.message_types_by_name['StartStackRequest'] = _STARTSTACKREQUEST -DESCRIPTOR.message_types_by_name['StartStackResponse'] = _STARTSTACKRESPONSE -DESCRIPTOR.message_types_by_name['StopStackRequest'] = _STOPSTACKREQUEST -DESCRIPTOR.message_types_by_name['StopStackResponse'] = _STOPSTACKRESPONSE -DESCRIPTOR.enum_types_by_name['BluetoothModule'] = _BLUETOOTHMODULE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -StartStackRequest = _reflection.GeneratedProtocolMessageType('StartStackRequest', (_message.Message,), { - 'DESCRIPTOR' : _STARTSTACKREQUEST, - '__module__' : 'proto.rootservice_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.facade.StartStackRequest) - }) -_sym_db.RegisterMessage(StartStackRequest) - -StartStackResponse = _reflection.GeneratedProtocolMessageType('StartStackResponse', (_message.Message,), { - 'DESCRIPTOR' : _STARTSTACKRESPONSE, - '__module__' : 'proto.rootservice_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.facade.StartStackResponse) - }) -_sym_db.RegisterMessage(StartStackResponse) - -StopStackRequest = _reflection.GeneratedProtocolMessageType('StopStackRequest', (_message.Message,), { - 'DESCRIPTOR' : _STOPSTACKREQUEST, - '__module__' : 'proto.rootservice_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.facade.StopStackRequest) - }) -_sym_db.RegisterMessage(StopStackRequest) - -StopStackResponse = _reflection.GeneratedProtocolMessageType('StopStackResponse', (_message.Message,), { - 'DESCRIPTOR' : _STOPSTACKRESPONSE, - '__module__' : 'proto.rootservice_pb2' - # @@protoc_insertion_point(class_scope:bluetooth.facade.StopStackResponse) - }) -_sym_db.RegisterMessage(StopStackResponse) - - - -_ROOTFACADE = _descriptor.ServiceDescriptor( - name='RootFacade', - full_name='bluetooth.facade.RootFacade', - file=DESCRIPTOR, - index=0, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=304, - serialized_end=495, - methods=[ - _descriptor.MethodDescriptor( - name='StartStack', - full_name='bluetooth.facade.RootFacade.StartStack', - index=0, - containing_service=None, - input_type=_STARTSTACKREQUEST, - output_type=_STARTSTACKRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='StopStack', - full_name='bluetooth.facade.RootFacade.StopStack', - index=1, - containing_service=None, - input_type=_STOPSTACKREQUEST, - output_type=_STOPSTACKRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_ROOTFACADE) - -DESCRIPTOR.services_by_name['RootFacade'] = _ROOTFACADE - - -_READONLYPROPERTY = _descriptor.ServiceDescriptor( - name='ReadOnlyProperty', - full_name='bluetooth.facade.ReadOnlyProperty', - file=DESCRIPTOR, - index=1, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=497, - serialized_end=598, - methods=[ - _descriptor.MethodDescriptor( - name='ReadLocalAddress', - full_name='bluetooth.facade.ReadOnlyProperty.ReadLocalAddress', - index=0, - containing_service=None, - input_type=proto_dot_common__pb2._EMPTY, - output_type=proto_dot_common__pb2._BLUETOOTHADDRESS, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_READONLYPROPERTY) - -DESCRIPTOR.services_by_name['ReadOnlyProperty'] = _READONLYPROPERTY - -# @@protoc_insertion_point(module_scope) diff --git a/lib/proto/rootservice_pb2_grpc.py b/lib/proto/rootservice_pb2_grpc.py deleted file mode 100644 index 961bd9f..0000000 --- a/lib/proto/rootservice_pb2_grpc.py +++ /dev/null @@ -1,161 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from . import common_pb2 as proto_dot_common__pb2 -from . import rootservice_pb2 as proto_dot_rootservice__pb2 - - -class RootFacadeStub(object): - """Missing associated documentation comment in .proto file.""" - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.StartStack = channel.unary_unary( - '/bluetooth.facade.RootFacade/StartStack', - request_serializer=proto_dot_rootservice__pb2.StartStackRequest.SerializeToString, - response_deserializer=proto_dot_rootservice__pb2.StartStackResponse.FromString, - ) - self.StopStack = channel.unary_unary( - '/bluetooth.facade.RootFacade/StopStack', - request_serializer=proto_dot_rootservice__pb2.StopStackRequest.SerializeToString, - response_deserializer=proto_dot_rootservice__pb2.StopStackResponse.FromString, - ) - - -class RootFacadeServicer(object): - """Missing associated documentation comment in .proto file.""" - - def StartStack(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def StopStack(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_RootFacadeServicer_to_server(servicer, server): - rpc_method_handlers = { - 'StartStack': grpc.unary_unary_rpc_method_handler( - servicer.StartStack, - request_deserializer=proto_dot_rootservice__pb2.StartStackRequest.FromString, - response_serializer=proto_dot_rootservice__pb2.StartStackResponse.SerializeToString, - ), - 'StopStack': grpc.unary_unary_rpc_method_handler( - servicer.StopStack, - request_deserializer=proto_dot_rootservice__pb2.StopStackRequest.FromString, - response_serializer=proto_dot_rootservice__pb2.StopStackResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'bluetooth.facade.RootFacade', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class RootFacade(object): - """Missing associated documentation comment in .proto file.""" - - @staticmethod - def StartStack(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.facade.RootFacade/StartStack', - proto_dot_rootservice__pb2.StartStackRequest.SerializeToString, - proto_dot_rootservice__pb2.StartStackResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def StopStack(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.facade.RootFacade/StopStack', - proto_dot_rootservice__pb2.StopStackRequest.SerializeToString, - proto_dot_rootservice__pb2.StopStackResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - -class ReadOnlyPropertyStub(object): - """Missing associated documentation comment in .proto file.""" - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ReadLocalAddress = channel.unary_unary( - '/bluetooth.facade.ReadOnlyProperty/ReadLocalAddress', - request_serializer=proto_dot_common__pb2.Empty.SerializeToString, - response_deserializer=proto_dot_common__pb2.BluetoothAddress.FromString, - ) - - -class ReadOnlyPropertyServicer(object): - """Missing associated documentation comment in .proto file.""" - - def ReadLocalAddress(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_ReadOnlyPropertyServicer_to_server(servicer, server): - rpc_method_handlers = { - 'ReadLocalAddress': grpc.unary_unary_rpc_method_handler( - servicer.ReadLocalAddress, - request_deserializer=proto_dot_common__pb2.Empty.FromString, - response_serializer=proto_dot_common__pb2.BluetoothAddress.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'bluetooth.facade.ReadOnlyProperty', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class ReadOnlyProperty(object): - """Missing associated documentation comment in .proto file.""" - - @staticmethod - def ReadLocalAddress(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/bluetooth.facade.ReadOnlyProperty/ReadLocalAddress', - proto_dot_common__pb2.Empty.SerializeToString, - proto_dot_common__pb2.BluetoothAddress.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/proto/common.proto b/proto/common.proto deleted file mode 100644 index a68bff2..0000000 --- a/proto/common.proto +++ /dev/null @@ -1,37 +0,0 @@ -syntax = "proto3"; - -package bluetooth.facade; - -message Empty {} - -message Data { - bytes payload = 1; -} - -message BluetoothAddress { - bytes address = 1; -} - -enum BluetoothAddressTypeEnum { - PUBLIC_DEVICE_ADDRESS = 0x0; - RANDOM_DEVICE_ADDRESS = 0x1; - PUBLIC_IDENTITY_ADDRESS = 0x2; - RANDOM_IDENTITY_ADDRESS = 0x3; -} - -enum BluetoothOwnAddressTypeEnum { - USE_PUBLIC_DEVICE_ADDRESS = 0x0; - USE_RANDOM_DEVICE_ADDRESS = 0x1; - RESOLVABLE_OR_PUBLIC_ADDRESS = 0x2; - RESOLVABLE_OR_RANDOM_ADDRESS = 0x3; -} - -message BluetoothAddressWithType { - BluetoothAddress address = 1; - BluetoothAddressTypeEnum type = 2; -} - -enum BluetoothPeerAddressTypeEnum { - PUBLIC_DEVICE_OR_IDENTITY_ADDRESS = 0x0; - RANDOM_DEVICE_OR_IDENTITY_ADDRESS = 0x1; -} \ No newline at end of file diff --git a/proto/facade/common.proto b/proto/facade/common.proto new file mode 100644 index 0000000..222caca --- /dev/null +++ b/proto/facade/common.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; + +package bluetooth.facade; + +message Empty {} + +message Data { + bytes payload = 1; +} + +message BluetoothAddress { + bytes address = 1; +} + +enum BluetoothAddressTypeEnum { + PUBLIC_DEVICE_ADDRESS = 0x0; + RANDOM_DEVICE_ADDRESS = 0x1; + PUBLIC_IDENTITY_ADDRESS = 0x2; + RANDOM_IDENTITY_ADDRESS = 0x3; +} + +enum BluetoothOwnAddressTypeEnum { + USE_PUBLIC_DEVICE_ADDRESS = 0x0; + USE_RANDOM_DEVICE_ADDRESS = 0x1; + RESOLVABLE_OR_PUBLIC_ADDRESS = 0x2; + RESOLVABLE_OR_RANDOM_ADDRESS = 0x3; +} + +message BluetoothAddressWithType { + BluetoothAddress address = 1; + BluetoothAddressTypeEnum type = 2; +} + +enum BluetoothPeerAddressTypeEnum { + PUBLIC_DEVICE_OR_IDENTITY_ADDRESS = 0x0; + RANDOM_DEVICE_OR_IDENTITY_ADDRESS = 0x1; +} diff --git a/proto/facade/l2cap.proto b/proto/facade/l2cap.proto new file mode 100644 index 0000000..7951ec4 --- /dev/null +++ b/proto/facade/l2cap.proto @@ -0,0 +1,129 @@ +syntax = "proto3"; + +package bluetooth.l2cap.classic; + +import "facade/common.proto"; + +service L2capClassicModuleFacade { + rpc FetchConnectionComplete(facade.Empty) returns (stream ConnectionCompleteEvent) { + // Testing Android Bluetooth stack only. Optional for other stack. + } + rpc FetchConnectionClose(facade.Empty) returns (stream ConnectionCloseEvent) { + // Testing Android Bluetooth stack only. Optional for other stack. + } + rpc OpenChannel(OpenChannelRequest) returns (facade.Empty) {} + rpc CloseChannel(CloseChannelRequest) returns (facade.Empty) {} + rpc FetchL2capData(facade.Empty) returns (stream L2capPacket) {} + rpc SetDynamicChannel(SetEnableDynamicChannelRequest) returns (facade.Empty) {} + rpc SendDynamicChannelPacket(DynamicChannelPacket) returns (facade.Empty) {} + rpc SetTrafficPaused(SetTrafficPausedRequest) returns (facade.Empty) {} + rpc GetChannelQueueDepth(facade.Empty) returns (GetChannelQueueDepthResponse) { + // Get the buffer size of channel queue end for L2CAP user (how many packets we can buffer + // before L2CAP user dequeues. + } + rpc InitiateConnectionForSecurity(facade.BluetoothAddress) returns (facade.Empty) {} + rpc FetchSecurityConnectionEvents(facade.Empty) returns (stream LinkSecurityInterfaceCallbackEvent) {} + rpc SecurityLinkEnsureAuthenticated(facade.BluetoothAddress) returns (facade.Empty) {} + rpc SecurityLinkHold(facade.BluetoothAddress) returns (facade.Empty) {} + rpc SecurityLinkDisconnect(facade.BluetoothAddress) returns (facade.Empty) {} + rpc SecurityLinkRelease(facade.BluetoothAddress) returns (facade.Empty) {} +} + +enum LinkSecurityInterfaceCallbackEventType { + ON_CONNECTED = 0; + ON_DISCONNECTED = 1; + ON_AUTHENTICATION_COMPLETE = 2; + ON_ENCRYPTION_CHANGE = 3; + ON_READ_REMOTE_VERSION_INFO = 4; + ON_READ_REMOTE_EXTENDED_FEATURES = 5; +} + +message LinkSecurityInterfaceCallbackEvent { + facade.BluetoothAddress address = 1; + LinkSecurityInterfaceCallbackEventType event_type = 2; +} + +message RegisterChannelRequest { + uint32 channel = 1; +} + +message ConnectionCompleteEvent { + facade.BluetoothAddress remote = 1; +} + +message ConnectionCloseEvent { + facade.BluetoothAddress remote = 1; + uint32 reason = 2; +} + +enum RetransmissionFlowControlMode { + BASIC = 0; + ERTM = 1; + ERTM_OPTIONAL = 2; +} + +message OpenChannelRequest { + facade.BluetoothAddress remote = 1; + uint32 psm = 2; + RetransmissionFlowControlMode mode = 3; +} + +message CloseChannelRequest { + uint32 psm = 1; +} + +enum ChannelSignalEventType { + OPEN = 0; + CLOSE = 1; + CONFIGURE = 2; +} + +message ChannelSignalEvent { + uint32 cid = 1; + ChannelSignalEventType type = 2; +} + +enum SendL2capPacketResultType { + OK = 0; + BAD_CID = 1; +} + +message SendL2capPacketResult { + SendL2capPacketResultType result_type = 1; +} + +message L2capPacket { + oneof channel_type { + uint32 psm = 1; + uint32 fixed_cid = 2; + } + bytes payload = 3; +} + +message SetEnableDynamicChannelRequest { + uint32 psm = 1; + bool enable = 2; + RetransmissionFlowControlMode retransmission_mode = 3; +} + +message DynamicChannelPacket { + facade.BluetoothAddress remote = 1; + uint32 psm = 2; + bytes payload = 3; +} + +message SetTrafficPausedRequest { + bool paused = 1; + uint32 psm = 2; +} + +message GetChannelQueueDepthResponse { + uint32 size = 1; +} + +enum ClassicSecurityPolicy { + ENCRYPTED_TRANSPORT = 0; + AUTHENTICATED_ENCRYPTED_TRANSPORT = 1; + BEST = 2; + _SDP_ONLY_NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK = 3; +} diff --git a/proto/facade/neighbor.proto b/proto/facade/neighbor.proto new file mode 100644 index 0000000..03defe1 --- /dev/null +++ b/proto/facade/neighbor.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; + +package bluetooth.neighbor; + +import "facade/common.proto"; + +service NeighborFacade { + rpc SetConnectability(EnableMsg) returns (facade.Empty) {} + rpc SetDiscoverability(DiscoverabilitiyMsg) returns (facade.Empty) {} + rpc SetInquiryMode(InquiryMsg) returns (stream InquiryResultMsg) { + // Sets inquiry mode and fetches inquiry result HCI packet + } + rpc ReadRemoteName(RemoteNameRequestMsg) returns (facade.Empty) {} + rpc GetRemoteNameEvents(facade.Empty) returns (stream RemoteNameResponseMsg) {} + // TODO: Should we use a blocking call for ReadRemoteName instead? (Note: blocking model may not work for GD stack) + rpc EnableInquiryScan(EnableMsg) returns (facade.Empty) {} + rpc EnablePageScan(EnableMsg) returns (facade.Empty) {} +} + +message EnableMsg { + bool enabled = 1; +} + +enum DiscoverabilityMode { + OFF = 0; + LIMITED = 1; + GENERAL = 2; +} + +message DiscoverabilitiyMsg { + DiscoverabilityMode mode = 1; +} + +enum ResultMode { + STANDARD = 0; + RSSI = 1; + EXTENDED = 2; +} + +message InquiryMsg { + DiscoverabilityMode inquiry_mode = 1; + ResultMode result_mode = 2; + uint32 length_1_28s = 3; + uint32 max_results = 4; // 0 is unlimited +} + +message InquiryResultMsg { + bytes packet = 1; +} + +message RemoteNameRequestMsg { + bytes address = 1; + uint32 page_scan_repetition_mode = 2; // r0, r1, r2 + uint32 clock_offset = 3; +} + +message RemoteNameResponseMsg { + uint32 status = 1; + bytes address = 2; + bytes name = 3; +} diff --git a/proto/facade/rootservice.proto b/proto/facade/rootservice.proto new file mode 100644 index 0000000..63ec41a --- /dev/null +++ b/proto/facade/rootservice.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +package bluetooth.facade; + +import "facade/common.proto"; + +service RootFacade { + rpc StartStack(StartStackRequest) returns (StartStackResponse) {} + rpc StopStack(StopStackRequest) returns (StopStackResponse) {} +} + +enum BluetoothModule { + HAL = 0; + HCI = 1; + HCI_INTERFACES = 2; + L2CAP = 3; + SECURITY = 4; + SHIM = 5; +} + +message StartStackRequest { + BluetoothModule module_under_test = 1; +} + +message StartStackResponse {} + +message StopStackRequest {} + +message StopStackResponse {} + +service ReadOnlyProperty { + rpc ReadLocalAddress(Empty) returns (BluetoothAddress) {} +} diff --git a/proto/l2cap.proto b/proto/l2cap.proto deleted file mode 100644 index 4aa4422..0000000 --- a/proto/l2cap.proto +++ /dev/null @@ -1,129 +0,0 @@ -syntax = "proto3"; - -package bluetooth.l2cap.classic; - -import "proto/common.proto"; - -service L2capClassicModuleFacade { - rpc FetchConnectionComplete(facade.Empty) returns (stream ConnectionCompleteEvent) { - // Testing Android Bluetooth stack only. Optional for other stack. - } - rpc FetchConnectionClose(facade.Empty) returns (stream ConnectionCloseEvent) { - // Testing Android Bluetooth stack only. Optional for other stack. - } - rpc OpenChannel(OpenChannelRequest) returns (facade.Empty) {} - rpc CloseChannel(CloseChannelRequest) returns (facade.Empty) {} - rpc FetchL2capData(facade.Empty) returns (stream L2capPacket) {} - rpc SetDynamicChannel(SetEnableDynamicChannelRequest) returns (facade.Empty) {} - rpc SendDynamicChannelPacket(DynamicChannelPacket) returns (facade.Empty) {} - rpc SetTrafficPaused(SetTrafficPausedRequest) returns (facade.Empty) {} - rpc GetChannelQueueDepth(facade.Empty) returns (GetChannelQueueDepthResponse) { - // Get the buffer size of channel queue end for L2CAP user (how many packets we can buffer - // before L2CAP user dequeues. - } - rpc InitiateConnectionForSecurity(facade.BluetoothAddress) returns (facade.Empty) {} - rpc FetchSecurityConnectionEvents(facade.Empty) returns (stream LinkSecurityInterfaceCallbackEvent) {} - rpc SecurityLinkEnsureAuthenticated(facade.BluetoothAddress) returns (facade.Empty) {} - rpc SecurityLinkHold(facade.BluetoothAddress) returns (facade.Empty) {} - rpc SecurityLinkDisconnect(facade.BluetoothAddress) returns (facade.Empty) {} - rpc SecurityLinkRelease(facade.BluetoothAddress) returns (facade.Empty) {} -} - -enum LinkSecurityInterfaceCallbackEventType { - ON_CONNECTED = 0; - ON_DISCONNECTED = 1; - ON_AUTHENTICATION_COMPLETE = 2; - ON_ENCRYPTION_CHANGE = 3; - ON_READ_REMOTE_VERSION_INFO = 4; - ON_READ_REMOTE_EXTENDED_FEATURES = 5; -} - -message LinkSecurityInterfaceCallbackEvent { - facade.BluetoothAddress address = 1; - LinkSecurityInterfaceCallbackEventType event_type = 2; -} - -message RegisterChannelRequest { - uint32 channel = 1; -} - -message ConnectionCompleteEvent { - facade.BluetoothAddress remote = 1; -} - -message ConnectionCloseEvent { - facade.BluetoothAddress remote = 1; - uint32 reason = 2; -} - -enum RetransmissionFlowControlMode { - BASIC = 0; - ERTM = 1; - ERTM_OPTIONAL = 2; -} - -message OpenChannelRequest { - facade.BluetoothAddress remote = 1; - uint32 psm = 2; - RetransmissionFlowControlMode mode = 3; -} - -message CloseChannelRequest { - uint32 psm = 1; -} - -enum ChannelSignalEventType { - OPEN = 0; - CLOSE = 1; - CONFIGURE = 2; -} - -message ChannelSignalEvent { - uint32 cid = 1; - ChannelSignalEventType type = 2; -} - -enum SendL2capPacketResultType { - OK = 0; - BAD_CID = 1; -} - -message SendL2capPacketResult { - SendL2capPacketResultType result_type = 1; -} - -message L2capPacket { - oneof channel_type { - uint32 psm = 1; - uint32 fixed_cid = 2; - } - bytes payload = 3; -} - -message SetEnableDynamicChannelRequest { - uint32 psm = 1; - bool enable = 2; - RetransmissionFlowControlMode retransmission_mode = 3; -} - -message DynamicChannelPacket { - facade.BluetoothAddress remote = 1; - uint32 psm = 2; - bytes payload = 3; -} - -message SetTrafficPausedRequest { - bool paused = 1; - uint32 psm = 2; -} - -message GetChannelQueueDepthResponse { - uint32 size = 1; -} - -enum ClassicSecurityPolicy { - ENCRYPTED_TRANSPORT = 0; - AUTHENTICATED_ENCRYPTED_TRANSPORT = 1; - BEST = 2; - _SDP_ONLY_NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK = 3; -} diff --git a/proto/neighbor.proto b/proto/neighbor.proto deleted file mode 100644 index 6fb7b05..0000000 --- a/proto/neighbor.proto +++ /dev/null @@ -1,61 +0,0 @@ -syntax = "proto3"; - -package bluetooth.neighbor; - -import "proto/common.proto"; - -service NeighborFacade { - rpc SetConnectability(EnableMsg) returns (facade.Empty) {} - rpc SetDiscoverability(DiscoverabilitiyMsg) returns (facade.Empty) {} - rpc SetInquiryMode(InquiryMsg) returns (stream InquiryResultMsg) { - // Sets inquiry mode and fetches inquiry result HCI packet - } - rpc ReadRemoteName(RemoteNameRequestMsg) returns (facade.Empty) {} - rpc GetRemoteNameEvents(facade.Empty) returns (stream RemoteNameResponseMsg) {} - // TODO: Should we use a blocking call for ReadRemoteName instead? (Note: blocking model may not work for GD stack) - rpc EnableInquiryScan(EnableMsg) returns (facade.Empty) {} - rpc EnablePageScan(EnableMsg) returns (facade.Empty) {} -} - -message EnableMsg { - bool enabled = 1; -} - -enum DiscoverabilityMode { - OFF = 0; - LIMITED = 1; - GENERAL = 2; -} - -message DiscoverabilitiyMsg { - DiscoverabilityMode mode = 1; -} - -enum ResultMode { - STANDARD = 0; - RSSI = 1; - EXTENDED = 2; -} - -message InquiryMsg { - DiscoverabilityMode inquiry_mode = 1; - ResultMode result_mode = 2; - uint32 length_1_28s = 3; - uint32 max_results = 4; // 0 is unlimited -} - -message InquiryResultMsg { - bytes packet = 1; -} - -message RemoteNameRequestMsg { - bytes address = 1; - uint32 page_scan_repetition_mode = 2; // r0, r1, r2 - uint32 clock_offset = 3; -} - -message RemoteNameResponseMsg { - uint32 status = 1; - bytes address = 2; - bytes name = 3; -} diff --git a/proto/rootservice.proto b/proto/rootservice.proto deleted file mode 100644 index 2ab245d..0000000 --- a/proto/rootservice.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto3"; -package bluetooth.facade; - -import "proto/common.proto"; - -service RootFacade { - rpc StartStack(StartStackRequest) returns (StartStackResponse) {} - rpc StopStack(StopStackRequest) returns (StopStackResponse) {} -} - -enum BluetoothModule { - HAL = 0; - HCI = 1; - HCI_INTERFACES = 2; - L2CAP = 3; - SECURITY = 4; - SHIM = 5; -} - -message StartStackRequest { - BluetoothModule module_under_test = 1; -} - -message StartStackResponse {} - -message StopStackRequest {} - -message StopStackResponse {} - -service ReadOnlyProperty { - rpc ReadLocalAddress(Empty) returns (BluetoothAddress) {} -} \ No newline at end of file diff --git a/protoc-gen-custom_grpc b/protoc-gen-custom_grpc new file mode 100755 index 0000000..a45dc19 --- /dev/null +++ b/protoc-gen-custom_grpc @@ -0,0 +1,79 @@ +#!/usr/bin/env python3 +import sys + +from google.protobuf.compiler.plugin_pb2 import CodeGeneratorRequest, CodeGeneratorResponse + + +def eprint(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) + + +request = CodeGeneratorRequest.FromString(sys.stdin.buffer.read()) + + +def import_type(imports, type): + package = type[1:type.rindex('.')] + type_name = type[type.rindex('.')+1:] + file = next(filter(lambda x: x.package == package, request.proto_file)) + python_path = file.name.replace('.proto', '').replace('/', '.') + as_name = python_path.replace('.', '_dot_') + '__pb2' + module_path = python_path[:python_path.rindex('.')] + module_name = python_path[python_path.rindex('.')+1:] + '_pb2' + imports.add(f'from {module_path} import {module_name} as {as_name}') + return f'{as_name}.{type_name}' + + +def generate_method(imports, file, service, method): + input_mode = 'stream' if method.client_streaming else 'unary' + output_mode = 'stream' if method.server_streaming else 'unary' + + input_type = import_type(imports, method.input_type) + output_type = import_type(imports, method.output_type) + + if input_mode == 'stream': + raise Error("TODO: stream as input type") + + return ( + f'def {method.name}(self, **kwargs):\n' + f' return self.channel.{input_mode}_{output_mode}(\n' + f" '/{file.package}.{service.name}/{method.name}',\n" + f' request_serializer={input_type}.SerializeToString,\n' + f' response_deserializer={output_type}.FromString\n' + f' )({input_type}(**kwargs))' + ).split('\n') + + +def generate_service(imports, file, service): + methods = '\n\n '.join([ + '\n '.join( + generate_method(imports, file, service, method) + ) for method in service.method + ]) + return ( + f'class {service.name}:\n' + f' def __init__(self, channel):\n' + f' self.channel = channel\n' + f'\n' + f' {methods}\n' + ).split('\n') + + +files = [] + +for file_name in request.file_to_generate: + file = next(filter(lambda x: x.name == file_name, request.proto_file)) + + imports = set([]) + + services = '\n'.join(sum([ + generate_service(imports, file, service) for service in file.service + ], [])) + + files.append(CodeGeneratorResponse.File( + name=file_name.replace('.proto', '_grpc.py'), + content='\n'.join(imports) + '\n\n' + services + )) + +reponse = CodeGeneratorResponse(file=files) + +sys.stdout.buffer.write(reponse.SerializeToString()) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..31854ce --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +protobuf==3.18.1 +grpcio==1.41.0 +grpcio-tools==1.41.0 diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..20fd953 --- /dev/null +++ b/setup.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +from setuptools import setup, Command +from setuptools.command.build_py import build_py +import os + +package_directory = os.path.dirname(os.path.realpath(__file__)) + +os.environ["PATH"] = package_directory + ':' + os.environ["PATH"] + + +class BuildGrpc(Command): + """GRPC build command.""" + description = 'build grpc files' + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + from grpc_tools import protoc + + protoc.main([ + 'grpc_tools.protoc', + '-I=proto', + '--python_out=.', + '--custom_grpc_out=.', + 'facade/l2cap.proto', + 'facade/neighbor.proto', + 'facade/common.proto', + 'facade/rootservice.proto', + ]) + + +class BuildPyCommand(build_py): + """Custom build command.""" + + def run(self): + self.run_command('build_grpc') + build_py.run(self) + + +setup( + name='mmi2grpc', + version='0.0.1', + packages=['interact', 'facade'], + install_requires=[ + 'grpcio', + ], + setup_requires=[ + 'grpcio-tools' + ], + cmdclass={ + 'build_grpc': BuildGrpc, + 'build_py': BuildPyCommand, + } +) -- cgit v1.2.3 From 478531d15ea1c4a8a3b50647221538e2074fd0dd Mon Sep 17 00:00:00 2001 From: Charlie Boutier Date: Sat, 30 Oct 2021 08:47:02 +0000 Subject: a2dp: Delete GD facade. Add a2dp and host facade. Add a2dp mmi interact. Change-Id: Ic2c3b5ea75cfd6562728357e115de33f5a4f562c --- .gitignore | 5 +- blueberry/__init__.py | 0 facade/__init__.py | 0 interact/__init__.py | 18 ++++-- interact/a2dp.py | 51 ++++++++++++++++ interact/l2cap.py | 48 --------------- proto/blueberry/a2dp.proto | 78 +++++++++++++++++++++++++ proto/blueberry/host.proto | 43 ++++++++++++++ proto/facade/common.proto | 37 ------------ proto/facade/l2cap.proto | 129 ----------------------------------------- proto/facade/neighbor.proto | 61 ------------------- proto/facade/rootservice.proto | 32 ---------- protoc-gen-custom_grpc | 9 ++- setup.py | 6 +- 14 files changed, 197 insertions(+), 320 deletions(-) create mode 100644 blueberry/__init__.py delete mode 100644 facade/__init__.py create mode 100644 interact/a2dp.py delete mode 100644 interact/l2cap.py create mode 100644 proto/blueberry/a2dp.proto create mode 100644 proto/blueberry/host.proto delete mode 100644 proto/facade/common.proto delete mode 100644 proto/facade/l2cap.proto delete mode 100644 proto/facade/neighbor.proto delete mode 100644 proto/facade/rootservice.proto diff --git a/.gitignore b/.gitignore index 3b6e253..f781d3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ virtualenv out/ __pycache__ -facade/* -!facade/__init__.py +blueberry/* +!blueberry/__init__.py +.eggs/ \ No newline at end of file diff --git a/blueberry/__init__.py b/blueberry/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/facade/__init__.py b/facade/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/interact/__init__.py b/interact/__init__.py index 0f08de1..faa92b2 100644 --- a/interact/__init__.py +++ b/interact/__init__.py @@ -1,9 +1,19 @@ import grpc -from . import l2cap +from . import a2dp + +from blueberry.host_grpc import Host GRPC_PORT = 8999 -def run(profile: str, interaction_id: str, pts_addr: bytes): +def run(profile: str, interaction_id: str, test: str, pts_addr: bytes): + channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') + print(f'{profile} mmi: {interaction_id}') + if profile == "A2DP": + a2dp.interact(channel, interaction_id, test, pts_addr) + channel.close() + +def read_local_address() -> bytes: channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') - if profile == "L2CAP": - l2cap.interact(channel, interaction_id, pts_addr) + bluetooth_address = Host(channel).ReadLocalAddress(wait_for_ready=True) + channel.close() + return bluetooth_address.address diff --git a/interact/a2dp.py b/interact/a2dp.py new file mode 100644 index 0000000..66d46de --- /dev/null +++ b/interact/a2dp.py @@ -0,0 +1,51 @@ +from grpc import Channel + +from blueberry.a2dp_grpc import A2DP +from blueberry.host_grpc import Host + +from blueberry.a2dp_pb2 import Sink, Source +from blueberry.host_pb2 import Connection + +_connection: Connection = None; +_sink: Sink = None; +_source: Source = None; + +def interact(channel: Channel, interaction_id: str, test: str, pts_addr: bytes): + global _connection, _sink, _source; + a2dp = A2DP(channel) + host = Host(channel) + if interaction_id == "TSC_AVDTP_mmi_iut_accept_connect": + host.SetConnectable(connectable=True) + elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_start": + _connection = host.Connect(address=pts_addr).connection + if "SNK" in test: + _sink = a2dp.OpenSink(connection=_connection).sink + elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_out_of_range": + if not _connection: + _connection = Connection(cookie=pts_addr) + host.Disconnect(connection=_connection) + _connection = None + _sink = None + _source = None + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_discover": + pass + elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_set_configuration": + _connection = host.Connect(address=pts_addr).connection + if "SRC" in test: + _source = a2dp.OpenSource(connection=_connection).source + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_close_stream": + pass + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_get_capabilities": + pass + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_set_configuration": + pass + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_open_stream": + pass + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_start": + pass + elif interaction_id == "TSC_AVDTP_mmi_iut_confirm_streaming": + pass + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_reconnect": + pass + else: + print(f'MMI NOT IMPLEMENTED: {interaction_id}') \ No newline at end of file diff --git a/interact/l2cap.py b/interact/l2cap.py deleted file mode 100644 index 4ee8e7d..0000000 --- a/interact/l2cap.py +++ /dev/null @@ -1,48 +0,0 @@ -import os - -from grpc import Channel - -from facade import l2cap_grpc, neighbor_grpc -from facade.common_pb2 import BluetoothAddress -from facade.l2cap_pb2 import RetransmissionFlowControlMode - -PSM = 1 # TODO: Add it to either utils.py or config file - -def interact(channel: Channel, interaction_id: str, pts_addr: bytes): - print(f'mmi_id: {interaction_id}') - addr = BluetoothAddress(address=pts_addr) - l2cap = l2cap_grpc.L2capClassicModuleFacade(channel) - neighbor = neighbor_grpc.NeighborFacade(channel) - if interaction_id == "MMI_TESTER_ENABLE_CONNECTION": - neighbor.EnablePageScan(enabled=True) - l2cap.SetDynamicChannel( - psm=PSM, - enable=True, - retransmission_mode=RetransmissionFlowControlMode.BASIC - ) - if interaction_id == "MMI_IUT_SEND_CONFIG_REQ": - pass - if interaction_id == "MMI_IUT_SEND_L2CAP_DATA": - payload = b'\x00' + os.urandom(40) + b'\x00' - l2cap.SendDynamicChannelPacket( - remote=addr, - psm=PSM, - payload=payload - ) - if interaction_id == "MMI_IUT_INITIATE_ACL_CONNECTION": - l2cap.SetDynamicChannel( - psm=PSM, - enable=True, - retransmission_mode=RetransmissionFlowControlMode.BASIC - ) - l2cap.OpenChannel( - remote=addr, - psm=PSM, - mode=RetransmissionFlowControlMode.BASIC - ) - if interaction_id == ("MMI_IUT_DISABLE_CONNECTION" or "MMI_IUT_SEND_DISCONNECT_RSP"): - l2cap.CloseChannel(psm=PSM) - if interaction_id == "MMI_IUT_SEND_ACL_DISCONNECTON": - pass - if interaction_id == "MMI_IUT_SEND_CONFIG_RSP": - pass diff --git a/proto/blueberry/a2dp.proto b/proto/blueberry/a2dp.proto new file mode 100644 index 0000000..803ab0a --- /dev/null +++ b/proto/blueberry/a2dp.proto @@ -0,0 +1,78 @@ +syntax = "proto3"; + +package blueberry; + +import "blueberry/host.proto"; + +service A2DP { + rpc OpenSource(OpenSourceRequest) returns (OpenSourceResponse); + rpc OpenSink(OpenSinkRequest) returns (OpenSinkResponse); + rpc Start(StartRequest) returns (StartResponse); + rpc Suspend(SuspendRequest) returns (SuspendResponse); + rpc Close(CloseRequest) returns (CloseResponse); + rpc Abort(AbortRequest) returns (AbortResponse); +} + +message Source { + bytes cookie = 1; +} + +message Sink { + bytes cookie = 1; +} + +message OpenSourceRequest { + Connection connection = 1; +} + +message OpenSourceResponse { + oneof response { + Source source = 1; + } +} + +message OpenSinkRequest { + Connection connection = 1; +} + +message OpenSinkResponse { + oneof response { + Sink sink = 1; + } +} + +message StartRequest { + oneof response { + Sink sink = 1; + Source source = 2; + } +} + +message StartResponse {} + +message SuspendRequest { + oneof response { + Sink sink = 1; + Source source = 2; + } +} + +message SuspendResponse {} + +message CloseRequest { + oneof response { + Sink sink = 1; + Source source = 2; + } +} + +message CloseResponse {} + +message AbortRequest { + oneof response { + Sink sink = 1; + Source source = 2; + } +} + +message AbortResponse {} \ No newline at end of file diff --git a/proto/blueberry/host.proto b/proto/blueberry/host.proto new file mode 100644 index 0000000..85697e5 --- /dev/null +++ b/proto/blueberry/host.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; + +package blueberry; + +import "google/protobuf/empty.proto"; + +service Host { + rpc Reset(google.protobuf.Empty) returns (google.protobuf.Empty); + rpc Connect(ConnectRequest) returns (ConnectResponse); + rpc Disconnect(DisconnectRequest) returns (DisconnectResponse); + rpc ReadLocalAddress(google.protobuf.Empty) returns (ReadLocalAddressResponse); + rpc SetConnectable(SetConnectableRequest) returns (SetConnectableResponse); +} + +message Connection { + bytes cookie = 1; +} + +message ConnectRequest { + bytes address = 1; +} + +message ConnectResponse { + oneof response { + Connection connection = 1; + } +} + +message DisconnectRequest { + Connection connection = 1; +} + +message DisconnectResponse {} + +message ReadLocalAddressResponse { + bytes address = 1; +} + +message SetConnectableRequest { + bool connectable = 1; +} + +message SetConnectableResponse {} \ No newline at end of file diff --git a/proto/facade/common.proto b/proto/facade/common.proto deleted file mode 100644 index 222caca..0000000 --- a/proto/facade/common.proto +++ /dev/null @@ -1,37 +0,0 @@ -syntax = "proto3"; - -package bluetooth.facade; - -message Empty {} - -message Data { - bytes payload = 1; -} - -message BluetoothAddress { - bytes address = 1; -} - -enum BluetoothAddressTypeEnum { - PUBLIC_DEVICE_ADDRESS = 0x0; - RANDOM_DEVICE_ADDRESS = 0x1; - PUBLIC_IDENTITY_ADDRESS = 0x2; - RANDOM_IDENTITY_ADDRESS = 0x3; -} - -enum BluetoothOwnAddressTypeEnum { - USE_PUBLIC_DEVICE_ADDRESS = 0x0; - USE_RANDOM_DEVICE_ADDRESS = 0x1; - RESOLVABLE_OR_PUBLIC_ADDRESS = 0x2; - RESOLVABLE_OR_RANDOM_ADDRESS = 0x3; -} - -message BluetoothAddressWithType { - BluetoothAddress address = 1; - BluetoothAddressTypeEnum type = 2; -} - -enum BluetoothPeerAddressTypeEnum { - PUBLIC_DEVICE_OR_IDENTITY_ADDRESS = 0x0; - RANDOM_DEVICE_OR_IDENTITY_ADDRESS = 0x1; -} diff --git a/proto/facade/l2cap.proto b/proto/facade/l2cap.proto deleted file mode 100644 index 7951ec4..0000000 --- a/proto/facade/l2cap.proto +++ /dev/null @@ -1,129 +0,0 @@ -syntax = "proto3"; - -package bluetooth.l2cap.classic; - -import "facade/common.proto"; - -service L2capClassicModuleFacade { - rpc FetchConnectionComplete(facade.Empty) returns (stream ConnectionCompleteEvent) { - // Testing Android Bluetooth stack only. Optional for other stack. - } - rpc FetchConnectionClose(facade.Empty) returns (stream ConnectionCloseEvent) { - // Testing Android Bluetooth stack only. Optional for other stack. - } - rpc OpenChannel(OpenChannelRequest) returns (facade.Empty) {} - rpc CloseChannel(CloseChannelRequest) returns (facade.Empty) {} - rpc FetchL2capData(facade.Empty) returns (stream L2capPacket) {} - rpc SetDynamicChannel(SetEnableDynamicChannelRequest) returns (facade.Empty) {} - rpc SendDynamicChannelPacket(DynamicChannelPacket) returns (facade.Empty) {} - rpc SetTrafficPaused(SetTrafficPausedRequest) returns (facade.Empty) {} - rpc GetChannelQueueDepth(facade.Empty) returns (GetChannelQueueDepthResponse) { - // Get the buffer size of channel queue end for L2CAP user (how many packets we can buffer - // before L2CAP user dequeues. - } - rpc InitiateConnectionForSecurity(facade.BluetoothAddress) returns (facade.Empty) {} - rpc FetchSecurityConnectionEvents(facade.Empty) returns (stream LinkSecurityInterfaceCallbackEvent) {} - rpc SecurityLinkEnsureAuthenticated(facade.BluetoothAddress) returns (facade.Empty) {} - rpc SecurityLinkHold(facade.BluetoothAddress) returns (facade.Empty) {} - rpc SecurityLinkDisconnect(facade.BluetoothAddress) returns (facade.Empty) {} - rpc SecurityLinkRelease(facade.BluetoothAddress) returns (facade.Empty) {} -} - -enum LinkSecurityInterfaceCallbackEventType { - ON_CONNECTED = 0; - ON_DISCONNECTED = 1; - ON_AUTHENTICATION_COMPLETE = 2; - ON_ENCRYPTION_CHANGE = 3; - ON_READ_REMOTE_VERSION_INFO = 4; - ON_READ_REMOTE_EXTENDED_FEATURES = 5; -} - -message LinkSecurityInterfaceCallbackEvent { - facade.BluetoothAddress address = 1; - LinkSecurityInterfaceCallbackEventType event_type = 2; -} - -message RegisterChannelRequest { - uint32 channel = 1; -} - -message ConnectionCompleteEvent { - facade.BluetoothAddress remote = 1; -} - -message ConnectionCloseEvent { - facade.BluetoothAddress remote = 1; - uint32 reason = 2; -} - -enum RetransmissionFlowControlMode { - BASIC = 0; - ERTM = 1; - ERTM_OPTIONAL = 2; -} - -message OpenChannelRequest { - facade.BluetoothAddress remote = 1; - uint32 psm = 2; - RetransmissionFlowControlMode mode = 3; -} - -message CloseChannelRequest { - uint32 psm = 1; -} - -enum ChannelSignalEventType { - OPEN = 0; - CLOSE = 1; - CONFIGURE = 2; -} - -message ChannelSignalEvent { - uint32 cid = 1; - ChannelSignalEventType type = 2; -} - -enum SendL2capPacketResultType { - OK = 0; - BAD_CID = 1; -} - -message SendL2capPacketResult { - SendL2capPacketResultType result_type = 1; -} - -message L2capPacket { - oneof channel_type { - uint32 psm = 1; - uint32 fixed_cid = 2; - } - bytes payload = 3; -} - -message SetEnableDynamicChannelRequest { - uint32 psm = 1; - bool enable = 2; - RetransmissionFlowControlMode retransmission_mode = 3; -} - -message DynamicChannelPacket { - facade.BluetoothAddress remote = 1; - uint32 psm = 2; - bytes payload = 3; -} - -message SetTrafficPausedRequest { - bool paused = 1; - uint32 psm = 2; -} - -message GetChannelQueueDepthResponse { - uint32 size = 1; -} - -enum ClassicSecurityPolicy { - ENCRYPTED_TRANSPORT = 0; - AUTHENTICATED_ENCRYPTED_TRANSPORT = 1; - BEST = 2; - _SDP_ONLY_NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK = 3; -} diff --git a/proto/facade/neighbor.proto b/proto/facade/neighbor.proto deleted file mode 100644 index 03defe1..0000000 --- a/proto/facade/neighbor.proto +++ /dev/null @@ -1,61 +0,0 @@ -syntax = "proto3"; - -package bluetooth.neighbor; - -import "facade/common.proto"; - -service NeighborFacade { - rpc SetConnectability(EnableMsg) returns (facade.Empty) {} - rpc SetDiscoverability(DiscoverabilitiyMsg) returns (facade.Empty) {} - rpc SetInquiryMode(InquiryMsg) returns (stream InquiryResultMsg) { - // Sets inquiry mode and fetches inquiry result HCI packet - } - rpc ReadRemoteName(RemoteNameRequestMsg) returns (facade.Empty) {} - rpc GetRemoteNameEvents(facade.Empty) returns (stream RemoteNameResponseMsg) {} - // TODO: Should we use a blocking call for ReadRemoteName instead? (Note: blocking model may not work for GD stack) - rpc EnableInquiryScan(EnableMsg) returns (facade.Empty) {} - rpc EnablePageScan(EnableMsg) returns (facade.Empty) {} -} - -message EnableMsg { - bool enabled = 1; -} - -enum DiscoverabilityMode { - OFF = 0; - LIMITED = 1; - GENERAL = 2; -} - -message DiscoverabilitiyMsg { - DiscoverabilityMode mode = 1; -} - -enum ResultMode { - STANDARD = 0; - RSSI = 1; - EXTENDED = 2; -} - -message InquiryMsg { - DiscoverabilityMode inquiry_mode = 1; - ResultMode result_mode = 2; - uint32 length_1_28s = 3; - uint32 max_results = 4; // 0 is unlimited -} - -message InquiryResultMsg { - bytes packet = 1; -} - -message RemoteNameRequestMsg { - bytes address = 1; - uint32 page_scan_repetition_mode = 2; // r0, r1, r2 - uint32 clock_offset = 3; -} - -message RemoteNameResponseMsg { - uint32 status = 1; - bytes address = 2; - bytes name = 3; -} diff --git a/proto/facade/rootservice.proto b/proto/facade/rootservice.proto deleted file mode 100644 index 63ec41a..0000000 --- a/proto/facade/rootservice.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto3"; -package bluetooth.facade; - -import "facade/common.proto"; - -service RootFacade { - rpc StartStack(StartStackRequest) returns (StartStackResponse) {} - rpc StopStack(StopStackRequest) returns (StopStackResponse) {} -} - -enum BluetoothModule { - HAL = 0; - HCI = 1; - HCI_INTERFACES = 2; - L2CAP = 3; - SECURITY = 4; - SHIM = 5; -} - -message StartStackRequest { - BluetoothModule module_under_test = 1; -} - -message StartStackResponse {} - -message StopStackRequest {} - -message StopStackResponse {} - -service ReadOnlyProperty { - rpc ReadLocalAddress(Empty) returns (BluetoothAddress) {} -} diff --git a/protoc-gen-custom_grpc b/protoc-gen-custom_grpc index a45dc19..3a0c8be 100755 --- a/protoc-gen-custom_grpc +++ b/protoc-gen-custom_grpc @@ -10,11 +10,14 @@ def eprint(*args, **kwargs): request = CodeGeneratorRequest.FromString(sys.stdin.buffer.read()) +def has_type(proto_file, type_name): + return any(filter(lambda x: x.name == type_name, proto_file.message_type)) def import_type(imports, type): + # eprint(f'type: {type} request: {request.proto_file}') package = type[1:type.rindex('.')] type_name = type[type.rindex('.')+1:] - file = next(filter(lambda x: x.package == package, request.proto_file)) + file = next(filter(lambda x: x.package == package and has_type(x, type_name), request.proto_file)) python_path = file.name.replace('.proto', '').replace('/', '.') as_name = python_path.replace('.', '_dot_') + '__pb2' module_path = python_path[:python_path.rindex('.')] @@ -34,12 +37,12 @@ def generate_method(imports, file, service, method): raise Error("TODO: stream as input type") return ( - f'def {method.name}(self, **kwargs):\n' + f'def {method.name}(self, wait_for_ready=None, **kwargs):\n' f' return self.channel.{input_mode}_{output_mode}(\n' f" '/{file.package}.{service.name}/{method.name}',\n" f' request_serializer={input_type}.SerializeToString,\n' f' response_deserializer={output_type}.FromString\n' - f' )({input_type}(**kwargs))' + f' )({input_type}(**kwargs), wait_for_ready=wait_for_ready)' ).split('\n') diff --git a/setup.py b/setup.py index 20fd953..1af2b9e 100755 --- a/setup.py +++ b/setup.py @@ -27,10 +27,8 @@ class BuildGrpc(Command): '-I=proto', '--python_out=.', '--custom_grpc_out=.', - 'facade/l2cap.proto', - 'facade/neighbor.proto', - 'facade/common.proto', - 'facade/rootservice.proto', + 'blueberry/host.proto', + 'blueberry/a2dp.proto' ]) -- cgit v1.2.3 From c8e0a2be5f0b4149885f6ec4397fb001199b870c Mon Sep 17 00:00:00 2001 From: David Duarte Date: Sat, 30 Oct 2021 16:17:21 +0000 Subject: interact: add a reset function Change-Id: I4b7ecba900aedd14f3da1c508db1bd06ef30954e --- interact/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/interact/__init__.py b/interact/__init__.py index faa92b2..dac3702 100644 --- a/interact/__init__.py +++ b/interact/__init__.py @@ -5,6 +5,7 @@ from blueberry.host_grpc import Host GRPC_PORT = 8999 + def run(profile: str, interaction_id: str, test: str, pts_addr: bytes): channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') print(f'{profile} mmi: {interaction_id}') @@ -12,6 +13,13 @@ def run(profile: str, interaction_id: str, test: str, pts_addr: bytes): a2dp.interact(channel, interaction_id, test, pts_addr) channel.close() + +def reset(): + channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') + Host(channel).Reset(wait_for_ready=True) + channel.close() + + def read_local_address() -> bytes: channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') bluetooth_address = Host(channel).ReadLocalAddress(wait_for_ready=True) -- cgit v1.2.3 From 6abe2b9d9d084308f27ed2b8fc8a8cab8f486aa1 Mon Sep 17 00:00:00 2001 From: David Duarte Date: Sat, 30 Oct 2021 16:18:02 +0000 Subject: a2dp: Run autopep8 Change-Id: I8d089c886719fa5fe7ce1b21ef3b17db9dd792ce --- interact/a2dp.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/interact/a2dp.py b/interact/a2dp.py index 66d46de..a0c1046 100644 --- a/interact/a2dp.py +++ b/interact/a2dp.py @@ -6,12 +6,13 @@ from blueberry.host_grpc import Host from blueberry.a2dp_pb2 import Sink, Source from blueberry.host_pb2 import Connection -_connection: Connection = None; -_sink: Sink = None; -_source: Source = None; +_connection: Connection = None +_sink: Sink = None +_source: Source = None + def interact(channel: Channel, interaction_id: str, test: str, pts_addr: bytes): - global _connection, _sink, _source; + global _connection, _sink, _source a2dp = A2DP(channel) host = Host(channel) if interaction_id == "TSC_AVDTP_mmi_iut_accept_connect": @@ -48,4 +49,4 @@ def interact(channel: Channel, interaction_id: str, test: str, pts_addr: bytes): elif interaction_id == "TSC_AVDTP_mmi_iut_accept_reconnect": pass else: - print(f'MMI NOT IMPLEMENTED: {interaction_id}') \ No newline at end of file + print(f'MMI NOT IMPLEMENTED: {interaction_id}') -- cgit v1.2.3 From 06f6792616057aa651774cf89ebef5081e29b636 Mon Sep 17 00:00:00 2001 From: David Duarte Date: Tue, 2 Nov 2021 12:54:52 +0000 Subject: host: Add a GetConnection grpc method Change-Id: I66ffc146e0345442379a960921421536ee29aad2 --- interact/a2dp.py | 15 ++++++++++----- proto/blueberry/host.proto | 13 ++++++++++++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/interact/a2dp.py b/interact/a2dp.py index a0c1046..45c62c0 100644 --- a/interact/a2dp.py +++ b/interact/a2dp.py @@ -1,3 +1,5 @@ +from typing import Optional + from grpc import Channel from blueberry.a2dp_grpc import A2DP @@ -6,10 +8,14 @@ from blueberry.host_grpc import Host from blueberry.a2dp_pb2 import Sink, Source from blueberry.host_pb2 import Connection -_connection: Connection = None -_sink: Sink = None -_source: Source = None +_connection: Optional[Connection] = None +_sink: Optional[Sink] = None +_source: Optional[Source] = None +def _ensure_connection(host, addr): + global _connection + if not _connection: + _connection = host.GetConnection(address=addr).connection def interact(channel: Channel, interaction_id: str, test: str, pts_addr: bytes): global _connection, _sink, _source @@ -22,8 +28,7 @@ def interact(channel: Channel, interaction_id: str, test: str, pts_addr: bytes): if "SNK" in test: _sink = a2dp.OpenSink(connection=_connection).sink elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_out_of_range": - if not _connection: - _connection = Connection(cookie=pts_addr) + _ensure_connection(host, pts_addr) host.Disconnect(connection=_connection) _connection = None _sink = None diff --git a/proto/blueberry/host.proto b/proto/blueberry/host.proto index 85697e5..61ddd8a 100644 --- a/proto/blueberry/host.proto +++ b/proto/blueberry/host.proto @@ -7,6 +7,7 @@ import "google/protobuf/empty.proto"; service Host { rpc Reset(google.protobuf.Empty) returns (google.protobuf.Empty); rpc Connect(ConnectRequest) returns (ConnectResponse); + rpc GetConnection(GetConnectionRequest) returns (GetConnectionResponse); rpc Disconnect(DisconnectRequest) returns (DisconnectResponse); rpc ReadLocalAddress(google.protobuf.Empty) returns (ReadLocalAddressResponse); rpc SetConnectable(SetConnectableRequest) returns (SetConnectableResponse); @@ -26,6 +27,16 @@ message ConnectResponse { } } +message GetConnectionRequest { + bytes address = 1; +} + +message GetConnectionResponse { + oneof response { + Connection connection = 1; + } +} + message DisconnectRequest { Connection connection = 1; } @@ -40,4 +51,4 @@ message SetConnectableRequest { bool connectable = 1; } -message SetConnectableResponse {} \ No newline at end of file +message SetConnectableResponse {} -- cgit v1.2.3 From 2de7ebfe5e7d62729d22928e03bbab1b4691a217 Mon Sep 17 00:00:00 2001 From: David Duarte Date: Mon, 8 Nov 2021 13:25:58 +0000 Subject: setup.py: Fix package name Change-Id: I1bd1e034dbc373ddfc02f6d2599182d8a49a82a2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1af2b9e..02e2df6 100755 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ class BuildPyCommand(build_py): setup( name='mmi2grpc', version='0.0.1', - packages=['interact', 'facade'], + packages=['interact', 'blueberry'], install_requires=[ 'grpcio', ], -- cgit v1.2.3 From e6486b0e445c0b9cac75089477f53680f0f5d4f7 Mon Sep 17 00:00:00 2001 From: David Duarte Date: Mon, 8 Nov 2021 13:28:43 +0000 Subject: gitignore: Add build folder to gitgnore This folder is created by running ./setup.py build Change-Id: Iaf0a1b825b5172aa18d021ed858cbbc42eede883 --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f781d3d..14ca2c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ virtualenv out/ +build __pycache__ blueberry/* !blueberry/__init__.py -.eggs/ \ No newline at end of file +.eggs/ -- cgit v1.2.3 From 41ea55d6aa26a778b606cb85a69f80d2421a3fd3 Mon Sep 17 00:00:00 2001 From: David Duarte Date: Mon, 8 Nov 2021 13:33:58 +0000 Subject: interact: Rename to mmi2grpc Change-Id: If36ca3eb01a45ab61a221c93b82022299048cf6c --- interact/__init__.py | 27 ------------------------- interact/a2dp.py | 57 ---------------------------------------------------- mmi2grpc/__init__.py | 27 +++++++++++++++++++++++++ mmi2grpc/a2dp.py | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 2 +- 5 files changed, 85 insertions(+), 85 deletions(-) delete mode 100644 interact/__init__.py delete mode 100644 interact/a2dp.py create mode 100644 mmi2grpc/__init__.py create mode 100644 mmi2grpc/a2dp.py diff --git a/interact/__init__.py b/interact/__init__.py deleted file mode 100644 index dac3702..0000000 --- a/interact/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -import grpc -from . import a2dp - -from blueberry.host_grpc import Host - -GRPC_PORT = 8999 - - -def run(profile: str, interaction_id: str, test: str, pts_addr: bytes): - channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') - print(f'{profile} mmi: {interaction_id}') - if profile == "A2DP": - a2dp.interact(channel, interaction_id, test, pts_addr) - channel.close() - - -def reset(): - channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') - Host(channel).Reset(wait_for_ready=True) - channel.close() - - -def read_local_address() -> bytes: - channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') - bluetooth_address = Host(channel).ReadLocalAddress(wait_for_ready=True) - channel.close() - return bluetooth_address.address diff --git a/interact/a2dp.py b/interact/a2dp.py deleted file mode 100644 index 45c62c0..0000000 --- a/interact/a2dp.py +++ /dev/null @@ -1,57 +0,0 @@ -from typing import Optional - -from grpc import Channel - -from blueberry.a2dp_grpc import A2DP -from blueberry.host_grpc import Host - -from blueberry.a2dp_pb2 import Sink, Source -from blueberry.host_pb2 import Connection - -_connection: Optional[Connection] = None -_sink: Optional[Sink] = None -_source: Optional[Source] = None - -def _ensure_connection(host, addr): - global _connection - if not _connection: - _connection = host.GetConnection(address=addr).connection - -def interact(channel: Channel, interaction_id: str, test: str, pts_addr: bytes): - global _connection, _sink, _source - a2dp = A2DP(channel) - host = Host(channel) - if interaction_id == "TSC_AVDTP_mmi_iut_accept_connect": - host.SetConnectable(connectable=True) - elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_start": - _connection = host.Connect(address=pts_addr).connection - if "SNK" in test: - _sink = a2dp.OpenSink(connection=_connection).sink - elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_out_of_range": - _ensure_connection(host, pts_addr) - host.Disconnect(connection=_connection) - _connection = None - _sink = None - _source = None - elif interaction_id == "TSC_AVDTP_mmi_iut_accept_discover": - pass - elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_set_configuration": - _connection = host.Connect(address=pts_addr).connection - if "SRC" in test: - _source = a2dp.OpenSource(connection=_connection).source - elif interaction_id == "TSC_AVDTP_mmi_iut_accept_close_stream": - pass - elif interaction_id == "TSC_AVDTP_mmi_iut_accept_get_capabilities": - pass - elif interaction_id == "TSC_AVDTP_mmi_iut_accept_set_configuration": - pass - elif interaction_id == "TSC_AVDTP_mmi_iut_accept_open_stream": - pass - elif interaction_id == "TSC_AVDTP_mmi_iut_accept_start": - pass - elif interaction_id == "TSC_AVDTP_mmi_iut_confirm_streaming": - pass - elif interaction_id == "TSC_AVDTP_mmi_iut_accept_reconnect": - pass - else: - print(f'MMI NOT IMPLEMENTED: {interaction_id}') diff --git a/mmi2grpc/__init__.py b/mmi2grpc/__init__.py new file mode 100644 index 0000000..dac3702 --- /dev/null +++ b/mmi2grpc/__init__.py @@ -0,0 +1,27 @@ +import grpc +from . import a2dp + +from blueberry.host_grpc import Host + +GRPC_PORT = 8999 + + +def run(profile: str, interaction_id: str, test: str, pts_addr: bytes): + channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') + print(f'{profile} mmi: {interaction_id}') + if profile == "A2DP": + a2dp.interact(channel, interaction_id, test, pts_addr) + channel.close() + + +def reset(): + channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') + Host(channel).Reset(wait_for_ready=True) + channel.close() + + +def read_local_address() -> bytes: + channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') + bluetooth_address = Host(channel).ReadLocalAddress(wait_for_ready=True) + channel.close() + return bluetooth_address.address diff --git a/mmi2grpc/a2dp.py b/mmi2grpc/a2dp.py new file mode 100644 index 0000000..45c62c0 --- /dev/null +++ b/mmi2grpc/a2dp.py @@ -0,0 +1,57 @@ +from typing import Optional + +from grpc import Channel + +from blueberry.a2dp_grpc import A2DP +from blueberry.host_grpc import Host + +from blueberry.a2dp_pb2 import Sink, Source +from blueberry.host_pb2 import Connection + +_connection: Optional[Connection] = None +_sink: Optional[Sink] = None +_source: Optional[Source] = None + +def _ensure_connection(host, addr): + global _connection + if not _connection: + _connection = host.GetConnection(address=addr).connection + +def interact(channel: Channel, interaction_id: str, test: str, pts_addr: bytes): + global _connection, _sink, _source + a2dp = A2DP(channel) + host = Host(channel) + if interaction_id == "TSC_AVDTP_mmi_iut_accept_connect": + host.SetConnectable(connectable=True) + elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_start": + _connection = host.Connect(address=pts_addr).connection + if "SNK" in test: + _sink = a2dp.OpenSink(connection=_connection).sink + elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_out_of_range": + _ensure_connection(host, pts_addr) + host.Disconnect(connection=_connection) + _connection = None + _sink = None + _source = None + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_discover": + pass + elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_set_configuration": + _connection = host.Connect(address=pts_addr).connection + if "SRC" in test: + _source = a2dp.OpenSource(connection=_connection).source + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_close_stream": + pass + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_get_capabilities": + pass + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_set_configuration": + pass + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_open_stream": + pass + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_start": + pass + elif interaction_id == "TSC_AVDTP_mmi_iut_confirm_streaming": + pass + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_reconnect": + pass + else: + print(f'MMI NOT IMPLEMENTED: {interaction_id}') diff --git a/setup.py b/setup.py index 02e2df6..47618ca 100755 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ class BuildPyCommand(build_py): setup( name='mmi2grpc', version='0.0.1', - packages=['interact', 'blueberry'], + packages=['mmi2grpc', 'blueberry'], install_requires=[ 'grpcio', ], -- cgit v1.2.3 From 6e7447ca74ccd2fc2b716c2619f3fe91475581c7 Mon Sep 17 00:00:00 2001 From: David Duarte Date: Mon, 8 Nov 2021 14:19:37 +0000 Subject: setup.py: Add grpc_tools proto include path Change-Id: I577f6fbd7ea4ec204927baed7ca20570aaab8e0d --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 47618ca..8e54d32 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 from setuptools import setup, Command from setuptools.command.build_py import build_py +import pkg_resources import os package_directory = os.path.dirname(os.path.realpath(__file__)) @@ -22,9 +23,12 @@ class BuildGrpc(Command): def run(self): from grpc_tools import protoc + proto_include = pkg_resources.resource_filename('grpc_tools', '_proto') + protoc.main([ 'grpc_tools.protoc', - '-I=proto', + '-Iproto', + f'-I{proto_include}', '--python_out=.', '--custom_grpc_out=.', 'blueberry/host.proto', -- cgit v1.2.3 From b18f8bfb854667b3c11a2b4a3f771b78fa01119a Mon Sep 17 00:00:00 2001 From: Charlie Boutier Date: Wed, 3 Nov 2021 13:53:18 +0000 Subject: a2dp: add mmi Change-Id: I015fd6f7a9da6ac67a7ce583021d1e5074f54d8c --- mmi2grpc/a2dp.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/mmi2grpc/a2dp.py b/mmi2grpc/a2dp.py index 45c62c0..60a55fd 100644 --- a/mmi2grpc/a2dp.py +++ b/mmi2grpc/a2dp.py @@ -17,6 +17,18 @@ def _ensure_connection(host, addr): if not _connection: _connection = host.GetConnection(address=addr).connection +def _ensure_sink_open(host, a2dp, addr): + global _connection, _sink, _source + _ensure_connection(host, addr) + if not _sink: + _sink = a2dp.OpenSink(connection=_connection).sink + +def _ensure_source_open(host, a2dp, addr): + global _connection, _source + _ensure_connection(host, addr) + if not _source: + _source = a2dp.OpenSource(connection=_connection).source + def interact(channel: Channel, interaction_id: str, test: str, pts_addr: bytes): global _connection, _sink, _source a2dp = A2DP(channel) @@ -24,9 +36,13 @@ def interact(channel: Channel, interaction_id: str, test: str, pts_addr: bytes): if interaction_id == "TSC_AVDTP_mmi_iut_accept_connect": host.SetConnectable(connectable=True) elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_start": - _connection = host.Connect(address=pts_addr).connection + _ensure_connection(host, pts_addr) if "SNK" in test: - _sink = a2dp.OpenSink(connection=_connection).sink + _ensure_sink_open(host, a2dp, pts_addr) + a2dp.Start(sink=_sink) + if "SRC" in test: + _ensure_source_open(host, a2dp, pts_addr) + a2dp.Close(source=_source) elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_out_of_range": _ensure_connection(host, pts_addr) host.Disconnect(connection=_connection) @@ -39,6 +55,32 @@ def interact(channel: Channel, interaction_id: str, test: str, pts_addr: bytes): _connection = host.Connect(address=pts_addr).connection if "SRC" in test: _source = a2dp.OpenSource(connection=_connection).source + if "SNK" in test: + _sink = a2dp.OpenSink(connection=_connection).sink + elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_open_stream": + _ensure_connection(host, pts_addr) + if "SNK" in test: + _sink = a2dp.OpenSink(connection=_connection).sink + if "SRC" in test: + _source = a2dp.OpenSource(connection=_connection).source + elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_close_stream": + _ensure_connection(host, pts_addr) + if "SNK" in test: + _ensure_sink_open(host, a2dp, pts_addr) + a2dp.Close(sink=_sink) + _sink = None + if "SRC" in test: + _ensure_source_open(host, a2dp, pts_addr) + a2dp.Close(source=_source) + _source = None + elif interaction_id == "TSC_AVDTP_mmi_iut_initiate_suspend": + _ensure_connection(host, pts_addr) + if "SNK" in test: + _ensure_sink_open(host, a2dp, pts_addr) + a2dp.Suspend(sink=_sink) + if "SRC" in test: + _ensure_source_open(host, a2dp, pts_addr) + a2dp.suspend(source=_source) elif interaction_id == "TSC_AVDTP_mmi_iut_accept_close_stream": pass elif interaction_id == "TSC_AVDTP_mmi_iut_accept_get_capabilities": @@ -53,5 +95,7 @@ def interact(channel: Channel, interaction_id: str, test: str, pts_addr: bytes): pass elif interaction_id == "TSC_AVDTP_mmi_iut_accept_reconnect": pass + elif interaction_id == "TSC_AVDTP_mmi_iut_accept_suspend": + pass else: print(f'MMI NOT IMPLEMENTED: {interaction_id}') -- cgit v1.2.3 From 2fed870203ce3567f58e3506d769d2edc80184c6 Mon Sep 17 00:00:00 2001 From: David Duarte Date: Wed, 22 Dec 2021 13:03:59 +0000 Subject: protoc-gen-custom_grpc: Support stream input mode Change-Id: I2b215bf9f14c2b25fa75cb1272b836122629c0eb --- protoc-gen-custom_grpc | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/protoc-gen-custom_grpc b/protoc-gen-custom_grpc index 3a0c8be..eb5ec11 100755 --- a/protoc-gen-custom_grpc +++ b/protoc-gen-custom_grpc @@ -34,16 +34,23 @@ def generate_method(imports, file, service, method): output_type = import_type(imports, method.output_type) if input_mode == 'stream': - raise Error("TODO: stream as input type") - - return ( - f'def {method.name}(self, wait_for_ready=None, **kwargs):\n' - f' return self.channel.{input_mode}_{output_mode}(\n' - f" '/{file.package}.{service.name}/{method.name}',\n" - f' request_serializer={input_type}.SerializeToString,\n' - f' response_deserializer={output_type}.FromString\n' - f' )({input_type}(**kwargs), wait_for_ready=wait_for_ready)' - ).split('\n') + return ( + f'def {method.name}(self, iterator, **kwargs):\n' + f' return self.channel.{input_mode}_{output_mode}(\n' + f" '/{file.package}.{service.name}/{method.name}',\n" + f' request_serializer={input_type}.SerializeToString,\n' + f' response_deserializer={output_type}.FromString\n' + f' )(iterator, **kwargs)' + ).split('\n') + else: + return ( + f'def {method.name}(self, wait_for_ready=None, **kwargs):\n' + f' return self.channel.{input_mode}_{output_mode}(\n' + f" '/{file.package}.{service.name}/{method.name}',\n" + f' request_serializer={input_type}.SerializeToString,\n' + f' response_deserializer={output_type}.FromString\n' + f' )({input_type}(**kwargs), wait_for_ready=wait_for_ready)' + ).split('\n') def generate_service(imports, file, service): -- cgit v1.2.3 From 3819001d8d9b86da41d493e7c85777845f47019b Mon Sep 17 00:00:00 2001 From: David Duarte Date: Wed, 22 Dec 2021 13:09:23 +0000 Subject: a2dp: Refactor and handle AVDTP mmi Change-Id: Ib6384e12c81f8adc2d8f73bf945cf7efe4e250ee --- mmi2grpc/__init__.py | 40 ++- mmi2grpc/_audio.py | 79 ++++++ mmi2grpc/_description.py | 41 +++ mmi2grpc/a2dp.py | 649 ++++++++++++++++++++++++++++++++++++++------- proto/blueberry/a2dp.proto | 179 ++++++++++++- proto/blueberry/host.proto | 65 ++++- 6 files changed, 931 insertions(+), 122 deletions(-) create mode 100644 mmi2grpc/_audio.py create mode 100644 mmi2grpc/_description.py diff --git a/mmi2grpc/__init__.py b/mmi2grpc/__init__.py index dac3702..b62f2ee 100644 --- a/mmi2grpc/__init__.py +++ b/mmi2grpc/__init__.py @@ -1,27 +1,39 @@ +from typing import Optional import grpc -from . import a2dp +import time +import sys +import textwrap + +from .a2dp import A2DPProxy from blueberry.host_grpc import Host GRPC_PORT = 8999 +_a2dp: Optional[A2DPProxy] = None + -def run(profile: str, interaction_id: str, test: str, pts_addr: bytes): - channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') - print(f'{profile} mmi: {interaction_id}') - if profile == "A2DP": - a2dp.interact(channel, interaction_id, test, pts_addr) - channel.close() +def run(profile: str, interaction_id: str, test: str, description: str, pts_addr: bytes): + global _a2dp + print(f'{profile} mmi: {interaction_id}', file=sys.stderr) + if profile in ('A2DP', 'AVDTP'): + if not _a2dp: + _a2dp = A2DPProxy(grpc.insecure_channel(f'localhost:{GRPC_PORT}')) + return _a2dp.interact(interaction_id, test, description, pts_addr) def reset(): - channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') - Host(channel).Reset(wait_for_ready=True) - channel.close() + global a2dp + a2dp = None + with grpc.insecure_channel(f'localhost:{GRPC_PORT}') as channel: + Host(channel).Reset(wait_for_ready=True) def read_local_address() -> bytes: - channel = grpc.insecure_channel(f'localhost:{GRPC_PORT}') - bluetooth_address = Host(channel).ReadLocalAddress(wait_for_ready=True) - channel.close() - return bluetooth_address.address + with grpc.insecure_channel(f'localhost:{GRPC_PORT}') as channel: + try: + return Host(channel).ReadLocalAddress(wait_for_ready=True).address + except grpc.RpcError: + print('Retry') + time.sleep(5) + return Host(channel).ReadLocalAddress(wait_for_ready=True).address diff --git a/mmi2grpc/_audio.py b/mmi2grpc/_audio.py new file mode 100644 index 0000000..92e06df --- /dev/null +++ b/mmi2grpc/_audio.py @@ -0,0 +1,79 @@ +import itertools +import math +import os +from threading import Thread + +import numpy as np +from scipy.io import wavfile + + +def _fixup_wav_header(path): + WAV_RIFF_SIZE_OFFSET = 4 + WAV_DATA_SIZE_OFFSET = 40 + + with open(path, 'r+b') as f: + f.seek(0, os.SEEK_END) + file_size = f.tell() + for offset in [WAV_RIFF_SIZE_OFFSET, WAV_DATA_SIZE_OFFSET]: + size = file_size - offset - 4 + f.seek(offset) + f.write(size.to_bytes(4, byteorder='little')) + + +SINE_FREQUENCY = 440 +SINE_DURATION = 0.1 + +WAV_FILE = "/tmp/audiodata" + + +class AudioSignal: + def __init__(self, transport, amplitude, fs): + self.transport = transport + self.amplitude = amplitude + self.fs = fs + self.thread = None + + def start(self): + self.thread = Thread(target=self._run) + self.thread.start() + + def _run(self): + sine = self._generate_sine(SINE_FREQUENCY, SINE_DURATION) + + # Interleaved audio + stereo = np.zeros(sine.size * 2, dtype=sine.dtype) + stereo[0::2] = sine + + # Send 4 second of audio + audio = itertools.repeat(stereo.tobytes(), int(4 / SINE_DURATION)) + + self.transport(audio) + + def _generate_sine(self, f, duration): + sine = self.amplitude * \ + np.sin(2 * np.pi * np.arange(self.fs * duration) * (f / self.fs)) + s16le = (sine * 32767).astype(" Date: Tue, 11 Jan 2022 10:24:52 +0000 Subject: mmi2grpc: Fix reset of a2dp Change-Id: I018126711af14761e758c284a4f38ba2c9409d4c --- mmi2grpc/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmi2grpc/__init__.py b/mmi2grpc/__init__.py index b62f2ee..4d4074d 100644 --- a/mmi2grpc/__init__.py +++ b/mmi2grpc/__init__.py @@ -23,8 +23,8 @@ def run(profile: str, interaction_id: str, test: str, description: str, pts_addr def reset(): - global a2dp - a2dp = None + global _a2dp + _a2dp = None with grpc.insecure_channel(f'localhost:{GRPC_PORT}') as channel: Host(channel).Reset(wait_for_ready=True) -- cgit v1.2.3 From 6f782bfb8838a6e6559f94912498d958f67e72c5 Mon Sep 17 00:00:00 2001 From: David Duarte Date: Tue, 11 Jan 2022 15:24:17 +0000 Subject: assert_description: Fix return Change-Id: I41365fd59ea8d5c23cb01ebbdfaaf899b9dfc831 --- mmi2grpc/_description.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmi2grpc/_description.py b/mmi2grpc/_description.py index 0f3219b..a6fa3dd 100644 --- a/mmi2grpc/_description.py +++ b/mmi2grpc/_description.py @@ -23,7 +23,7 @@ def assert_description(f): docstring.strip(), description.strip(), f'description does not match with function docstring of {f.__name__}') - f(*args, **kwargs) + return f(*args, **kwargs) return wrapper -- cgit v1.2.3 From 4c6a3111b32f820f80d64423fc3a02939c6fa44b Mon Sep 17 00:00:00 2001 From: Henri Chataing Date: Thu, 13 Jan 2022 15:11:57 +0100 Subject: Rewrite PythonIUT interface - Interface is presented as an IUT class Change-Id: Idcc2f34ba6252e3f2d0d18d54f95b94de176d02d --- mmi2grpc/__init__.py | 66 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/mmi2grpc/__init__.py b/mmi2grpc/__init__.py index 4d4074d..76a162c 100644 --- a/mmi2grpc/__init__.py +++ b/mmi2grpc/__init__.py @@ -1,4 +1,6 @@ -from typing import Optional +# Copyright 2022 Google LLC + +from typing import List import grpc import time import sys @@ -10,30 +12,40 @@ from blueberry.host_grpc import Host GRPC_PORT = 8999 -_a2dp: Optional[A2DPProxy] = None - - -def run(profile: str, interaction_id: str, test: str, description: str, pts_addr: bytes): - global _a2dp - print(f'{profile} mmi: {interaction_id}', file=sys.stderr) - if profile in ('A2DP', 'AVDTP'): - if not _a2dp: - _a2dp = A2DPProxy(grpc.insecure_channel(f'localhost:{GRPC_PORT}')) - return _a2dp.interact(interaction_id, test, description, pts_addr) - - -def reset(): - global _a2dp - _a2dp = None - with grpc.insecure_channel(f'localhost:{GRPC_PORT}') as channel: - Host(channel).Reset(wait_for_ready=True) - -def read_local_address() -> bytes: - with grpc.insecure_channel(f'localhost:{GRPC_PORT}') as channel: - try: - return Host(channel).ReadLocalAddress(wait_for_ready=True).address - except grpc.RpcError: - print('Retry') - time.sleep(5) - return Host(channel).ReadLocalAddress(wait_for_ready=True).address +class IUT: + def __init__(self, args: List[str], port: int = GRPC_PORT): + self.a2dp_ = None + self.address_ = None + self.port = port + + def __enter__(self): + with grpc.insecure_channel(f'localhost:{self.port}') as channel: + Host(channel).Reset(wait_for_ready=True) + + def __exit__(self): + self.a2dp_ = None + + @property + def address(self) -> bytes: + with grpc.insecure_channel(f'localhost:{self.port}') as channel: + try: + return Host(channel).ReadLocalAddress(wait_for_ready=True).address + except grpc.RpcError: + print('Retry') + time.sleep(5) + return Host(channel).ReadLocalAddress(wait_for_ready=True).address + + def interact(self, + pts_address: bytes, + profile: str, + test: str, + interaction: str, + description: str, + style: str, + **kwargs) -> str: + print(f'{profile} mmi: {interaction}', file=sys.stderr) + if profile in ('A2DP', 'AVDTP'): + if not self.a2dp_: + self.a2dp_ = A2DPProxy(grpc.insecure_channel(f'localhost:{self.port}')) + return self.a2dp_.interact(interaction, test, description, pts_address) -- cgit v1.2.3 From 3cadac0953fb0a21c6546368daf9dd47c54855f1 Mon Sep 17 00:00:00 2001 From: Henri Chataing Date: Thu, 13 Jan 2022 15:11:57 +0100 Subject: Accept test name as parameter to __init__ Change-Id: Id5a11366fea8da0e23e4977e41e5d324be97306e --- mmi2grpc/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mmi2grpc/__init__.py b/mmi2grpc/__init__.py index 76a162c..194676a 100644 --- a/mmi2grpc/__init__.py +++ b/mmi2grpc/__init__.py @@ -14,10 +14,12 @@ GRPC_PORT = 8999 class IUT: - def __init__(self, args: List[str], port: int = GRPC_PORT): + def __init__(self, test: str, args: List[str], + port: int = GRPC_PORT, **kwargs): self.a2dp_ = None self.address_ = None self.port = port + self.test = test def __enter__(self): with grpc.insecure_channel(f'localhost:{self.port}') as channel: -- cgit v1.2.3 From 11a318b092a9826d3aab528cd41533ce10afe216 Mon Sep 17 00:00:00 2001 From: Charlie Boutier Date: Tue, 22 Mar 2022 15:12:50 +0000 Subject: setup: Add all proto file located into proto/blueberry Change-Id: I3298139c99349407a2efdd9d18921fb09e76b4e4 --- setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 8e54d32..a01b877 100755 --- a/setup.py +++ b/setup.py @@ -25,15 +25,14 @@ class BuildGrpc(Command): proto_include = pkg_resources.resource_filename('grpc_tools', '_proto') + files = [f'blueberry/{f}' for f in os.listdir('proto/blueberry') if f.endswith('.proto')] protoc.main([ 'grpc_tools.protoc', '-Iproto', f'-I{proto_include}', '--python_out=.', '--custom_grpc_out=.', - 'blueberry/host.proto', - 'blueberry/a2dp.proto' - ]) + ] + files) class BuildPyCommand(build_py): -- cgit v1.2.3 From bf1692bc8edf9d8b8104561bbc84ed4c86e963ff Mon Sep 17 00:00:00 2001 From: Thomas Girardier Date: Fri, 15 Apr 2022 22:21:39 +0000 Subject: - Update requirements - Add profile proxy base class - Handle error when no proxy is available for a profile Change-Id: Ib3ceb39cc1f1c171325ee05f004378aa4c2a97b8 --- mmi2grpc/__init__.py | 34 +++++++++++++++++++++++----------- mmi2grpc/_description.py | 25 ++++++++++++++++++++++--- mmi2grpc/_proxy.py | 12 ++++++++++++ mmi2grpc/a2dp.py | 30 +++++++++++++----------------- requirements.txt | 5 ++++- 5 files changed, 74 insertions(+), 32 deletions(-) create mode 100644 mmi2grpc/_proxy.py diff --git a/mmi2grpc/__init__.py b/mmi2grpc/__init__.py index 194676a..953d814 100644 --- a/mmi2grpc/__init__.py +++ b/mmi2grpc/__init__.py @@ -1,21 +1,19 @@ -# Copyright 2022 Google LLC - from typing import List import grpc import time import sys -import textwrap - -from .a2dp import A2DPProxy from blueberry.host_grpc import Host +from .a2dp import A2DPProxy +from ._description import format_proxy + GRPC_PORT = 8999 class IUT: - def __init__(self, test: str, args: List[str], - port: int = GRPC_PORT, **kwargs): + def __init__( + self, test: str, args: List[str], port: int = GRPC_PORT, **kwargs): self.a2dp_ = None self.address_ = None self.port = port @@ -32,11 +30,13 @@ class IUT: def address(self) -> bytes: with grpc.insecure_channel(f'localhost:{self.port}') as channel: try: - return Host(channel).ReadLocalAddress(wait_for_ready=True).address + return Host(channel).ReadLocalAddress( + wait_for_ready=True).address except grpc.RpcError: print('Retry') time.sleep(5) - return Host(channel).ReadLocalAddress(wait_for_ready=True).address + return Host(channel).ReadLocalAddress( + wait_for_ready=True).address def interact(self, pts_address: bytes, @@ -49,5 +49,17 @@ class IUT: print(f'{profile} mmi: {interaction}', file=sys.stderr) if profile in ('A2DP', 'AVDTP'): if not self.a2dp_: - self.a2dp_ = A2DPProxy(grpc.insecure_channel(f'localhost:{self.port}')) - return self.a2dp_.interact(interaction, test, description, pts_address) + self.a2dp_ = A2DPProxy( + grpc.insecure_channel(f'localhost:{self.port}')) + return self.a2dp_.interact( + interaction, test, description, pts_address) + + code = format_proxy(profile, interaction, description) + error_msg = ( + f'Missing {profile} proxy and mmi: {interaction}\n' + f'Create a {profile.lower()}.py in mmi2grpc/:\n\n{code}\n' + f'Then, instantiate the corresponding proxy in __init__.py\n' + f'Finally, create a {profile.lower()}.proto in proto/blueberry/' + f'and generate the corresponding interface.' + ) + assert False, error_msg diff --git a/mmi2grpc/_description.py b/mmi2grpc/_description.py index a6fa3dd..0a3c574 100644 --- a/mmi2grpc/_description.py +++ b/mmi2grpc/_description.py @@ -20,7 +20,8 @@ def assert_description(f): test = unittest.TestCase() test.maxDiff = None test.assertMultiLineEqual( - docstring.strip(), description.strip(), + docstring.strip(), + description.strip(), f'description does not match with function docstring of {f.__name__}') return f(*args, **kwargs) @@ -28,8 +29,8 @@ def assert_description(f): def format_function(id, description): - wrapped = textwrap.fill(description, COMMENT_WIDTH, - replace_whitespace=False) + wrapped = textwrap.fill( + description, COMMENT_WIDTH, replace_whitespace=False) return ( f'@assert_description\n' f'def {id}(self, **kwargs):\n' @@ -39,3 +40,21 @@ def format_function(id, description): f'\n' f' return "OK"\n' ) + + +def format_proxy(profile, id, description): + return ( + f'from ._description import assert_description\n' + f'from ._proxy import ProfileProxy\n' + f'\n' + f'from blueberry.{profile.lower()}_grpc import {profile}\n' + f'\n' + f'\n' + f'class {profile}Proxy(ProfileProxy):\n' + f'\n' + f' def __init__(self, channel):\n' + f' super().__init__()\n' + f' self.{profile.lower()} = {profile}(channel)\n' + f'\n' + f'{textwrap.indent(format_function(id, description), " ")}' + ) diff --git a/mmi2grpc/_proxy.py b/mmi2grpc/_proxy.py new file mode 100644 index 0000000..f5065a3 --- /dev/null +++ b/mmi2grpc/_proxy.py @@ -0,0 +1,12 @@ +from mmi2grpc._description import format_function + + +class ProfileProxy: + + def interact(self, id: str, test: str, description: str, pts_addr: bytes): + try: + return getattr(self, id)( + test=test, description=description, pts_addr=pts_addr) + except AttributeError: + code = format_function(id, description) + assert False, f'Unhandled mmi {id}\n{code}' diff --git a/mmi2grpc/a2dp.py b/mmi2grpc/a2dp.py index 6f3ba7c..34f187c 100644 --- a/mmi2grpc/a2dp.py +++ b/mmi2grpc/a2dp.py @@ -1,28 +1,27 @@ import time -import os -import textwrap from typing import Optional -import grpc - from blueberry.a2dp_grpc import A2DP from blueberry.host_grpc import Host from blueberry.a2dp_pb2 import Sink, Source, PlaybackAudioRequest from blueberry.host_pb2 import Connection -from ._description import assert_description, format_function from ._audio import AudioSignal +from ._description import assert_description +from ._proxy import ProfileProxy AUDIO_AMPLITUDE = 0.8 -class A2DPProxy: +class A2DPProxy(ProfileProxy): connection: Optional[Connection] = None sink: Optional[Sink] = None source: Optional[Source] = None def __init__(self, channel): + super().__init__() + self.host = Host(channel) self.a2dp = A2DP(channel) @@ -34,15 +33,9 @@ class A2DPProxy: 44100 ) - def interact(self, id: str, test: str, description: str, pts_addr: bytes): - try: - return getattr(self, id)(test=test, description=description, pts_addr=pts_addr) - except AttributeError: - code = format_function(id, description) - assert False, f'Unhandled mmi {id}\n{code}' - @assert_description - def TSC_AVDTP_mmi_iut_accept_connect(self, test: str, pts_addr: bytes, **kwargs): + def TSC_AVDTP_mmi_iut_accept_connect( + self, test: str, pts_addr: bytes, **kwargs): """ If necessary, take action to accept the AVDTP Signaling Channel Connection initiated by the tester. @@ -137,7 +130,8 @@ class A2DPProxy: return "OK" @assert_description - def TSC_AVDTP_mmi_iut_initiate_out_of_range(self, pts_addr: bytes, **kwargs): + def TSC_AVDTP_mmi_iut_initiate_out_of_range( + self, pts_addr: bytes, **kwargs): """ Move the IUT out of range to create a link loss scenario. @@ -165,8 +159,10 @@ class A2DPProxy: if test == "AVDTP/SRC/ACP/SIG/SMG/BI-29-C": time.sleep(2) # TODO: Remove, AVRCP SegFault - if test in ("A2DP/SRC/CC/BV-09-I", "A2DP/SRC/SET/BV-04-I", - "AVDTP/SRC/ACP/SIG/SMG/BV-18-C", "AVDTP/SRC/ACP/SIG/SMG/BV-20-C", + if test in ("A2DP/SRC/CC/BV-09-I", + "A2DP/SRC/SET/BV-04-I", + "AVDTP/SRC/ACP/SIG/SMG/BV-18-C", + "AVDTP/SRC/ACP/SIG/SMG/BV-20-C", "AVDTP/SRC/ACP/SIG/SMG/BV-22-C"): time.sleep(1) # TODO: Remove, AVRCP SegFault if test == "A2DP/SRC/SUS/BV-01-I": diff --git a/requirements.txt b/requirements.txt index 31854ce..7b45d0f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,6 @@ -protobuf==3.18.1 grpcio==1.41.0 grpcio-tools==1.41.0 +numpy==1.22.3 +protobuf==3.18.1 +scipy==1.8.0 +six==1.16.0 -- cgit v1.2.3 From 035e00aa0480de48d7bc21e5580c9da1763cfeba Mon Sep 17 00:00:00 2001 From: David Duarte Date: Tue, 19 Apr 2022 14:35:40 +0000 Subject: Implement a better retry for ReadLocalAddress Change-Id: I5d55ce4b04300850e48ba284a147e76aa4a21c44 --- mmi2grpc/__init__.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/mmi2grpc/__init__.py b/mmi2grpc/__init__.py index 953d814..d710702 100644 --- a/mmi2grpc/__init__.py +++ b/mmi2grpc/__init__.py @@ -9,6 +9,7 @@ from .a2dp import A2DPProxy from ._description import format_proxy GRPC_PORT = 8999 +MAX_RETRIES = 10 class IUT: @@ -29,14 +30,16 @@ class IUT: @property def address(self) -> bytes: with grpc.insecure_channel(f'localhost:{self.port}') as channel: - try: - return Host(channel).ReadLocalAddress( - wait_for_ready=True).address - except grpc.RpcError: - print('Retry') - time.sleep(5) - return Host(channel).ReadLocalAddress( - wait_for_ready=True).address + tries = 0 + while True: + try: + return Host(channel).ReadLocalAddress(wait_for_ready=True).address + except grpc.RpcError: + if tries >= MAX_RETRIES: + raise + else: + print('Retry', tries, 'of', MAX_RETRIES) + time.sleep(1) def interact(self, pts_address: bytes, -- cgit v1.2.3 From 62dec0f0e53869a011b1064df92b29965f04782b Mon Sep 17 00:00:00 2001 From: Charlie Boutier Date: Mon, 25 Apr 2022 08:18:13 +0000 Subject: Pandora: Rename Blueberry to Pandora Add bt-test-interfaces as submodules. Change-Id: I80454669d4cdd722d5faa65792ae3a36c15a289b --- .gitignore | 5 +- .gitmodules | 3 + blueberry/__init__.py | 0 mmi2grpc/__init__.py | 4 +- mmi2grpc/_description.py | 2 +- mmi2grpc/a2dp.py | 8 +- pandora/__init__.py | 0 proto | 1 + proto/blueberry/a2dp.proto | 237 --------------------------------------------- proto/blueberry/host.proto | 101 ------------------- setup.py | 4 +- 11 files changed, 15 insertions(+), 350 deletions(-) create mode 100644 .gitmodules delete mode 100644 blueberry/__init__.py create mode 100644 pandora/__init__.py create mode 160000 proto delete mode 100644 proto/blueberry/a2dp.proto delete mode 100644 proto/blueberry/host.proto diff --git a/.gitignore b/.gitignore index 14ca2c8..54b52ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ -virtualenv out/ build __pycache__ -blueberry/* -!blueberry/__init__.py +pandora/* +!pandora/__init__.py .eggs/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f054688 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "bt-test-interfaces"] + path = proto + url = sso://pandora/bt-test-interfaces diff --git a/blueberry/__init__.py b/blueberry/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/mmi2grpc/__init__.py b/mmi2grpc/__init__.py index d710702..e127348 100644 --- a/mmi2grpc/__init__.py +++ b/mmi2grpc/__init__.py @@ -3,7 +3,7 @@ import grpc import time import sys -from blueberry.host_grpc import Host +from pandora.host_grpc import Host from .a2dp import A2DPProxy from ._description import format_proxy @@ -62,7 +62,7 @@ class IUT: f'Missing {profile} proxy and mmi: {interaction}\n' f'Create a {profile.lower()}.py in mmi2grpc/:\n\n{code}\n' f'Then, instantiate the corresponding proxy in __init__.py\n' - f'Finally, create a {profile.lower()}.proto in proto/blueberry/' + f'Finally, create a {profile.lower()}.proto in proto/pandora/' f'and generate the corresponding interface.' ) assert False, error_msg diff --git a/mmi2grpc/_description.py b/mmi2grpc/_description.py index 0a3c574..c292720 100644 --- a/mmi2grpc/_description.py +++ b/mmi2grpc/_description.py @@ -47,7 +47,7 @@ def format_proxy(profile, id, description): f'from ._description import assert_description\n' f'from ._proxy import ProfileProxy\n' f'\n' - f'from blueberry.{profile.lower()}_grpc import {profile}\n' + f'from pandora.{profile.lower()}_grpc import {profile}\n' f'\n' f'\n' f'class {profile}Proxy(ProfileProxy):\n' diff --git a/mmi2grpc/a2dp.py b/mmi2grpc/a2dp.py index 34f187c..7e51c68 100644 --- a/mmi2grpc/a2dp.py +++ b/mmi2grpc/a2dp.py @@ -1,11 +1,11 @@ import time from typing import Optional -from blueberry.a2dp_grpc import A2DP -from blueberry.host_grpc import Host +from pandora.a2dp_grpc import A2DP +from pandora.host_grpc import Host -from blueberry.a2dp_pb2 import Sink, Source, PlaybackAudioRequest -from blueberry.host_pb2 import Connection +from pandora.a2dp_pb2 import Sink, Source, PlaybackAudioRequest +from pandora.host_pb2 import Connection from ._audio import AudioSignal from ._description import assert_description diff --git a/pandora/__init__.py b/pandora/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/proto b/proto new file mode 160000 index 0000000..05cd39c --- /dev/null +++ b/proto @@ -0,0 +1 @@ +Subproject commit 05cd39cf98b3fdc14699316c69cdaf8e496ee066 diff --git a/proto/blueberry/a2dp.proto b/proto/blueberry/a2dp.proto deleted file mode 100644 index a5e1b1a..0000000 --- a/proto/blueberry/a2dp.proto +++ /dev/null @@ -1,237 +0,0 @@ -syntax = "proto3"; - -package blueberry; - -import "blueberry/host.proto"; -import "google/protobuf/wrappers.proto"; - -// Service to trigger A2DP (Advanced Audio Distribution Profile) procedures. -// -// Requirement for the implementor: -// - Streams must not be automaticaly opened, even if discovered. -// - The `Host` service should be implemented -// -// References: -// - [A2DP] Bluetooth SIG, Specification of the Bluetooth System, -// Advanced Audio Distribution, Version 1.3 or Later -// - [AVDTP] Bluetooth SIG, Specification of the Bluetooth System, -// Audio/Video Distribution Transport Protocol, Version 1.3 or Later -service A2DP { - // Open a stream from a local **Source** endpoint to a remote **Sink** - // endpoint. - // - // The returned source should be in the AVDTP_OPEN state (see [AVDTP] 9.1). - // The function must block until the stream has reached this state - // - // A cancellation of this call must result in aborting the current - // AVDTP procedure (see [AVDTP] 9.9) - rpc OpenSource(OpenSourceRequest) returns (OpenSourceResponse); - // Open a stream from a local **Sink** endpoint to a remote **Source** - // endpoint. - // - // The returned sink must be in the AVDTP_OPEN state (see [AVDTP] 9.1). - // The function must block until the stream has reached this state - // - // A cancellation of this call must result in aborting the current - // AVDTP procedure (see [AVDTP] 9.9) - rpc OpenSink(OpenSinkRequest) returns (OpenSinkResponse); - // Wait for a stream from a local **Source** endpoint to - // a remote **Sink** endpoint to open. - // - // If the peer has opened a source prior to this call, the server will - // return it. The server must return the same source only once. - rpc WaitSource(WaitSourceRequest) returns (WaitSourceResponse); - // Wait for a stream from a local **Sink** endpoint to - // a remote **Source** endpoint to open. - // - // If the peer has opened a sink prior to this call, the server will - // return it. The server must return the same sink only once. - rpc WaitSink(WaitSinkRequest) returns (WaitSinkResponse); - // Get if the stream is suspended - rpc IsSuspended(IsSuspendedRequest) returns (google.protobuf.BoolValue); - // Start a suspended stream. - rpc Start(StartRequest) returns (StartResponse); - // Suspend a started stream. - rpc Suspend(SuspendRequest) returns (SuspendResponse); - // Close a stream, the source or sink tokens must not be reused afterwards. - rpc Close(CloseRequest) returns (CloseResponse); - // Get the `AudioEncoding` value of a stream - rpc GetAudioEncoding(GetAudioEncodingRequest) returns (GetAudioEncodingResponse); - // Playback audio by a `Source` - rpc PlaybackAudio(stream PlaybackAudioRequest) returns (PlaybackAudioResponse); - // Capture audio from a `Sink` - rpc CaptureAudio(CaptureAudioRequest)returns (stream CaptureAudioResponse); -} - -// Audio encoding formats. -enum AudioEncoding { - // Interleaved stereo frames with 16-bit signed little-endian linear PCM - // samples at 44100Hz sample rate - PCM_S16_LE_44K1_STEREO = 0; - // Interleaved stereo frames with 16-bit signed little-endian linear PCM - // samples at 48000Hz sample rate - PCM_S16_LE_48K_STEREO = 1; -} - -// A Token representing a Source stream (see [A2DP] 2.2). -// It's acquired via an OpenSource on the A2DP service. -message Source { - // Opaque value filled by the GRPC server, must not - // be modified nor crafted. - bytes cookie = 1; -} - -// A Token representing a Sink stream (see [A2DP] 2.2). -// It's acquired via an OpenSink on the A2DP service. -message Sink { - // Opaque value filled by the GRPC server, must not - // be modified nor crafted. - bytes cookie = 1; -} - -// Request for the `OpenSource` method. -message OpenSourceRequest { - // The connection that will open the stream. - Connection connection = 1; -} - -// Response for the `OpenSource` method. -message OpenSourceResponse { - // Result of the `OpenSource` call: - // - If successfull: a Source - oneof result { - Source source = 1; - } -} - -// Request for the `OpenSink` method. -message OpenSinkRequest { - // The connection that will open the stream. - Connection connection = 1; -} - -// Response for the `OpenSink` method. -message OpenSinkResponse { - // Result of the `OpenSink` call: - // - If successfull: a Sink - oneof result { - Sink sink = 1; - } -} - -// Request for the `WaitSource` method. -message WaitSourceRequest { - // The connection that is awaiting the stream. - Connection connection = 1; -} - -// Response for the `WaitSource` method. -message WaitSourceResponse { - // Result of the `WaitSource` call: - // - If successfull: a Source - oneof result { - Source source = 1; - } -} - -// Request for the `WaitSink` method. -message WaitSinkRequest { - // The connection that is awaiting the stream. - Connection connection = 1; -} - -// Response for the `WaitSink` method. -message WaitSinkResponse { - // Result of the `WaitSink` call: - // - If successfull: a Sink - oneof result { - Sink sink = 1; - } -} - -// Request for the `IsSuspended` method. -message IsSuspendedRequest { - // The stream on which the function will check if it's suspended - oneof target { - Sink sink = 1; - Source source = 2; - } -} - -// Request for the `Start` method. -message StartRequest { - // Target of the start, either a Sink or a Source. - oneof target { - Sink sink = 1; - Source source = 2; - } -} - -// Response for the `Start` method. -message StartResponse {} - -// Request for the `Suspend` method. -message SuspendRequest { - // Target of the suspend, either a Sink or a Source. - oneof target { - Sink sink = 1; - Source source = 2; - } -} - -// Response for the `Suspend` method. -message SuspendResponse {} - -// Request for the `Close` method. -message CloseRequest { - // Target of the close, either a Sink or a Source. - oneof target { - Sink sink = 1; - Source source = 2; - } -} - -// Response for the `Close` method. -message CloseResponse {} - -// Request for the `GetAudioEncoding` method. -message GetAudioEncodingRequest { - // The stream on which the function will read the `AudioEncoding`. - oneof target { - Sink sink = 1; - Source source = 2; - } -} - -// Response for the `GetAudioEncoding` method. -message GetAudioEncodingResponse { - // Audio encoding of the stream. - AudioEncoding encoding = 1; -} - -// Request for the `PlaybackAudio` method. -message PlaybackAudioRequest { - // Source that will playback audio. - Source source = 1; - // Audio data to playback. - // The audio data must be encoded in the specified `AudioEncoding` value - // obtained in response of a `GetAudioEncoding` method call. - bytes data = 2; -} - -// Response for the `PlaybackAudio` method. -message PlaybackAudioResponse {} - -// Request for the `CaptureAudio` method. -message CaptureAudioRequest { - // Sink that will capture audio - Sink sink = 1; -} - -// Response for the `CaptureAudio` method. -message CaptureAudioResponse { - // Captured audio data. - // The audio data is encoded in the specified `AudioEncoding` value - // obained in response of a `GetAudioEncoding` method call. - bytes data = 1; -} diff --git a/proto/blueberry/host.proto b/proto/blueberry/host.proto deleted file mode 100644 index bf80ab9..0000000 --- a/proto/blueberry/host.proto +++ /dev/null @@ -1,101 +0,0 @@ -syntax = "proto3"; - -package blueberry; - -import "google/protobuf/empty.proto"; - -// Service to trigger Bluetooth Host procedures -// -// At startup, the Host must be in BR/EDR connectable mode -// (see GAP connectability modes) -service Host { - // Reset the host. - // **After** responding to this command, the GRPC server should loose - // all its state. - // This is comparable to a process restart or an hardware reset. - // The GRPC server might take some time to be available after - // this command. - rpc Reset(google.protobuf.Empty) returns (google.protobuf.Empty); - // Create an ACL BR/EDR connection to a peer. - // This should send a CreateConnection on the HCI level. - // If the two devices have not established a previous bond, - // the peer must be discoverable. - rpc Connect(ConnectRequest) returns (ConnectResponse); - // Get an active ACL BR/EDR connection to a peer. - rpc GetConnection(GetConnectionRequest) returns (GetConnectionResponse); - // Wait for an ACL BR/EDR connection from a peer. - rpc WaitConnection(WaitConnectionRequest) returns (WaitConnectionResponse); - // Disconnect an ACL BR/EDR connection. The Connection must not be reused afterwards. - rpc Disconnect(DisconnectRequest) returns (DisconnectResponse); - // Read the local Bluetooth device address. - // This should return the same value as a Read BD_ADDR HCI command. - rpc ReadLocalAddress(google.protobuf.Empty) returns (ReadLocalAddressResponse); -} - -// A Token representing an ACL connection. -// It's acquired via a Connect on the Host service. -message Connection { - // Opaque value filled by the GRPC server, must not - // be modified nor crafted. - bytes cookie = 1; -} - -// Request of the `Connect` method. -message ConnectRequest { - // Peer Bluetooth Device Address as array of 6 bytes. - bytes address = 1; -} - -// Response of the `Connect` method. -message ConnectResponse { - // Result of the `Connect` call: - // - If successfull: a Connection - oneof result { - Connection connection = 1; - } -} - -// Request of the `GetConnection` method. -message GetConnectionRequest { - // Peer Bluetooth Device Address as array of 6 bytes. - bytes address = 1; -} - -// Response of the `GetConnection` method. -message GetConnectionResponse { - // Result of the `GetConnection` call: - // - If successfull: a Connection - oneof result { - Connection connection = 1; - } -} - -// Request of the `WaitConnection` method. -message WaitConnectionRequest { - // Peer Bluetooth Device Address as array of 6 bytes. - bytes address = 1; -} - -// Response of the `WaitConnection` method. -message WaitConnectionResponse { - // Result of the `WaitConnection` call: - // - If successfull: a Connection - oneof result { - Connection connection = 1; - } -} - -// Request of the `Disconnect` method. -message DisconnectRequest { - // Connection that should be disconnected. - Connection connection = 1; -} - -// Response of the `Disconnect` method. -message DisconnectResponse {} - -// Response of the `ReadLocalAddress` method. -message ReadLocalAddressResponse { - // Local Bluetooth Device Address as array of 6 bytes. - bytes address = 1; -} diff --git a/setup.py b/setup.py index a01b877..22f6e9f 100755 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ class BuildGrpc(Command): proto_include = pkg_resources.resource_filename('grpc_tools', '_proto') - files = [f'blueberry/{f}' for f in os.listdir('proto/blueberry') if f.endswith('.proto')] + files = [f'pandora/{f}' for f in os.listdir('proto/pandora') if f.endswith('.proto')] protoc.main([ 'grpc_tools.protoc', '-Iproto', @@ -46,7 +46,7 @@ class BuildPyCommand(build_py): setup( name='mmi2grpc', version='0.0.1', - packages=['mmi2grpc', 'blueberry'], + packages=['mmi2grpc', 'pandora'], install_requires=[ 'grpcio', ], -- cgit v1.2.3 From 4641dc0df37d0edc9a30fadeaa51c29764212362 Mon Sep 17 00:00:00 2001 From: Thomas Girardier Date: Tue, 26 Apr 2022 16:23:35 -0700 Subject: mmi2grpc: prepares for open-source - Adds license file and headers. - Adds contributing guidelines. - Corrects linter errors. - Updates bt-test-interfaces submodule. Change-Id: I4ec64b0572197046bc966fe239ec5b91b643bf39 --- .gitignore | 1 - CONTRIBUTING.md | 30 +++++++ LICENSE | 202 +++++++++++++++++++++++++++++++++++++++++++++++ README.md | 7 +- mmi2grpc/__init__.py | 79 ++++++++++++++---- mmi2grpc/_audio.py | 60 ++++++++++---- mmi2grpc/_description.py | 60 -------------- mmi2grpc/_helpers.py | 94 ++++++++++++++++++++++ mmi2grpc/_proxy.py | 40 ++++++++-- mmi2grpc/a2dp.py | 48 ++++++++--- proto | 2 +- protoc-gen-custom_grpc | 27 ++++++- setup.py | 22 +++++- 13 files changed, 554 insertions(+), 118 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE delete mode 100644 mmi2grpc/_description.py create mode 100644 mmi2grpc/_helpers.py diff --git a/.gitignore b/.gitignore index 54b52ce..5c29283 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -out/ build __pycache__ pandora/* diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..97c24f3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,30 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. There are +just a few small guidelines you need to follow. + +## Contributor License Agreement + +Contributions to this project must be accompanied by a Contributor License +Agreement. You (or your employer) retain the copyright to your contribution; +this simply gives us permission to use and redistribute your contributions as +part of the project. Head over to to see +your current agreements on file or to sign a new one. + +You generally only need to submit a CLA once, so if you've already submitted one +(even if it was for a different project), you probably don't need to do it +again. + +## Style Guide + +Every contributions must follow [Google Python style guide]( +https://google.github.io/styleguide/pyguide.html). + +## Code Reviews + +All submissions, including submissions by project members, require review. + +## Community Guidelines + +This project follows [Google's Open Source Community +Guidelines](https://opensource.google/conduct/). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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 + + http://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. diff --git a/README.md b/README.md index 298b0d2..3a2ac32 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,13 @@ # mmi2grpc +## Install + +```bash +pip3 install -r requirements.txt +``` + ## Build grpc interfaces ```bash ./setup.py build_grpc ``` - diff --git a/mmi2grpc/__init__.py b/mmi2grpc/__init__.py index e127348..a2b6530 100644 --- a/mmi2grpc/__init__.py +++ b/mmi2grpc/__init__.py @@ -1,39 +1,73 @@ +# Copyright 2022 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. + +"""Entry point to mmi2grpc.""" + from typing import List -import grpc import time import sys -from pandora.host_grpc import Host +import grpc -from .a2dp import A2DPProxy -from ._description import format_proxy +from mmi2grpc.a2dp import A2DPProxy +from mmi2grpc._helpers import format_proxy +from pandora.host_grpc import Host GRPC_PORT = 8999 MAX_RETRIES = 10 class IUT: + """IUT class. + + Handles MMI calls from the PTS and routes them to corresponding profile + proxy which translates MMI calls to gRPC calls to the IUT. + """ def __init__( self, test: str, args: List[str], port: int = GRPC_PORT, **kwargs): - self.a2dp_ = None - self.address_ = None + """Init IUT class for a given test. + + Args: + test: PTS test id. + args: test arguments. + port: gRPC port exposed by the IUT test server. + """ self.port = port self.test = test + # Profile proxies. + self._a2dp = None + def __enter__(self): + """Resets the IUT when starting a PTS test.""" + # Note: we don't keep a single gRPC channel instance in the IUT class + # because reset is allowed to close the gRPC server. with grpc.insecure_channel(f'localhost:{self.port}') as channel: Host(channel).Reset(wait_for_ready=True) - def __exit__(self): - self.a2dp_ = None + def __exit__(self, exc_type, exc_value, exc_traceback): + self._a2dp = None @property def address(self) -> bytes: + """Bluetooth MAC address of the IUT.""" with grpc.insecure_channel(f'localhost:{self.port}') as channel: tries = 0 while True: try: - return Host(channel).ReadLocalAddress(wait_for_ready=True).address + return Host(channel).ReadLocalAddress( + wait_for_ready=True).address except grpc.RpcError: if tries >= MAX_RETRIES: raise @@ -49,20 +83,33 @@ class IUT: description: str, style: str, **kwargs) -> str: - print(f'{profile} mmi: {interaction}', file=sys.stderr) + """Routes MMI calls to corresponding profile proxy. + + Args: + pts_address: Bluetooth MAC addres of the PTS in bytes. + profile: Bluetooth profile. + test: PTS test id. + interaction: MMI name. + description: MMI description. + style: MMI popup style, unused for now. + """ + print(f'{profile} mmi: {description}', file=sys.stderr) + + # Handles A2DP and AVDTP MMIs. if profile in ('A2DP', 'AVDTP'): - if not self.a2dp_: - self.a2dp_ = A2DPProxy( + if not self._a2dp: + self._a2dp = A2DPProxy( grpc.insecure_channel(f'localhost:{self.port}')) - return self.a2dp_.interact( - interaction, test, description, pts_address) + return self._a2dp.interact( + test, interaction, description, pts_address) + # Handles unsupported profiles. code = format_proxy(profile, interaction, description) error_msg = ( f'Missing {profile} proxy and mmi: {interaction}\n' f'Create a {profile.lower()}.py in mmi2grpc/:\n\n{code}\n' f'Then, instantiate the corresponding proxy in __init__.py\n' f'Finally, create a {profile.lower()}.proto in proto/pandora/' - f'and generate the corresponding interface.' - ) + f'and generate the corresponding interface.') + assert False, error_msg diff --git a/mmi2grpc/_audio.py b/mmi2grpc/_audio.py index 92e06df..8e83c67 100644 --- a/mmi2grpc/_audio.py +++ b/mmi2grpc/_audio.py @@ -1,3 +1,19 @@ +# Copyright 2022 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. + +"""Audio tools.""" + import itertools import math import os @@ -6,11 +22,18 @@ from threading import Thread import numpy as np from scipy.io import wavfile +SINE_FREQUENCY = 440 +SINE_DURATION = 0.1 -def _fixup_wav_header(path): - WAV_RIFF_SIZE_OFFSET = 4 - WAV_DATA_SIZE_OFFSET = 40 +# File which stores the audio signal output data (after transport). +# Used for running comparisons with the generated audio signal. +OUTPUT_WAV_FILE = '/tmp/audiodata' +WAV_RIFF_SIZE_OFFSET = 4 +WAV_DATA_SIZE_OFFSET = 40 + + +def _fixup_wav_header(path): with open(path, 'r+b') as f: f.seek(0, os.SEEK_END) file_size = f.tell() @@ -20,31 +43,35 @@ def _fixup_wav_header(path): f.write(size.to_bytes(4, byteorder='little')) -SINE_FREQUENCY = 440 -SINE_DURATION = 0.1 - -WAV_FILE = "/tmp/audiodata" - - class AudioSignal: + """Audio signal generator and verifier.""" + def __init__(self, transport, amplitude, fs): + """Init AudioSignal class. + + Args: + transport: function to send the generated audio data to. + amplitude: amplitude of the signal to generate. + fs: sampling rate of the signal to generate. + """ self.transport = transport self.amplitude = amplitude self.fs = fs self.thread = None def start(self): + """Generates the audio signal and send it to the transport.""" self.thread = Thread(target=self._run) self.thread.start() def _run(self): sine = self._generate_sine(SINE_FREQUENCY, SINE_DURATION) - # Interleaved audio + # Interleaved audio. stereo = np.zeros(sine.size * 2, dtype=sine.dtype) stereo[0::2] = sine - # Send 4 second of audio + # Send 4 second of audio. audio = itertools.repeat(stereo.tobytes(), int(4 / SINE_DURATION)) self.transport(audio) @@ -52,20 +79,21 @@ class AudioSignal: def _generate_sine(self, f, duration): sine = self.amplitude * \ np.sin(2 * np.pi * np.arange(self.fs * duration) * (f / self.fs)) - s16le = (sine * 32767).astype(" Date: Wed, 27 Apr 2022 13:53:49 +0000 Subject: Update bt-test-interfaces submodule Change-Id: Ic6557df7497046d2e48b53d18208240934ccedd5 --- proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto b/proto index 413cc97..5c9f411 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 413cc97ae077373e45b6d3f057f6113e16d03c2b +Subproject commit 5c9f411d1eefac171b76051b18bd0b0435c7790b -- cgit v1.2.3 From 72517ebefc3faf13f20be8c6cd5f3fbf0fcaa90a Mon Sep 17 00:00:00 2001 From: David Duarte Date: Wed, 27 Apr 2022 14:15:16 +0000 Subject: Replace setup.py by a pyproject.toml setup Change-Id: Id2ab8bd785f92dab516f81c3f6532f41b5036c47 --- .gitignore | 2 +- README.md | 10 ++-- _build/__init__.py | 0 _build/backend.py | 47 ++++++++++++++++++ _build/grpc.py | 44 +++++++++++++++++ _build/protoc-gen-custom_grpc | 110 ++++++++++++++++++++++++++++++++++++++++++ mmi2grpc/__init__.py | 4 +- protoc-gen-custom_grpc | 110 ------------------------------------------ pyproject.toml | 14 ++++++ requirements.txt | 6 --- setup.py | 78 ------------------------------ 11 files changed, 226 insertions(+), 199 deletions(-) create mode 100644 _build/__init__.py create mode 100644 _build/backend.py create mode 100755 _build/grpc.py create mode 100755 _build/protoc-gen-custom_grpc delete mode 100755 protoc-gen-custom_grpc create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100755 setup.py diff --git a/.gitignore b/.gitignore index 5c29283..4652040 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -build +dist __pycache__ pandora/* !pandora/__init__.py diff --git a/README.md b/README.md index 3a2ac32..e9233cc 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,15 @@ ## Install ```bash -pip3 install -r requirements.txt +git submodule update --init + +pip install -e . # With editable mode +# Or +pip install . # Without editable mode ``` -## Build grpc interfaces +## Rebuild gRPC interfaces ```bash -./setup.py build_grpc +./_build/grpc.py ``` diff --git a/_build/__init__.py b/_build/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/_build/backend.py b/_build/backend.py new file mode 100644 index 0000000..f25546b --- /dev/null +++ b/_build/backend.py @@ -0,0 +1,47 @@ +# Copyright 2022 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. + +"""PEP517 build backend.""" + +from .grpc import build as build_pandora_grpc + +from flit_core.wheel import WheelBuilder +# Use all build hooks from flit +from flit_core.buildapi import * + + +# Build grpc interfaces when this build backend is invoked +build_pandora_grpc() + +# flit only supports copying one module, but we need to copy two of them +# because protobuf forces the use of absolute imports. +# So Monkey patches WheelBuilder#copy_module to copy pandora folder too. +# To avoid breaking this, the version of flit_core is pinned in pyproject.toml. +old_copy_module = WheelBuilder.copy_module + + +def copy_module(self): + from flit_core.common import Module + + old_copy_module(self) + + module = self.module + + self.module = Module('pandora', self.directory) + old_copy_module(self) + + self.module = module + + +WheelBuilder.copy_module = copy_module diff --git a/_build/grpc.py b/_build/grpc.py new file mode 100755 index 0000000..ae020a2 --- /dev/null +++ b/_build/grpc.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 + +# Copyright 2022 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. + +"""Build gRPC pandora interfaces.""" + +import os +import pkg_resources +from grpc_tools import protoc + +package_directory = os.path.dirname(os.path.realpath(__file__)) + + +def build(): + + os.environ['PATH'] = package_directory + ':' + os.environ['PATH'] + + proto_include = pkg_resources.resource_filename('grpc_tools', '_proto') + + files = [ + f'pandora/{f}' for f in os.listdir('proto/pandora') if f.endswith('.proto')] + protoc.main([ + 'grpc_tools.protoc', + '-Iproto', + f'-I{proto_include}', + '--python_out=.', + '--custom_grpc_out=.', + ] + files) + + +if __name__ == '__main__': + build() diff --git a/_build/protoc-gen-custom_grpc b/_build/protoc-gen-custom_grpc new file mode 100755 index 0000000..00e47a5 --- /dev/null +++ b/_build/protoc-gen-custom_grpc @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 + +# Copyright 2022 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. + +"""Custom mmi2grpc gRPC compiler.""" + +import sys + +from google.protobuf.compiler.plugin_pb2 import CodeGeneratorRequest, \ + CodeGeneratorResponse + + +def eprint(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) + + +request = CodeGeneratorRequest.FromString(sys.stdin.buffer.read()) + + +def has_type(proto_file, type_name): + return any(filter(lambda x: x.name == type_name, proto_file.message_type)) + + +def import_type(imports, type): + package = type[1:type.rindex('.')] + type_name = type[type.rindex('.')+1:] + file = next(filter( + lambda x: x.package == package and has_type(x, type_name), + request.proto_file)) + python_path = file.name.replace('.proto', '').replace('/', '.') + as_name = python_path.replace('.', '_dot_') + '__pb2' + module_path = python_path[:python_path.rindex('.')] + module_name = python_path[python_path.rindex('.')+1:] + '_pb2' + imports.add(f'from {module_path} import {module_name} as {as_name}') + return f'{as_name}.{type_name}' + + +def generate_method(imports, file, service, method): + input_mode = 'stream' if method.client_streaming else 'unary' + output_mode = 'stream' if method.server_streaming else 'unary' + + input_type = import_type(imports, method.input_type) + output_type = import_type(imports, method.output_type) + + if input_mode == 'stream': + return ( + f'def {method.name}(self, iterator, **kwargs):\n' + f' return self.channel.{input_mode}_{output_mode}(\n' + f" '/{file.package}.{service.name}/{method.name}',\n" + f' request_serializer={input_type}.SerializeToString,\n' + f' response_deserializer={output_type}.FromString\n' + f' )(iterator, **kwargs)' + ).split('\n') + else: + return ( + f'def {method.name}(self, wait_for_ready=None, **kwargs):\n' + f' return self.channel.{input_mode}_{output_mode}(\n' + f" '/{file.package}.{service.name}/{method.name}',\n" + f' request_serializer={input_type}.SerializeToString,\n' + f' response_deserializer={output_type}.FromString\n' + f' )({input_type}(**kwargs), wait_for_ready=wait_for_ready)' + ).split('\n') + + +def generate_service(imports, file, service): + methods = '\n\n '.join([ + '\n '.join( + generate_method(imports, file, service, method) + ) for method in service.method + ]) + return ( + f'class {service.name}:\n' + f' def __init__(self, channel):\n' + f' self.channel = channel\n' + f'\n' + f' {methods}\n' + ).split('\n') + + +files = [] + +for file_name in request.file_to_generate: + file = next(filter(lambda x: x.name == file_name, request.proto_file)) + + imports = set([]) + + services = '\n'.join(sum([ + generate_service(imports, file, service) for service in file.service + ], [])) + + files.append(CodeGeneratorResponse.File( + name=file_name.replace('.proto', '_grpc.py'), + content='\n'.join(imports) + '\n\n' + services + )) + +reponse = CodeGeneratorResponse(file=files) + +sys.stdout.buffer.write(reponse.SerializeToString()) diff --git a/mmi2grpc/__init__.py b/mmi2grpc/__init__.py index a2b6530..2fd8603 100644 --- a/mmi2grpc/__init__.py +++ b/mmi2grpc/__init__.py @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Entry point to mmi2grpc.""" +"""Map Bluetooth PTS Man Machine Interface to Pandora gRPC calls.""" + +__version__ = "0.0.1" from typing import List import time diff --git a/protoc-gen-custom_grpc b/protoc-gen-custom_grpc deleted file mode 100755 index 00e47a5..0000000 --- a/protoc-gen-custom_grpc +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright 2022 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. - -"""Custom mmi2grpc gRPC compiler.""" - -import sys - -from google.protobuf.compiler.plugin_pb2 import CodeGeneratorRequest, \ - CodeGeneratorResponse - - -def eprint(*args, **kwargs): - print(*args, file=sys.stderr, **kwargs) - - -request = CodeGeneratorRequest.FromString(sys.stdin.buffer.read()) - - -def has_type(proto_file, type_name): - return any(filter(lambda x: x.name == type_name, proto_file.message_type)) - - -def import_type(imports, type): - package = type[1:type.rindex('.')] - type_name = type[type.rindex('.')+1:] - file = next(filter( - lambda x: x.package == package and has_type(x, type_name), - request.proto_file)) - python_path = file.name.replace('.proto', '').replace('/', '.') - as_name = python_path.replace('.', '_dot_') + '__pb2' - module_path = python_path[:python_path.rindex('.')] - module_name = python_path[python_path.rindex('.')+1:] + '_pb2' - imports.add(f'from {module_path} import {module_name} as {as_name}') - return f'{as_name}.{type_name}' - - -def generate_method(imports, file, service, method): - input_mode = 'stream' if method.client_streaming else 'unary' - output_mode = 'stream' if method.server_streaming else 'unary' - - input_type = import_type(imports, method.input_type) - output_type = import_type(imports, method.output_type) - - if input_mode == 'stream': - return ( - f'def {method.name}(self, iterator, **kwargs):\n' - f' return self.channel.{input_mode}_{output_mode}(\n' - f" '/{file.package}.{service.name}/{method.name}',\n" - f' request_serializer={input_type}.SerializeToString,\n' - f' response_deserializer={output_type}.FromString\n' - f' )(iterator, **kwargs)' - ).split('\n') - else: - return ( - f'def {method.name}(self, wait_for_ready=None, **kwargs):\n' - f' return self.channel.{input_mode}_{output_mode}(\n' - f" '/{file.package}.{service.name}/{method.name}',\n" - f' request_serializer={input_type}.SerializeToString,\n' - f' response_deserializer={output_type}.FromString\n' - f' )({input_type}(**kwargs), wait_for_ready=wait_for_ready)' - ).split('\n') - - -def generate_service(imports, file, service): - methods = '\n\n '.join([ - '\n '.join( - generate_method(imports, file, service, method) - ) for method in service.method - ]) - return ( - f'class {service.name}:\n' - f' def __init__(self, channel):\n' - f' self.channel = channel\n' - f'\n' - f' {methods}\n' - ).split('\n') - - -files = [] - -for file_name in request.file_to_generate: - file = next(filter(lambda x: x.name == file_name, request.proto_file)) - - imports = set([]) - - services = '\n'.join(sum([ - generate_service(imports, file, service) for service in file.service - ], [])) - - files.append(CodeGeneratorResponse.File( - name=file_name.replace('.proto', '_grpc.py'), - content='\n'.join(imports) + '\n\n' + services - )) - -reponse = CodeGeneratorResponse(file=files) - -sys.stdout.buffer.write(reponse.SerializeToString()) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6923987 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[project] +name = "mmi2grpc" +authors = [{name = "Pandora", email = "pandora-core@google.com"}] +readme = "README.md" +dynamic = ["version", "description"] +dependencies = ["grpcio >=1.41", "numpy >=1.22", "scipy >= 1.8"] + +[tool.flit.sdist] +include = ["_build", "proto", "pandora"] + +[build-system] +requires = ["flit_core==3.7.1", "grpcio-tools >=1.41"] +build-backend = "_build.backend" +backend-path = ["."] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 7b45d0f..0000000 --- a/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -grpcio==1.41.0 -grpcio-tools==1.41.0 -numpy==1.22.3 -protobuf==3.18.1 -scipy==1.8.0 -six==1.16.0 diff --git a/setup.py b/setup.py deleted file mode 100755 index 5a10a61..0000000 --- a/setup.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright 2022 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. - -"""Custom mmi2grpc setuptools commands.""" - -from setuptools import setup, Command -from setuptools.command.build_py import build_py -import pkg_resources -import os - -package_directory = os.path.dirname(os.path.realpath(__file__)) - -os.environ["PATH"] = package_directory + ':' + os.environ["PATH"] - - -class BuildGrpc(Command): - """gRPC build command.""" - description = 'build grpc files' - user_options = [] - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - from grpc_tools import protoc - - proto_include = pkg_resources.resource_filename('grpc_tools', '_proto') - - files = [f'pandora/{f}' - for f in os.listdir('proto/pandora') if f.endswith('.proto')] - protoc.main([ - 'grpc_tools.protoc', - '-Iproto', - f'-I{proto_include}', - '--python_out=.', - '--custom_grpc_out=.', - ] + files) - - -class BuildPyCommand(build_py): - """Custom build command.""" - - def run(self): - self.run_command('build_grpc') - build_py.run(self) - - -setup( - name='mmi2grpc', - version='0.0.1', - packages=['mmi2grpc', 'pandora'], - install_requires=[ - 'grpcio', - ], - setup_requires=[ - 'grpcio-tools' - ], - cmdclass={ - 'build_grpc': BuildGrpc, - 'build_py': BuildPyCommand, - } -) -- cgit v1.2.3 From bad5fad11a5d6999580f129a58dfd20b9ebee2bf Mon Sep 17 00:00:00 2001 From: Thomas Girardier Date: Tue, 3 May 2022 12:44:13 -0700 Subject: mmi2grpc: use python gRPC build system from bt-test-interfaces Remove python gRPC build system as it has been integrated in bt-test-interfaces. Change-Id: I38eec0f321d7d89db9c434f8eb921ac5a4b5aa0e --- .gitignore | 4 -- .gitmodules | 2 +- README.md | 10 ++-- _build/__init__.py | 0 _build/backend.py | 47 ------------------ _build/grpc.py | 44 ----------------- _build/protoc-gen-custom_grpc | 110 ------------------------------------------ bt-test-interfaces | 1 + mmi2grpc/__init__.py | 2 +- pandora/__init__.py | 0 proto | 1 - pyproject.toml | 15 +++--- 12 files changed, 16 insertions(+), 220 deletions(-) delete mode 100644 _build/__init__.py delete mode 100644 _build/backend.py delete mode 100755 _build/grpc.py delete mode 100755 _build/protoc-gen-custom_grpc create mode 160000 bt-test-interfaces delete mode 100644 pandora/__init__.py delete mode 160000 proto diff --git a/.gitignore b/.gitignore index 4652040..bee8a64 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1 @@ -dist __pycache__ -pandora/* -!pandora/__init__.py -.eggs/ diff --git a/.gitmodules b/.gitmodules index f054688..2a24692 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "bt-test-interfaces"] - path = proto + path = bt-test-interfaces url = sso://pandora/bt-test-interfaces diff --git a/README.md b/README.md index e9233cc..c9fec3a 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ ```bash git submodule update --init -pip install -e . # With editable mode -# Or -pip install . # Without editable mode +pip install [-e] bt-test-interfaces/python +pip install [-e] . ``` -## Rebuild gRPC interfaces +## Rebuild gRPC Bluetooth test interfaces ```bash -./_build/grpc.py +pip install grpcio-tools==1.46.3 +./bt-test-interfaces/python/_build/grpc.py ``` diff --git a/_build/__init__.py b/_build/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/_build/backend.py b/_build/backend.py deleted file mode 100644 index f25546b..0000000 --- a/_build/backend.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2022 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. - -"""PEP517 build backend.""" - -from .grpc import build as build_pandora_grpc - -from flit_core.wheel import WheelBuilder -# Use all build hooks from flit -from flit_core.buildapi import * - - -# Build grpc interfaces when this build backend is invoked -build_pandora_grpc() - -# flit only supports copying one module, but we need to copy two of them -# because protobuf forces the use of absolute imports. -# So Monkey patches WheelBuilder#copy_module to copy pandora folder too. -# To avoid breaking this, the version of flit_core is pinned in pyproject.toml. -old_copy_module = WheelBuilder.copy_module - - -def copy_module(self): - from flit_core.common import Module - - old_copy_module(self) - - module = self.module - - self.module = Module('pandora', self.directory) - old_copy_module(self) - - self.module = module - - -WheelBuilder.copy_module = copy_module diff --git a/_build/grpc.py b/_build/grpc.py deleted file mode 100755 index ae020a2..0000000 --- a/_build/grpc.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright 2022 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. - -"""Build gRPC pandora interfaces.""" - -import os -import pkg_resources -from grpc_tools import protoc - -package_directory = os.path.dirname(os.path.realpath(__file__)) - - -def build(): - - os.environ['PATH'] = package_directory + ':' + os.environ['PATH'] - - proto_include = pkg_resources.resource_filename('grpc_tools', '_proto') - - files = [ - f'pandora/{f}' for f in os.listdir('proto/pandora') if f.endswith('.proto')] - protoc.main([ - 'grpc_tools.protoc', - '-Iproto', - f'-I{proto_include}', - '--python_out=.', - '--custom_grpc_out=.', - ] + files) - - -if __name__ == '__main__': - build() diff --git a/_build/protoc-gen-custom_grpc b/_build/protoc-gen-custom_grpc deleted file mode 100755 index 00e47a5..0000000 --- a/_build/protoc-gen-custom_grpc +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright 2022 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. - -"""Custom mmi2grpc gRPC compiler.""" - -import sys - -from google.protobuf.compiler.plugin_pb2 import CodeGeneratorRequest, \ - CodeGeneratorResponse - - -def eprint(*args, **kwargs): - print(*args, file=sys.stderr, **kwargs) - - -request = CodeGeneratorRequest.FromString(sys.stdin.buffer.read()) - - -def has_type(proto_file, type_name): - return any(filter(lambda x: x.name == type_name, proto_file.message_type)) - - -def import_type(imports, type): - package = type[1:type.rindex('.')] - type_name = type[type.rindex('.')+1:] - file = next(filter( - lambda x: x.package == package and has_type(x, type_name), - request.proto_file)) - python_path = file.name.replace('.proto', '').replace('/', '.') - as_name = python_path.replace('.', '_dot_') + '__pb2' - module_path = python_path[:python_path.rindex('.')] - module_name = python_path[python_path.rindex('.')+1:] + '_pb2' - imports.add(f'from {module_path} import {module_name} as {as_name}') - return f'{as_name}.{type_name}' - - -def generate_method(imports, file, service, method): - input_mode = 'stream' if method.client_streaming else 'unary' - output_mode = 'stream' if method.server_streaming else 'unary' - - input_type = import_type(imports, method.input_type) - output_type = import_type(imports, method.output_type) - - if input_mode == 'stream': - return ( - f'def {method.name}(self, iterator, **kwargs):\n' - f' return self.channel.{input_mode}_{output_mode}(\n' - f" '/{file.package}.{service.name}/{method.name}',\n" - f' request_serializer={input_type}.SerializeToString,\n' - f' response_deserializer={output_type}.FromString\n' - f' )(iterator, **kwargs)' - ).split('\n') - else: - return ( - f'def {method.name}(self, wait_for_ready=None, **kwargs):\n' - f' return self.channel.{input_mode}_{output_mode}(\n' - f" '/{file.package}.{service.name}/{method.name}',\n" - f' request_serializer={input_type}.SerializeToString,\n' - f' response_deserializer={output_type}.FromString\n' - f' )({input_type}(**kwargs), wait_for_ready=wait_for_ready)' - ).split('\n') - - -def generate_service(imports, file, service): - methods = '\n\n '.join([ - '\n '.join( - generate_method(imports, file, service, method) - ) for method in service.method - ]) - return ( - f'class {service.name}:\n' - f' def __init__(self, channel):\n' - f' self.channel = channel\n' - f'\n' - f' {methods}\n' - ).split('\n') - - -files = [] - -for file_name in request.file_to_generate: - file = next(filter(lambda x: x.name == file_name, request.proto_file)) - - imports = set([]) - - services = '\n'.join(sum([ - generate_service(imports, file, service) for service in file.service - ], [])) - - files.append(CodeGeneratorResponse.File( - name=file_name.replace('.proto', '_grpc.py'), - content='\n'.join(imports) + '\n\n' + services - )) - -reponse = CodeGeneratorResponse(file=files) - -sys.stdout.buffer.write(reponse.SerializeToString()) diff --git a/bt-test-interfaces b/bt-test-interfaces new file mode 160000 index 0000000..469be68 --- /dev/null +++ b/bt-test-interfaces @@ -0,0 +1 @@ +Subproject commit 469be68bd8e816707adf43d71af9b3cd22226b91 diff --git a/mmi2grpc/__init__.py b/mmi2grpc/__init__.py index 2fd8603..6385e71 100644 --- a/mmi2grpc/__init__.py +++ b/mmi2grpc/__init__.py @@ -95,7 +95,7 @@ class IUT: description: MMI description. style: MMI popup style, unused for now. """ - print(f'{profile} mmi: {description}', file=sys.stderr) + print(f'{profile} mmi: {interaction}', file=sys.stderr) # Handles A2DP and AVDTP MMIs. if profile in ('A2DP', 'AVDTP'): diff --git a/pandora/__init__.py b/pandora/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/proto b/proto deleted file mode 160000 index 5c9f411..0000000 --- a/proto +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5c9f411d1eefac171b76051b18bd0b0435c7790b diff --git a/pyproject.toml b/pyproject.toml index 6923987..de54399 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,12 +3,13 @@ name = "mmi2grpc" authors = [{name = "Pandora", email = "pandora-core@google.com"}] readme = "README.md" dynamic = ["version", "description"] -dependencies = ["grpcio >=1.41", "numpy >=1.22", "scipy >= 1.8"] - -[tool.flit.sdist] -include = ["_build", "proto", "pandora"] +dependencies = [ + "bt-test-interfaces", + "grpcio>=1.41", + "numpy>=1.22", + "scipy>=1.8" +] [build-system] -requires = ["flit_core==3.7.1", "grpcio-tools >=1.41"] -build-backend = "_build.backend" -backend-path = ["."] +requires = ["flit_core==3.7.1"] +build-backend = "flit_core.buildapi" -- cgit v1.2.3 -- cgit v1.2.3 From 6029c0575763ef237440a9bb7447a922eecf47fb Mon Sep 17 00:00:00 2001 From: Thomas Girardier Date: Fri, 17 Jun 2022 00:05:18 +0000 Subject: PTS-bot: fix failure after reset Bug: 235492458 Change-Id: I8cfa2f37f799c60aa842d47a0d59144c7be96adf --- mmi2grpc/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mmi2grpc/__init__.py b/mmi2grpc/__init__.py index 6385e71..f897f46 100644 --- a/mmi2grpc/__init__.py +++ b/mmi2grpc/__init__.py @@ -70,7 +70,8 @@ class IUT: try: return Host(channel).ReadLocalAddress( wait_for_ready=True).address - except grpc.RpcError: + except grpc.RpcError or grpc._channel._InactiveRpcError: + tries += 1 if tries >= MAX_RETRIES: raise else: -- cgit v1.2.3 From 58847f89742340729e1f11a77d4c6e56edb8dea7 Mon Sep 17 00:00:00 2001 From: Thomas Girardier Date: Wed, 4 May 2022 18:08:36 +0000 Subject: Add metadata files Test: None Change-Id: I4c8f47eec7c7f9f9939312713cd21984b50b16e2 --- METADATA | 10 ++++++++++ MODULE_LICENSE_APACHE2 | 0 OWNERS | 3 +++ 3 files changed, 13 insertions(+) create mode 100644 METADATA create mode 100644 MODULE_LICENSE_APACHE2 create mode 100644 OWNERS diff --git a/METADATA b/METADATA new file mode 100644 index 0000000..5ec1100 --- /dev/null +++ b/METADATA @@ -0,0 +1,10 @@ +name: "pandora/mmi2grpc" +description: + "MMI-to-gRPC is a translation layer which maps Bluetooth Profile Tuning " + "Suite (PTS) Man Machine Interfaces (MMI) to Pandora gRPC Bluetooth test " + "interfaces, removing the need for a human to operate the PTS" + +third_party: { + type: GOOGLE_INTERNAL + license_type: NOTICE +} diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2 new file mode 100644 index 0000000..e69de29 diff --git a/OWNERS b/OWNERS new file mode 100644 index 0000000..d4db030 --- /dev/null +++ b/OWNERS @@ -0,0 +1,3 @@ +girardier@google.com +licorne@google.com +charliebout@google.com -- cgit v1.2.3