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

from . import CanParserNode_pb2 as CanParserNode__pb2
from . import Common_pb2 as Common__pb2


class CanParserNodeStub(object):
    """Missing associated documentation comment in .proto file."""

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

        Args:
            channel: A grpc.Channel.
        """
        self.GetVersion = channel.unary_unary(
                '/CanParserNode.CanParserNode/GetVersion',
                request_serializer=Common__pb2.empty.SerializeToString,
                response_deserializer=Common__pb2.version.FromString,
                )
        self.AddDbFile = channel.unary_unary(
                '/CanParserNode.CanParserNode/AddDbFile',
                request_serializer=CanParserNode__pb2.db_path.SerializeToString,
                response_deserializer=Common__pb2.result.FromString,
                )
        self.SetConfig = channel.unary_unary(
                '/CanParserNode.CanParserNode/SetConfig',
                request_serializer=CanParserNode__pb2.db_configs.SerializeToString,
                response_deserializer=Common__pb2.result.FromString,
                )
        self.Clear = channel.unary_unary(
                '/CanParserNode.CanParserNode/Clear',
                request_serializer=Common__pb2.empty.SerializeToString,
                response_deserializer=Common__pb2.result.FromString,
                )
        self.ClearSubscribe = channel.unary_unary(
                '/CanParserNode.CanParserNode/ClearSubscribe',
                request_serializer=Common__pb2.empty.SerializeToString,
                response_deserializer=Common__pb2.result.FromString,
                )
        self.GetMqttTopicTreeJson = channel.unary_unary(
                '/CanParserNode.CanParserNode/GetMqttTopicTreeJson',
                request_serializer=Common__pb2.empty.SerializeToString,
                response_deserializer=CanParserNode__pb2.mqtt_topic_tree.FromString,
                )
        self.EncodePdu = channel.unary_unary(
                '/CanParserNode.CanParserNode/EncodePdu',
                request_serializer=CanParserNode__pb2.i_signal_i_pdu_obj.SerializeToString,
                response_deserializer=CanParserNode__pb2.i_signal_i_pdu_encode.FromString,
                )
        self.GetCanDbInfo = channel.unary_unary(
                '/CanParserNode.CanParserNode/GetCanDbInfo',
                request_serializer=Common__pb2.empty.SerializeToString,
                response_deserializer=CanParserNode__pb2.can_db_info.FromString,
                )


class CanParserNodeServicer(object):
    """Missing associated documentation comment in .proto file."""

    def GetVersion(self, request, context):
        """获取版本
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def AddDbFile(self, request, context):
        """添加一个CANDB文件
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SetConfig(self, request, context):
        """配置通道和CANDB的关联
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Clear(self, request, context):
        """清除所有CANDB文件
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ClearSubscribe(self, request, context):
        """清除所有订阅
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetMqttTopicTreeJson(self, request, context):
        """获取所有的 Mqtt Tree json 字符串
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def EncodePdu(self, request, context):
        """根据 PDU 的内容获取 PDU 的编码

        i_signal_i_pdu_encode.result 错误原因

        0         获取编码成功

        1000      raise Error

        1         找不到对应的通道

        2         找不到对应的 PDU 名字

        3         找不到 PDU context 中指定的信号名
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetCanDbInfo(self, request, context):
        """
        获取当前 Can的信息
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_CanParserNodeServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'GetVersion': grpc.unary_unary_rpc_method_handler(
                    servicer.GetVersion,
                    request_deserializer=Common__pb2.empty.FromString,
                    response_serializer=Common__pb2.version.SerializeToString,
            ),
            'AddDbFile': grpc.unary_unary_rpc_method_handler(
                    servicer.AddDbFile,
                    request_deserializer=CanParserNode__pb2.db_path.FromString,
                    response_serializer=Common__pb2.result.SerializeToString,
            ),
            'SetConfig': grpc.unary_unary_rpc_method_handler(
                    servicer.SetConfig,
                    request_deserializer=CanParserNode__pb2.db_configs.FromString,
                    response_serializer=Common__pb2.result.SerializeToString,
            ),
            'Clear': grpc.unary_unary_rpc_method_handler(
                    servicer.Clear,
                    request_deserializer=Common__pb2.empty.FromString,
                    response_serializer=Common__pb2.result.SerializeToString,
            ),
            'ClearSubscribe': grpc.unary_unary_rpc_method_handler(
                    servicer.ClearSubscribe,
                    request_deserializer=Common__pb2.empty.FromString,
                    response_serializer=Common__pb2.result.SerializeToString,
            ),
            'GetMqttTopicTreeJson': grpc.unary_unary_rpc_method_handler(
                    servicer.GetMqttTopicTreeJson,
                    request_deserializer=Common__pb2.empty.FromString,
                    response_serializer=CanParserNode__pb2.mqtt_topic_tree.SerializeToString,
            ),
            'EncodePdu': grpc.unary_unary_rpc_method_handler(
                    servicer.EncodePdu,
                    request_deserializer=CanParserNode__pb2.i_signal_i_pdu_obj.FromString,
                    response_serializer=CanParserNode__pb2.i_signal_i_pdu_encode.SerializeToString,
            ),
            'GetCanDbInfo': grpc.unary_unary_rpc_method_handler(
                    servicer.GetCanDbInfo,
                    request_deserializer=Common__pb2.empty.FromString,
                    response_serializer=CanParserNode__pb2.can_db_info.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'CanParserNode.CanParserNode', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class CanParserNode(object):
    """Missing associated documentation comment in .proto file."""

    @staticmethod
    def GetVersion(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, '/CanParserNode.CanParserNode/GetVersion',
            Common__pb2.empty.SerializeToString,
            Common__pb2.version.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def AddDbFile(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, '/CanParserNode.CanParserNode/AddDbFile',
            CanParserNode__pb2.db_path.SerializeToString,
            Common__pb2.result.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def SetConfig(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, '/CanParserNode.CanParserNode/SetConfig',
            CanParserNode__pb2.db_configs.SerializeToString,
            Common__pb2.result.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Clear(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, '/CanParserNode.CanParserNode/Clear',
            Common__pb2.empty.SerializeToString,
            Common__pb2.result.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def ClearSubscribe(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, '/CanParserNode.CanParserNode/ClearSubscribe',
            Common__pb2.empty.SerializeToString,
            Common__pb2.result.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetMqttTopicTreeJson(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, '/CanParserNode.CanParserNode/GetMqttTopicTreeJson',
            Common__pb2.empty.SerializeToString,
            CanParserNode__pb2.mqtt_topic_tree.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def EncodePdu(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, '/CanParserNode.CanParserNode/EncodePdu',
            CanParserNode__pb2.i_signal_i_pdu_obj.SerializeToString,
            CanParserNode__pb2.i_signal_i_pdu_encode.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetCanDbInfo(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, '/CanParserNode.CanParserNode/GetCanDbInfo',
            Common__pb2.empty.SerializeToString,
            CanParserNode__pb2.can_db_info.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
