Newer
Older
ZXSSCJ / DeviceHub / FreqSwitcherForm.cpp
#include "FreqSwitcherForm.h"
#include "ui_FreqSwitcherForm.h"
#include "DeviceHubWindow.h"

FreqSwitcherForm::FreqSwitcherForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FreqSwitcherForm)
{
    ui->setupUi(this);
}

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

void FreqSwitcherForm::on_freqSwiButt_clicked()
{
    // 获取设备对象
    int devIndex = ((DeviceHubWindow *) this->parent()->parent())->currentDevIndex;
    FreqSwitcher * device = (FreqSwitcher *) ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("06").at(devIndex);
    device->mockReceivData();
}

void FreqSwitcherForm::drawDeviceFrameOnForm(DeviceFrameBaseDto * frameData)
{
    // 当前显示的设备编号
    if (frameData->frameType == "0601")
    {
        FreqSwitcherStatusDto * statusFrameDto = (FreqSwitcherStatusDto *) frameData;

    } else if (frameData->frameType == "0602")
    {
        FreqSwitcherInterfaceDto * interFrameDto = (FreqSwitcherInterfaceDto *) frameData;

    }
}

void FreqSwitcherForm::displayDeviceCommandOnForm(QJsonObject command)
{
    QString deviceId = command.value("deviceId").toString();
    QList<DeviceBase *> typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04");
    for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++)
    {
        if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04")
        {
            ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i);
        }
    }
    for (int i = 0; i < typeDevList.size(); i++)
    {
        if (typeDevList.at(i)->getDeviceId() == command.value("deviceId").toString())
        {
            ((DeviceHubWindow *)this->parent()->parent())->getDevSelect()->setCurrentIndex(i);
        }
    }

    QString commandType = command.value("command").toString();
    if (commandType == "GLF,01")
    {

    } else if (commandType == "GLF,05")
    {

    } else if (commandType == "GLF,09")
    {

    } else if (commandType == "GLF,12")
    {

    } else if (commandType == "GLF,17")
    {

    } else if (commandType == "GLF,20")
    {

    } else if (commandType == "GLF,21")
    {

    } else if (commandType == "GLC,01")
    {

    }
}