#include "BCodeTerminalStatusDto.h"

BCodeTerminalStatusDto::BCodeTerminalStatusDto(QObject* parent) : DeviceFrameBaseDto(parent)
{

}

QJsonObject BCodeTerminalStatusDto::toJSON()
{
    QJsonObject jsonObj;

    QJsonObject dataObj;
    dataObj.insert("devStatus", this->devStatus);
    dataObj.insert("bdcInStatus", bdcInStatus);
    dataObj.insert("bacInStatus", bacInStatus);
    dataObj.insert("fiveInStatus", fiveInStatus);
    dataObj.insert("ref", ref);
    dataObj.insert("track", track);
    dataObj.insert("bacRange", bacRange);
    dataObj.insert("bacRatio", bacRatio);

    QJsonArray bdcOutStatusArray;
    QJsonArray bacOutStatusArray;
    for (int i = 0; i < 4; i++)
    {
        bdcOutStatusArray.append(bdcOutStatusList.at(i));
        bacOutStatusArray.append(bacOutStatusList.at(i));
    }
    dataObj.insert("bdcOutStatusArray", bdcOutStatusArray);
    dataObj.insert("bacOutStatusArray", bacOutStatusArray);

    jsonObj.insert("ts", this->milisecond);
    jsonObj.insert("frameType", this->frameType);
    jsonObj.insert("data", dataObj);

    return jsonObj;
}
