# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from . import emulated_bluetooth_device_pb2 as emulated__bluetooth__device__pb2
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2


class GattDeviceServiceStub(object):
    """You can provide your own GattDevice by implementing this service
    and registering it with the android emulator.

    The device will appear as a real bluetooth device, and you will
    receive callbacks when the bluetooth system wants to
    read, write or observe a characteristic.
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.OnCharacteristicReadRequest = channel.unary_unary(
                '/android.emulation.bluetooth.GattDeviceService/OnCharacteristicReadRequest',
                request_serializer=emulated__bluetooth__device__pb2.CharacteristicValueRequest.SerializeToString,
                response_deserializer=emulated__bluetooth__device__pb2.CharacteristicValueResponse.FromString,
                )
        self.OnCharacteristicWriteRequest = channel.unary_unary(
                '/android.emulation.bluetooth.GattDeviceService/OnCharacteristicWriteRequest',
                request_serializer=emulated__bluetooth__device__pb2.CharacteristicValueRequest.SerializeToString,
                response_deserializer=emulated__bluetooth__device__pb2.CharacteristicValueResponse.FromString,
                )
        self.OnCharacteristicObserveRequest = channel.unary_stream(
                '/android.emulation.bluetooth.GattDeviceService/OnCharacteristicObserveRequest',
                request_serializer=emulated__bluetooth__device__pb2.CharacteristicValueRequest.SerializeToString,
                response_deserializer=emulated__bluetooth__device__pb2.CharacteristicValueResponse.FromString,
                )
        self.OnConnectionStateChange = channel.unary_unary(
                '/android.emulation.bluetooth.GattDeviceService/OnConnectionStateChange',
                request_serializer=emulated__bluetooth__device__pb2.ConnectionStateChange.SerializeToString,
                response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                )


class GattDeviceServiceServicer(object):
    """You can provide your own GattDevice by implementing this service
    and registering it with the android emulator.

    The device will appear as a real bluetooth device, and you will
    receive callbacks when the bluetooth system wants to
    read, write or observe a characteristic.
    """

    def OnCharacteristicReadRequest(self, request, context):
        """A remote client has requested to read a local characteristic.

        Return the current observed value.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def OnCharacteristicWriteRequest(self, request, context):
        """A remote client has requested to write to a local characteristic.

        Return the current observed value.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def OnCharacteristicObserveRequest(self, request, context):
        """Listens for notifications from the emulated device, the device should
        write to the stream with a response when a change has occurred.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def OnConnectionStateChange(self, request, context):
        """A remote device has been connected or disconnected.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_GattDeviceServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'OnCharacteristicReadRequest': grpc.unary_unary_rpc_method_handler(
                    servicer.OnCharacteristicReadRequest,
                    request_deserializer=emulated__bluetooth__device__pb2.CharacteristicValueRequest.FromString,
                    response_serializer=emulated__bluetooth__device__pb2.CharacteristicValueResponse.SerializeToString,
            ),
            'OnCharacteristicWriteRequest': grpc.unary_unary_rpc_method_handler(
                    servicer.OnCharacteristicWriteRequest,
                    request_deserializer=emulated__bluetooth__device__pb2.CharacteristicValueRequest.FromString,
                    response_serializer=emulated__bluetooth__device__pb2.CharacteristicValueResponse.SerializeToString,
            ),
            'OnCharacteristicObserveRequest': grpc.unary_stream_rpc_method_handler(
                    servicer.OnCharacteristicObserveRequest,
                    request_deserializer=emulated__bluetooth__device__pb2.CharacteristicValueRequest.FromString,
                    response_serializer=emulated__bluetooth__device__pb2.CharacteristicValueResponse.SerializeToString,
            ),
            'OnConnectionStateChange': grpc.unary_unary_rpc_method_handler(
                    servicer.OnConnectionStateChange,
                    request_deserializer=emulated__bluetooth__device__pb2.ConnectionStateChange.FromString,
                    response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'android.emulation.bluetooth.GattDeviceService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class GattDeviceService(object):
    """You can provide your own GattDevice by implementing this service
    and registering it with the android emulator.

    The device will appear as a real bluetooth device, and you will
    receive callbacks when the bluetooth system wants to
    read, write or observe a characteristic.
    """

    @staticmethod
    def OnCharacteristicReadRequest(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/android.emulation.bluetooth.GattDeviceService/OnCharacteristicReadRequest',
            emulated__bluetooth__device__pb2.CharacteristicValueRequest.SerializeToString,
            emulated__bluetooth__device__pb2.CharacteristicValueResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def OnCharacteristicWriteRequest(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/android.emulation.bluetooth.GattDeviceService/OnCharacteristicWriteRequest',
            emulated__bluetooth__device__pb2.CharacteristicValueRequest.SerializeToString,
            emulated__bluetooth__device__pb2.CharacteristicValueResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def OnCharacteristicObserveRequest(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_stream(request, target, '/android.emulation.bluetooth.GattDeviceService/OnCharacteristicObserveRequest',
            emulated__bluetooth__device__pb2.CharacteristicValueRequest.SerializeToString,
            emulated__bluetooth__device__pb2.CharacteristicValueResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def OnConnectionStateChange(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/android.emulation.bluetooth.GattDeviceService/OnConnectionStateChange',
            emulated__bluetooth__device__pb2.ConnectionStateChange.SerializeToString,
            google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
