#include "cmwcomppowermeter.h"
#include "ui_cmwcomppowermeter.h"
#include "logic.h"
CMWCompPowerMeter::CMWCompPowerMeter(QWidget *parent) :
    CMWidget(parent),
    ui(new Ui::CMWCompPowerMeter)
{
    ui->setupUi(this);
}

CMWCompPowerMeter::~CMWCompPowerMeter()
{
    delete ui;
}

void CMWCompPowerMeter::MTimeFresh()
{

    V_MsgQueue msgqueue;
    msgqueue.pushback_Msg(VarMsg_Driver_ID,
                          QObject::trUtf8("Laser Set Gate Source Sig"),
                          QVariantList()
                          <<POWERMETERDRIVER<<CPowerMeterDriver::FRESHRESULT
                          <<POWERMETERHEAD,0);
    m_gSystem.start_test(SM_MAIN, msgqueue,false);


    CPowerMeter* pPowerMeter=GET_CHDIRECT(POWERMETERHEAD,
                CPowerMeter);
    double dPower=pPowerMeter->m_Variants.get_VData(Var_PowerMeter_MeasResult_ID)
            ->toDouble();
    ui->label_PowerMeter->setText(QString::number(dPower,'f',3));
}

void CMWCompPowerMeter::MInit()
{
    Variant* pparam[15] = { 0 };
    int iID[15] = { 0 };

    CPowerMeterDriver* pPowerDriver = GET_CARD(POWERMETERDRIVER, CPowerMeterDriver);
    pparam[0] = pPowerDriver->m_Variants.get_Variant(Var_LaserPower_MeasRate);


    ui->widget->MParamInit_list(pparam, 1, iID);


    CMWidget::MInit();
}
