1# Copyright 2021-2022 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! 16"""Client and server classes corresponding to protobuf-defined services.""" 17import grpc 18 19from . import emulated_bluetooth_packets_pb2 as emulated__bluetooth__packets__pb2 20from . import emulated_bluetooth_pb2 as emulated__bluetooth__pb2 21 22 23class EmulatedBluetoothServiceStub(object): 24 """An Emulated Bluetooth Service exposes the emulated bluetooth chip from the 25 android emulator. It allows you to register emulated bluetooth devices and 26 control the packets that are exchanged between the device and the world. 27 28 This service enables you to establish a "virtual network" of emulated 29 bluetooth devices that can interact with each other. 30 31 Note: This is not yet finalized, it is likely that these definitions will 32 evolve. 33 """ 34 35 def __init__(self, channel): 36 """Constructor. 37 38 Args: 39 channel: A grpc.Channel. 40 """ 41 self.registerClassicPhy = channel.stream_stream( 42 '/android.emulation.bluetooth.EmulatedBluetoothService/registerClassicPhy', 43 request_serializer=emulated__bluetooth__pb2.RawData.SerializeToString, 44 response_deserializer=emulated__bluetooth__pb2.RawData.FromString, 45 ) 46 self.registerBlePhy = channel.stream_stream( 47 '/android.emulation.bluetooth.EmulatedBluetoothService/registerBlePhy', 48 request_serializer=emulated__bluetooth__pb2.RawData.SerializeToString, 49 response_deserializer=emulated__bluetooth__pb2.RawData.FromString, 50 ) 51 self.registerHCIDevice = channel.stream_stream( 52 '/android.emulation.bluetooth.EmulatedBluetoothService/registerHCIDevice', 53 request_serializer=emulated__bluetooth__packets__pb2.HCIPacket.SerializeToString, 54 response_deserializer=emulated__bluetooth__packets__pb2.HCIPacket.FromString, 55 ) 56 57 58class EmulatedBluetoothServiceServicer(object): 59 """An Emulated Bluetooth Service exposes the emulated bluetooth chip from the 60 android emulator. It allows you to register emulated bluetooth devices and 61 control the packets that are exchanged between the device and the world. 62 63 This service enables you to establish a "virtual network" of emulated 64 bluetooth devices that can interact with each other. 65 66 Note: This is not yet finalized, it is likely that these definitions will 67 evolve. 68 """ 69 70 def registerClassicPhy(self, request_iterator, context): 71 """Connect device to link layer. This will establish a direct connection 72 to the emulated bluetooth chip and configure the following: 73 74 - Each connection creates a new device and attaches it to the link layer 75 - Link Layer packets are transmitted directly to the phy 76 77 This should be used for classic connections. 78 79 This is used to directly connect various android emulators together. 80 For example a wear device can connect to an android emulator through 81 this. 82 """ 83 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 84 context.set_details('Method not implemented!') 85 raise NotImplementedError('Method not implemented!') 86 87 def registerBlePhy(self, request_iterator, context): 88 """Connect device to link layer. This will establish a direct connection 89 to root canal and execute the following: 90 91 - Each connection creates a new device and attaches it to the link layer 92 - Link Layer packets are transmitted directly to the phy 93 94 This should be used for BLE connections. 95 96 This is used to directly connect various android emulators together. 97 For example a wear device can connect to an android emulator through 98 this. 99 """ 100 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 101 context.set_details('Method not implemented!') 102 raise NotImplementedError('Method not implemented!') 103 104 def registerHCIDevice(self, request_iterator, context): 105 """Connect the device to the emulated bluetooth chip. The device will 106 participate in the network. You can configure the chip to scan, advertise 107 and setup connections with other devices that are connected to the 108 network. 109 110 This is usually used when you have a need for an emulated bluetooth chip 111 and have a bluetooth stack that can interpret and handle the packets 112 correctly. 113 114 For example the apache nimble stack can use this endpoint as the 115 transport layer. 116 """ 117 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 118 context.set_details('Method not implemented!') 119 raise NotImplementedError('Method not implemented!') 120 121 122def add_EmulatedBluetoothServiceServicer_to_server(servicer, server): 123 rpc_method_handlers = { 124 'registerClassicPhy': grpc.stream_stream_rpc_method_handler( 125 servicer.registerClassicPhy, 126 request_deserializer=emulated__bluetooth__pb2.RawData.FromString, 127 response_serializer=emulated__bluetooth__pb2.RawData.SerializeToString, 128 ), 129 'registerBlePhy': grpc.stream_stream_rpc_method_handler( 130 servicer.registerBlePhy, 131 request_deserializer=emulated__bluetooth__pb2.RawData.FromString, 132 response_serializer=emulated__bluetooth__pb2.RawData.SerializeToString, 133 ), 134 'registerHCIDevice': grpc.stream_stream_rpc_method_handler( 135 servicer.registerHCIDevice, 136 request_deserializer=emulated__bluetooth__packets__pb2.HCIPacket.FromString, 137 response_serializer=emulated__bluetooth__packets__pb2.HCIPacket.SerializeToString, 138 ), 139 } 140 generic_handler = grpc.method_handlers_generic_handler( 141 'android.emulation.bluetooth.EmulatedBluetoothService', rpc_method_handlers) 142 server.add_generic_rpc_handlers((generic_handler,)) 143 144 145 # This class is part of an EXPERIMENTAL API. 146class EmulatedBluetoothService(object): 147 """An Emulated Bluetooth Service exposes the emulated bluetooth chip from the 148 android emulator. It allows you to register emulated bluetooth devices and 149 control the packets that are exchanged between the device and the world. 150 151 This service enables you to establish a "virtual network" of emulated 152 bluetooth devices that can interact with each other. 153 154 Note: This is not yet finalized, it is likely that these definitions will 155 evolve. 156 """ 157 158 @staticmethod 159 def registerClassicPhy(request_iterator, 160 target, 161 options=(), 162 channel_credentials=None, 163 call_credentials=None, 164 insecure=False, 165 compression=None, 166 wait_for_ready=None, 167 timeout=None, 168 metadata=None): 169 return grpc.experimental.stream_stream(request_iterator, target, '/android.emulation.bluetooth.EmulatedBluetoothService/registerClassicPhy', 170 emulated__bluetooth__pb2.RawData.SerializeToString, 171 emulated__bluetooth__pb2.RawData.FromString, 172 options, channel_credentials, 173 insecure, call_credentials, compression, wait_for_ready, timeout, metadata) 174 175 @staticmethod 176 def registerBlePhy(request_iterator, 177 target, 178 options=(), 179 channel_credentials=None, 180 call_credentials=None, 181 insecure=False, 182 compression=None, 183 wait_for_ready=None, 184 timeout=None, 185 metadata=None): 186 return grpc.experimental.stream_stream(request_iterator, target, '/android.emulation.bluetooth.EmulatedBluetoothService/registerBlePhy', 187 emulated__bluetooth__pb2.RawData.SerializeToString, 188 emulated__bluetooth__pb2.RawData.FromString, 189 options, channel_credentials, 190 insecure, call_credentials, compression, wait_for_ready, timeout, metadata) 191 192 @staticmethod 193 def registerHCIDevice(request_iterator, 194 target, 195 options=(), 196 channel_credentials=None, 197 call_credentials=None, 198 insecure=False, 199 compression=None, 200 wait_for_ready=None, 201 timeout=None, 202 metadata=None): 203 return grpc.experimental.stream_stream(request_iterator, target, '/android.emulation.bluetooth.EmulatedBluetoothService/registerHCIDevice', 204 emulated__bluetooth__packets__pb2.HCIPacket.SerializeToString, 205 emulated__bluetooth__packets__pb2.HCIPacket.FromString, 206 options, channel_credentials, 207 insecure, call_credentials, compression, wait_for_ready, timeout, metadata) 208