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

import power_pb2 as power__pb2


class PowerServiceGrpcStub(object):
    """定义服务,用在rpc传输中
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.getPowerValue = channel.unary_unary(
                '/PowerPackage.PowerServiceGrpc/getPowerValue',
                request_serializer=power__pb2.PowerRequest.SerializeToString,
                response_deserializer=power__pb2.PowerValueResponse.FromString,
                )
        self.startPowerListener = channel.unary_stream(
                '/PowerPackage.PowerServiceGrpc/startPowerListener',
                request_serializer=power__pb2.PowerRequest.SerializeToString,
                response_deserializer=power__pb2.PowerValueResponse.FromString,
                )
        self.stopPowerListener = channel.unary_unary(
                '/PowerPackage.PowerServiceGrpc/stopPowerListener',
                request_serializer=power__pb2.PowerRequest.SerializeToString,
                response_deserializer=power__pb2.PowerCommonResponse.FromString,
                )


class PowerServiceGrpcServicer(object):
    """定义服务,用在rpc传输中
    """

    def getPowerValue(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def startPowerListener(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def stopPowerListener(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_PowerServiceGrpcServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'getPowerValue': grpc.unary_unary_rpc_method_handler(
                    servicer.getPowerValue,
                    request_deserializer=power__pb2.PowerRequest.FromString,
                    response_serializer=power__pb2.PowerValueResponse.SerializeToString,
            ),
            'startPowerListener': grpc.unary_stream_rpc_method_handler(
                    servicer.startPowerListener,
                    request_deserializer=power__pb2.PowerRequest.FromString,
                    response_serializer=power__pb2.PowerValueResponse.SerializeToString,
            ),
            'stopPowerListener': grpc.unary_unary_rpc_method_handler(
                    servicer.stopPowerListener,
                    request_deserializer=power__pb2.PowerRequest.FromString,
                    response_serializer=power__pb2.PowerCommonResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'PowerPackage.PowerServiceGrpc', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class PowerServiceGrpc(object):
    """定义服务,用在rpc传输中
    """

    @staticmethod
    def getPowerValue(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, '/PowerPackage.PowerServiceGrpc/getPowerValue',
            power__pb2.PowerRequest.SerializeToString,
            power__pb2.PowerValueResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def startPowerListener(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, '/PowerPackage.PowerServiceGrpc/startPowerListener',
            power__pb2.PowerRequest.SerializeToString,
            power__pb2.PowerValueResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def stopPowerListener(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, '/PowerPackage.PowerServiceGrpc/stopPowerListener',
            power__pb2.PowerRequest.SerializeToString,
            power__pb2.PowerCommonResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
