1# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2"""Client and server classes corresponding to protobuf-defined services."""
3import grpc
4
5from . import emulated_bluetooth_packets_pb2 as emulated__bluetooth__packets__pb2
6
7
8class VhciForwardingServiceStub(object):
9    """This is a service which allows you to directly intercept the VHCI packets
10    that are coming and going to the device before they are delivered to
11    the rootcanal service described below.
12
13    This service is usually not available on the emulator, and must be explictly
14    requested from the commandline.
15    """
16
17    def __init__(self, channel):
18        """Constructor.
19
20        Args:
21            channel: A grpc.Channel.
22        """
23        self.attachVhci = channel.stream_stream(
24                '/android.emulation.bluetooth.VhciForwardingService/attachVhci',
25                request_serializer=emulated__bluetooth__packets__pb2.HCIPacket.SerializeToString,
26                response_deserializer=emulated__bluetooth__packets__pb2.HCIPacket.FromString,
27                )
28
29
30class VhciForwardingServiceServicer(object):
31    """This is a service which allows you to directly intercept the VHCI packets
32    that are coming and going to the device before they are delivered to
33    the rootcanal service described below.
34
35    This service is usually not available on the emulator, and must be explictly
36    requested from the commandline.
37    """
38
39    def attachVhci(self, request_iterator, context):
40        """This attach directly to /dev/vhci inside the android guest if available
41
42        - This will disable root canal.
43        - You will have to provide your own virtual bluetooth chip.
44
45        Some things to be aware of:
46        - Only one client can be active.
47        - Registering when bluetooth is active in android can result in
48        undefined behavior.
49        - If a client disconnects, rootcanal will be activated again
50
51        Status codes:
52        -  FAILED_PRECONDITION (code 9) If another client is controlling /dev/vhci.
53
54        This is an internal testing only interface, and is NOT publicly
55        supported.
56        """
57        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
58        context.set_details('Method not implemented!')
59        raise NotImplementedError('Method not implemented!')
60
61
62def add_VhciForwardingServiceServicer_to_server(servicer, server):
63    rpc_method_handlers = {
64            'attachVhci': grpc.stream_stream_rpc_method_handler(
65                    servicer.attachVhci,
66                    request_deserializer=emulated__bluetooth__packets__pb2.HCIPacket.FromString,
67                    response_serializer=emulated__bluetooth__packets__pb2.HCIPacket.SerializeToString,
68            ),
69    }
70    generic_handler = grpc.method_handlers_generic_handler(
71            'android.emulation.bluetooth.VhciForwardingService', rpc_method_handlers)
72    server.add_generic_rpc_handlers((generic_handler,))
73
74
75 # This class is part of an EXPERIMENTAL API.
76class VhciForwardingService(object):
77    """This is a service which allows you to directly intercept the VHCI packets
78    that are coming and going to the device before they are delivered to
79    the rootcanal service described below.
80
81    This service is usually not available on the emulator, and must be explictly
82    requested from the commandline.
83    """
84
85    @staticmethod
86    def attachVhci(request_iterator,
87            target,
88            options=(),
89            channel_credentials=None,
90            call_credentials=None,
91            insecure=False,
92            compression=None,
93            wait_for_ready=None,
94            timeout=None,
95            metadata=None):
96        return grpc.experimental.stream_stream(request_iterator, target, '/android.emulation.bluetooth.VhciForwardingService/attachVhci',
97            emulated__bluetooth__packets__pb2.HCIPacket.SerializeToString,
98            emulated__bluetooth__packets__pb2.HCIPacket.FromString,
99            options, channel_credentials,
100            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
101