#include "vst_idle_io.h"
#include "logic.h"
VST_Idle_IO::VST_Idle_IO(int iID, const QString &sName,
                         VSM_Thread *pParent)
    :VST_Idle(  iID,  sName, pParent)
{

}

void VST_Idle_IO::do_Msg(const V_Msg &msg)
{
    if(msg.m_iID==VarMsg_Driver_ID)
    {
        V_Msg msg1=msg;
        Q_ASSERT(msg1.m_vlInput.size()>=2);
        int iDriverID=msg1.m_vlInput.at(0).toInt();
        int iDriverMsgID=msg1.m_vlInput.at(1).toInt();
        if(iDriverID==CAM_DRIVER||iDriverID==MOTOR_DRIVER||iDriverID==LASER_DRIVER
			||iDriverID==POWERMETERDRIVER || iDriverID==COATVOLUME_SENSOR || iDriverID == HGRIPPER_DRIVER)
        {
            msg1.m_vlInput.pop_front();
            msg1.m_vlInput.pop_front();
            CDriverCard* pDriverCard= GET_CARD(iDriverID,CDriverCard);
            Q_ASSERT(pDriverCard);
            pDriverCard->do_msg(iDriverMsgID,msg1.m_vlInput,msg1.m_pvlOutput);
        }
    }
    else
    {
        MSleep(5);
    }
}

