package iot.lidee.protocol.base.protocol;


import iot.lidee.common.core.mq.DeviceReport;
import iot.lidee.common.core.mq.MQSendMessageBo;
import iot.lidee.common.core.mq.message.DeviceData;
import iot.lidee.common.core.mq.message.FunctionCallBackBo;

/**
 * 基础协议
 * @author gsb
 * @date 2022/10/10 15:48
 */
public interface IProtocol {

    DeviceReport decode(DeviceData data, String clientId);

    FunctionCallBackBo encode(MQSendMessageBo message);

    /**
     * 默认方法，处理设备回复的报文编码
     */
    public default byte[] encodeCallBack(Object message) {
        return new byte[0];
    }

    default byte[] encode(DeviceData data)  {
        return new byte[0];
    }

    default DeviceData decode(String message) {
        return DeviceData.builder().build();
    }

}
