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_device_pb2 as emulated__bluetooth__device__pb2
6from . import emulated_bluetooth_packets_pb2 as emulated__bluetooth__packets__pb2
7from . import emulated_bluetooth_pb2 as emulated__bluetooth__pb2
8
9
10class EmulatedBluetoothServiceStub(object):
11    """An Emulated Bluetooth Service exposes the emulated bluetooth chip from the
12    android emulator. It allows you to register emulated bluetooth devices and
13    control the packets that are exchanged between the device and the world.
14
15    This service enables you to establish a "virtual network" of emulated
16    bluetooth devices that can interact with each other.
17
18    Note: This is not yet finalized, it is likely that these definitions will
19    evolve.
20    """
21
22    def __init__(self, channel):
23        """Constructor.
24
25        Args:
26            channel: A grpc.Channel.
27        """
28        self.registerClassicPhy = channel.stream_stream(
29                '/android.emulation.bluetooth.EmulatedBluetoothService/registerClassicPhy',
30                request_serializer=emulated__bluetooth__pb2.RawData.SerializeToString,
31                response_deserializer=emulated__bluetooth__pb2.RawData.FromString,
32                )
33        self.registerBlePhy = channel.stream_stream(
34                '/android.emulation.bluetooth.EmulatedBluetoothService/registerBlePhy',
35                request_serializer=emulated__bluetooth__pb2.RawData.SerializeToString,
36                response_deserializer=emulated__bluetooth__pb2.RawData.FromString,
37                )
38        self.registerHCIDevice = channel.stream_stream(
39                '/android.emulation.bluetooth.EmulatedBluetoothService/registerHCIDevice',
40                request_serializer=emulated__bluetooth__packets__pb2.HCIPacket.SerializeToString,
41                response_deserializer=emulated__bluetooth__packets__pb2.HCIPacket.FromString,
42                )
43        self.registerGattDevice = channel.unary_unary(
44                '/android.emulation.bluetooth.EmulatedBluetoothService/registerGattDevice',
45                request_serializer=emulated__bluetooth__device__pb2.GattDevice.SerializeToString,
46                response_deserializer=emulated__bluetooth__pb2.RegistrationStatus.FromString,
47                )
48
49
50class EmulatedBluetoothServiceServicer(object):
51    """An Emulated Bluetooth Service exposes the emulated bluetooth chip from the
52    android emulator. It allows you to register emulated bluetooth devices and
53    control the packets that are exchanged between the device and the world.
54
55    This service enables you to establish a "virtual network" of emulated
56    bluetooth devices that can interact with each other.
57
58    Note: This is not yet finalized, it is likely that these definitions will
59    evolve.
60    """
61
62    def registerClassicPhy(self, request_iterator, context):
63        """Connect device to link layer. This will establish a direct connection
64        to the emulated bluetooth chip and configure the following:
65
66        - Each connection creates a new device and attaches it to the link layer
67        - Link Layer packets are transmitted directly to the phy
68
69        This should be used for classic connections.
70
71        This is used to directly connect various android emulators together.
72        For example a wear device can connect to an android emulator through
73        this.
74        """
75        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
76        context.set_details('Method not implemented!')
77        raise NotImplementedError('Method not implemented!')
78
79    def registerBlePhy(self, request_iterator, context):
80        """Connect device to link layer. This will establish a direct connection
81        to root canal and execute the following:
82
83        - Each connection creates a new device and attaches it to the link layer
84        - Link Layer packets are transmitted directly to the phy
85
86        This should be used for BLE connections.
87
88        This is used to directly connect various android emulators together.
89        For example a wear device can connect to an android emulator through
90        this.
91        """
92        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
93        context.set_details('Method not implemented!')
94        raise NotImplementedError('Method not implemented!')
95
96    def registerHCIDevice(self, request_iterator, context):
97        """Connect the device to the emulated bluetooth chip. The device will
98        participate in the network. You can configure the chip to scan, advertise
99        and setup connections with other devices that are connected to the
100        network.
101
102        This is usually used when you have a need for an emulated bluetooth chip
103        and have a bluetooth stack that can interpret and handle the packets
104        correctly.
105
106        For example the apache nimble stack can use this endpoint as the
107        transport layer.
108        """
109        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
110        context.set_details('Method not implemented!')
111        raise NotImplementedError('Method not implemented!')
112
113    def registerGattDevice(self, request, context):
114        """Registers an emulated bluetooth device. The emulator will reach out to
115        the emulated device to read/write and subscribe to properties.
116
117        The following gRPC error codes can be returned:
118        -  FAILED_PRECONDITION (code 9):
119        - root canal is not available on this device
120        - unable to reach the endpoint for the GattDevice
121        -  INTERNAL (code 13) if there was an internal emulator failure.
122
123        The device will not be discoverable in case of an error.
124        """
125        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
126        context.set_details('Method not implemented!')
127        raise NotImplementedError('Method not implemented!')
128
129
130def add_EmulatedBluetoothServiceServicer_to_server(servicer, server):
131    rpc_method_handlers = {
132            'registerClassicPhy': grpc.stream_stream_rpc_method_handler(
133                    servicer.registerClassicPhy,
134                    request_deserializer=emulated__bluetooth__pb2.RawData.FromString,
135                    response_serializer=emulated__bluetooth__pb2.RawData.SerializeToString,
136            ),
137            'registerBlePhy': grpc.stream_stream_rpc_method_handler(
138                    servicer.registerBlePhy,
139                    request_deserializer=emulated__bluetooth__pb2.RawData.FromString,
140                    response_serializer=emulated__bluetooth__pb2.RawData.SerializeToString,
141            ),
142            'registerHCIDevice': grpc.stream_stream_rpc_method_handler(
143                    servicer.registerHCIDevice,
144                    request_deserializer=emulated__bluetooth__packets__pb2.HCIPacket.FromString,
145                    response_serializer=emulated__bluetooth__packets__pb2.HCIPacket.SerializeToString,
146            ),
147            'registerGattDevice': grpc.unary_unary_rpc_method_handler(
148                    servicer.registerGattDevice,
149                    request_deserializer=emulated__bluetooth__device__pb2.GattDevice.FromString,
150                    response_serializer=emulated__bluetooth__pb2.RegistrationStatus.SerializeToString,
151            ),
152    }
153    generic_handler = grpc.method_handlers_generic_handler(
154            'android.emulation.bluetooth.EmulatedBluetoothService', rpc_method_handlers)
155    server.add_generic_rpc_handlers((generic_handler,))
156
157
158 # This class is part of an EXPERIMENTAL API.
159class EmulatedBluetoothService(object):
160    """An Emulated Bluetooth Service exposes the emulated bluetooth chip from the
161    android emulator. It allows you to register emulated bluetooth devices and
162    control the packets that are exchanged between the device and the world.
163
164    This service enables you to establish a "virtual network" of emulated
165    bluetooth devices that can interact with each other.
166
167    Note: This is not yet finalized, it is likely that these definitions will
168    evolve.
169    """
170
171    @staticmethod
172    def registerClassicPhy(request_iterator,
173            target,
174            options=(),
175            channel_credentials=None,
176            call_credentials=None,
177            insecure=False,
178            compression=None,
179            wait_for_ready=None,
180            timeout=None,
181            metadata=None):
182        return grpc.experimental.stream_stream(request_iterator, target, '/android.emulation.bluetooth.EmulatedBluetoothService/registerClassicPhy',
183            emulated__bluetooth__pb2.RawData.SerializeToString,
184            emulated__bluetooth__pb2.RawData.FromString,
185            options, channel_credentials,
186            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
187
188    @staticmethod
189    def registerBlePhy(request_iterator,
190            target,
191            options=(),
192            channel_credentials=None,
193            call_credentials=None,
194            insecure=False,
195            compression=None,
196            wait_for_ready=None,
197            timeout=None,
198            metadata=None):
199        return grpc.experimental.stream_stream(request_iterator, target, '/android.emulation.bluetooth.EmulatedBluetoothService/registerBlePhy',
200            emulated__bluetooth__pb2.RawData.SerializeToString,
201            emulated__bluetooth__pb2.RawData.FromString,
202            options, channel_credentials,
203            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
204
205    @staticmethod
206    def registerHCIDevice(request_iterator,
207            target,
208            options=(),
209            channel_credentials=None,
210            call_credentials=None,
211            insecure=False,
212            compression=None,
213            wait_for_ready=None,
214            timeout=None,
215            metadata=None):
216        return grpc.experimental.stream_stream(request_iterator, target, '/android.emulation.bluetooth.EmulatedBluetoothService/registerHCIDevice',
217            emulated__bluetooth__packets__pb2.HCIPacket.SerializeToString,
218            emulated__bluetooth__packets__pb2.HCIPacket.FromString,
219            options, channel_credentials,
220            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
221
222    @staticmethod
223    def registerGattDevice(request,
224            target,
225            options=(),
226            channel_credentials=None,
227            call_credentials=None,
228            insecure=False,
229            compression=None,
230            wait_for_ready=None,
231            timeout=None,
232            metadata=None):
233        return grpc.experimental.unary_unary(request, target, '/android.emulation.bluetooth.EmulatedBluetoothService/registerGattDevice',
234            emulated__bluetooth__device__pb2.GattDevice.SerializeToString,
235            emulated__bluetooth__pb2.RegistrationStatus.FromString,
236            options, channel_credentials,
237            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
238