1# Copyright 2021-2023 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15# 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 20 21 22class VhciForwardingServiceStub(object): 23 """This is a service which allows you to directly intercept the VHCI packets 24 that are coming and going to the device before they are delivered to 25 the rootcanal service described below. 26 27 This service is usually not available on the emulator, and must be explictly 28 requested from the commandline. 29 """ 30 31 def __init__(self, channel): 32 """Constructor. 33 34 Args: 35 channel: A grpc.Channel. 36 """ 37 self.attachVhci = channel.stream_stream( 38 '/android.emulation.bluetooth.VhciForwardingService/attachVhci', 39 request_serializer=emulated__bluetooth__packets__pb2.HCIPacket.SerializeToString, 40 response_deserializer=emulated__bluetooth__packets__pb2.HCIPacket.FromString, 41 ) 42 43 44class VhciForwardingServiceServicer(object): 45 """This is a service which allows you to directly intercept the VHCI packets 46 that are coming and going to the device before they are delivered to 47 the rootcanal service described below. 48 49 This service is usually not available on the emulator, and must be explictly 50 requested from the commandline. 51 """ 52 53 def attachVhci(self, request_iterator, context): 54 """This attach directly to /dev/vhci inside the android guest if available 55 56 - This will disable root canal. 57 - You will have to provide your own virtual bluetooth chip. 58 59 Some things to be aware of: 60 - Only one client can be active. 61 - Registering when bluetooth is active in android can result in 62 undefined behavior. 63 - If a client disconnects, rootcanal will be activated again 64 65 Status codes: 66 - FAILED_PRECONDITION (code 9) If another client is controlling /dev/vhci. 67 68 This is an internal testing only interface, and is NOT publicly 69 supported. 70 """ 71 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 72 context.set_details('Method not implemented!') 73 raise NotImplementedError('Method not implemented!') 74 75 76def add_VhciForwardingServiceServicer_to_server(servicer, server): 77 rpc_method_handlers = { 78 'attachVhci': grpc.stream_stream_rpc_method_handler( 79 servicer.attachVhci, 80 request_deserializer=emulated__bluetooth__packets__pb2.HCIPacket.FromString, 81 response_serializer=emulated__bluetooth__packets__pb2.HCIPacket.SerializeToString, 82 ), 83 } 84 generic_handler = grpc.method_handlers_generic_handler( 85 'android.emulation.bluetooth.VhciForwardingService', rpc_method_handlers 86 ) 87 server.add_generic_rpc_handlers((generic_handler,)) 88 89 90# This class is part of an EXPERIMENTAL API. 91class VhciForwardingService(object): 92 """This is a service which allows you to directly intercept the VHCI packets 93 that are coming and going to the device before they are delivered to 94 the rootcanal service described below. 95 96 This service is usually not available on the emulator, and must be explictly 97 requested from the commandline. 98 """ 99 100 @staticmethod 101 def attachVhci( 102 request_iterator, 103 target, 104 options=(), 105 channel_credentials=None, 106 call_credentials=None, 107 insecure=False, 108 compression=None, 109 wait_for_ready=None, 110 timeout=None, 111 metadata=None, 112 ): 113 return grpc.experimental.stream_stream( 114 request_iterator, 115 target, 116 '/android.emulation.bluetooth.VhciForwardingService/attachVhci', 117 emulated__bluetooth__packets__pb2.HCIPacket.SerializeToString, 118 emulated__bluetooth__packets__pb2.HCIPacket.FromString, 119 options, 120 channel_credentials, 121 insecure, 122 call_credentials, 123 compression, 124 wait_for_ready, 125 timeout, 126 metadata, 127 ) 128