#include "TimeSwitcherForm.h" #include "ui_TimeSwitcherForm.h" #include "DeviceHubWindow.h" TimeSwitcherForm::TimeSwitcherForm(QWidget *parent) : QWidget(parent), ui(new Ui::TimeSwitcherForm) { ui->setupUi(this); } TimeSwitcherForm::~TimeSwitcherForm() { delete ui; } void TimeSwitcherForm::on_tmSwiButt_clicked() { // 获取设备对象 int devIndex = ((DeviceHubWindow *) this->parent()->parent())->currentDevIndex; TimeSwitcher * device = (TimeSwitcher *) ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("05").at(devIndex); device->mockReceivData(); } void TimeSwitcherForm::drawDeviceFrameOnForm(DeviceFrameBaseDto * frameData) { // 当前显示的设备编号 if (frameData->frameType == "0501") { TimeSwitcherStatusDto * statusFrameDto = (TimeSwitcherStatusDto *) frameData; } else if (frameData->frameType == "0502") { TimeSwitcherInterfaceDto * interFrameDto = (TimeSwitcherInterfaceDto *) frameData; } } void TimeSwitcherForm::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,02") { } else if (commandType == "GLF,03") { } else if (commandType == "GLF,04") { } else if (commandType == "GLF,05") { } else if (commandType == "GLF,06") { } else if (commandType == "GLC,01") { } }