• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
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    server.add_generic_rpc_handlers((generic_handler,))
87
88
89 # This class is part of an EXPERIMENTAL API.
90class VhciForwardingService(object):
91    """This is a service which allows you to directly intercept the VHCI packets
92    that are coming and going to the device before they are delivered to
93    the rootcanal service described below.
94
95    This service is usually not available on the emulator, and must be explictly
96    requested from the commandline.
97    """
98
99    @staticmethod
100    def attachVhci(request_iterator,
101            target,
102            options=(),
103            channel_credentials=None,
104            call_credentials=None,
105            insecure=False,
106            compression=None,
107            wait_for_ready=None,
108            timeout=None,
109            metadata=None):
110        return grpc.experimental.stream_stream(request_iterator, target, '/android.emulation.bluetooth.VhciForwardingService/attachVhci',
111            emulated__bluetooth__packets__pb2.HCIPacket.SerializeToString,
112            emulated__bluetooth__packets__pb2.HCIPacket.FromString,
113            options, channel_credentials,
114            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
115