Newer
Older
ZXSSCJ / DeviceHub / BCodeTerminalForm.cpp
TAN YUE on 23 Nov 2021 1 KB 中文注释
#include "BCodeTerminalForm.h"
#include "ui_BCodeTerminalForm.h"
#include "DeviceHubWindow.h"

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

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

void BCodeTerminalForm::on_bctButt_clicked()
{
    // 获取设备对象
    int devIndex = ((DeviceHubWindow *) this->parent()->parent())->currentDevIndex;
    BCodeTerminal * device = (BCodeTerminal *) ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("07").at(devIndex);
    device->mockReceivData();
}

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

    }
}

void BCodeTerminalForm::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 == "1")
    {

    } else if (commandType == "2")
    {

    }
}