#include "TimeReplicatorStatusDto.h"

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

}

QJsonObject TimeReplicatorStatusDto::toJSON()
{
    QJsonObject jsonObj;

    QJsonObject dataObj;
    dataObj.insert("devStatus", this->devStatus);
    dataObj.insert("inCount", inCount);

    QJsonArray inputArray;
    QJsonArray outputArray;

    for (int i = 0; i < inCount; i++)
    {
        inputArray.append(this->inValid.at(i));
        outputArray.append(outValid.at(i));
    }
    dataObj.insert("inValid", inputArray);
    dataObj.insert("outValid", outputArray);

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

    return jsonObj;
}
