#pragma once

#include <cstddef>
#include <cstdint>

#include <QByteArray>
#include <QString>

#include "core/models/RawBusMessage.h"
#include "plugins/protocols/modbus_rtu/types/ModbusRtuPdu.h"

namespace softbus::message_bus::pipeline::protocol
{

bool decodeModbusRtu(softbus::core::models::BusDirection          dir,
                     const std::uint8_t*                           p,
                     std::size_t                                   n,
                     ModbusRtuPdu&                                 out,
                     QString*                                      errMsg = nullptr);

bool encodeModbusRtu(const ModbusRtuPdu& pdu, QByteArray& out, QString* errMsg = nullptr);

} // namespace softbus::message_bus::pipeline::protocol
