# Path: thingsboard_gateway/connectors/converter.py
# class Converter(ABC):
#     def convert(self, config, data):
# 
# Path: thingsboard_gateway/gateway/constant_enums.py
# class DownlinkMessageType(Enum):
#     Response = 0,
#     ConnectorConfigurationMsg = 1,
#     GatewayAttributeUpdateNotificationMsg = 2,
#     GatewayAttributeResponseMsg = 3,
#     GatewayDeviceRpcRequestMsg = 4,
#     UnregisterConnectorMsg = 5


from time import time
from typing import Union
from simplejson import dumps
from thingsboard_gateway.connectors.converter import Converter, log
from thingsboard_gateway.gateway.constant_enums import DownlinkMessageType
from thingsboard_gateway.gateway.proto.messages_pb2 import *
#      Copyright 2022. ThingsBoard
#  #
#      Licensed under the Apache License, Version 2.0 (the "License");
#      you may not use this file except in compliance with the License.
#      You may obtain a copy of the License at
#  #
#          http://www.apache.org/licenses/LICENSE-2.0
#  #
#      Unless required by applicable law or agreed to in writing, software
#      distributed under the License is distributed on an "AS IS" BASIS,
#      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#      See the License for the specific language governing permissions and
#      limitations under the License.




class GrpcDownlinkConverter(Converter):
    def __init__(self):
        self.__conversion_methods = {

# Path: thingsboard_gateway/connectors/converter.py
# class Converter(ABC):
#     def convert(self, config, data):
# 
# Path: thingsboard_gateway/gateway/constant_enums.py
# class DownlinkMessageType(Enum):
#     Response = 0,
#     ConnectorConfigurationMsg = 1,
#     GatewayAttributeUpdateNotificationMsg = 2,
#     GatewayAttributeResponseMsg = 3,
#     GatewayDeviceRpcRequestMsg = 4,
#     UnregisterConnectorMsg = 5


# Path: thingsboard_gateway/gateway/grpc_service/grpc_downlink_converter.py
from time import time
from typing import Union
from simplejson import dumps
from thingsboard_gateway.connectors.converter import Converter, log
from thingsboard_gateway.gateway.constant_enums import DownlinkMessageType
from thingsboard_gateway.gateway.proto.messages_pb2 import *

#      Copyright 2022. ThingsBoard
#  #
#      Licensed under the Apache License, Version 2.0 (the "License");
#      you may not use this file except in compliance with the License.
#      You may obtain a copy of the License at
#  #
#          http://www.apache.org/licenses/LICENSE-2.0
#  #
#      Unless required by applicable law or agreed to in writing, software
#      distributed under the License is distributed on an "AS IS" BASIS,
#      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#      See the License for the specific language governing permissions and
#      limitations under the License.




class GrpcDownlinkConverter(Converter):
    def __init__(self):
        self.__conversion_methods = {

            DownlinkMessageType.Response: self.__convert_response_msg,