|
|
@ -51,7 +51,7 @@ void MainWindow::doinui_slot(QFunction func) { |
|
|
|
* PreviewShow * |
|
|
|
***********************************************************************************************************************/ |
|
|
|
|
|
|
|
void MainWindow::instructionPreviewShow(QString text) { |
|
|
|
void MainWindow::ishow(QString text) { |
|
|
|
QString info; |
|
|
|
info.append(QDateTime::currentDateTime().toString("hh:mm:ss.zzz ")); |
|
|
|
info.append(" |"); |
|
|
@ -136,7 +136,7 @@ void MainWindow::constructBaseUI() { |
|
|
|
ui->serialBaudrateCB->addItem("460800"); |
|
|
|
ui->serialBaudrateCB->addItem("500000"); |
|
|
|
ui->serialBaudrateCB->addItem("2000000"); |
|
|
|
ui->serialBaudrateCB->setCurrentIndex(6); |
|
|
|
ui->serialBaudrateCB->setCurrentIndex(8); |
|
|
|
|
|
|
|
connect(ui->serialPortRefreshKey, &QPushButton::clicked, this, [this](bool check) { |
|
|
|
ui->serialPortCB->clear(); |
|
|
@ -197,7 +197,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi |
|
|
|
connect(this, SIGNAL(doinui_signal(QFunction)), this, SLOT(doinui_slot(QFunction))); |
|
|
|
ZQUI::ins()->initialize(); |
|
|
|
ZQUI::ins()->setBlockDataUploadPreviewShow([this](QString text) { blockDataUploadPreviewShow(text); }); |
|
|
|
ZQUI::ins()->setInstructionPreviewShow([this](QString text) { instructionPreviewShow(text); }); |
|
|
|
ZQUI::ins()->setishow([this](QString text) { ishow(text); }); |
|
|
|
ZQUI::ins()->setReportPreviewShow([this](QString text) { reportPreviewShow(text); }); |
|
|
|
ZQUI::ins()->setRawDataPreviewShow([this](QString text) { rawDataPreviewShow(text); }); |
|
|
|
ZQUI::ins()->setInstructionPreviewClear([this]() { instructionPreviewClear(); }); |
|
|
@ -207,6 +207,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi |
|
|
|
*/ |
|
|
|
constructBaseUI(); |
|
|
|
constructAppUI(); |
|
|
|
ui->uploadDataPreview->hide(); |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief 业务逻辑构造 |
|
|
@ -217,28 +218,71 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi |
|
|
|
IflytopCanbusMaster::ins()->regOnRawData([this](packet_type_t type, uint8_t from, uint8_t to, uint8_t *hex, uint32_t hexlen) { |
|
|
|
if (type == kcmd) { |
|
|
|
zcanbus_packet_t *frame = (zcanbus_packet_t *)hex; |
|
|
|
ZQUI::ins()->rawDataPreviewShow("[CMD ] [from:%d to:%d,index:%02x cmd:%d] %s", from, to, frame->index, frame->function_id, //
|
|
|
|
zhex2str(frame->params, hexlen - sizeof(zcanbus_packet_t)).c_str() //
|
|
|
|
); |
|
|
|
ZQUI::ins()->rawDataPreviewShow("[CMD ] [%d->%d],%s", from, to, zhex2str(hex, hexlen).c_str()); //
|
|
|
|
} else if (type == kerror_receipt) { |
|
|
|
ZQUI::ins()->rawDataPreviewShow("[E-RECEIPT] %s", zhex2str(hex, hexlen).c_str()); |
|
|
|
ZQUI::ins()->rawDataPreviewShow("[E-RECEIPT] [%d->%d],%s", from, to, zhex2str(hex, hexlen).c_str()); //
|
|
|
|
} else if (type == kreceipt) { |
|
|
|
ZQUI::ins()->rawDataPreviewShow("[RECEIPT ] %s", zhex2str(hex, hexlen).c_str()); |
|
|
|
ZQUI::ins()->rawDataPreviewShow("[RECEIPT ] [%d->%d],%s", from, to, zhex2str(hex, hexlen).c_str()); //
|
|
|
|
} else if (type == kreport) { |
|
|
|
ZQUI::ins()->rawDataPreviewShow("[REPORT ] %s", zhex2str(hex, hexlen).c_str()); |
|
|
|
ZQUI::ins()->rawDataPreviewShow("[REPORT ] [%d->%d],%s", from, to, zhex2str(hex, hexlen).c_str()); //
|
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
MainWindow::~MainWindow() { delete ui; } |
|
|
|
|
|
|
|
void MainWindow::processException(const zexception &e) { //
|
|
|
|
ZQUI::ins()->instructionPreviewShow("%s", e.what()); |
|
|
|
ZQUI::ins()->ishow("%s", e.what()); |
|
|
|
} |
|
|
|
int32_t MainWindow::getDeviceId() { return PublicState_DeviceIDVal; } |
|
|
|
void MainWindow::constructAppUI() { |
|
|
|
void MainWindow::constructAppUI() { |
|
|
|
/***********************************************************************************************************************
|
|
|
|
* 模块操作 * |
|
|
|
***********************************************************************************************************************/ |
|
|
|
|
|
|
|
{ |
|
|
|
ZQVTabPage *tab = new ZQVTabPage(ui->buttonTabWidget, "基础方法"); |
|
|
|
// static
|
|
|
|
|
|
|
|
// ack_read_board_info_data_t readboardinfo(int to);
|
|
|
|
// ack_sysinfo_t readsysinfo(int to);
|
|
|
|
// ask_taskinfo_t readtaskinfo(int to,int32_t taskoff);
|
|
|
|
|
|
|
|
{ |
|
|
|
ZQFunctionListBox *box = new ZQFunctionListBox(tab, "通用方法", 4); |
|
|
|
box->newFunc("读板卡信息", {}, [this](int argn, const char **args) { //
|
|
|
|
ack_read_board_info_data_t ack = IflytopCanbusMaster::ins()->readboardinfo(getDeviceId()); |
|
|
|
ZQUI::ins()->ishow("boardType :%s(%d)", BoardTypeToString(ack.boardType), ack.boardType); |
|
|
|
ZQUI::ins()->ishow("projectId :%s(%d)", ProjectIDToString(ack.projectId), ack.projectId); |
|
|
|
ZQUI::ins()->ishow("protcol_version :%d", ack.protcol_version); |
|
|
|
ZQUI::ins()->ishow("software_version :%d", ack.software_version); |
|
|
|
ZQUI::ins()->ishow("hardware_version :%d", ack.hardware_version); |
|
|
|
}); |
|
|
|
|
|
|
|
box->newFunc("读系统信息", {}, [this](int argn, const char **args) { //
|
|
|
|
ack_sysinfo_t ack = IflytopCanbusMaster::ins()->readsysinfo(getDeviceId()); |
|
|
|
ask_taskinfo_t task[20]; |
|
|
|
for (int i = 0; i < ack.taskNum; i++) { |
|
|
|
task[i] = IflytopCanbusMaster::ins()->readtaskinfo(getDeviceId(), i); |
|
|
|
} |
|
|
|
ZQUI::ins()->ishow("=========================== sys info ==========================="); |
|
|
|
ZQUI::ins()->ishow("total_heap_size :%d", ack.total_heap_size); |
|
|
|
ZQUI::ins()->ishow("free_heap_size :%d", ack.free_heap_size); |
|
|
|
ZQUI::ins()->ishow("sysHasRun :%d", ack.sysHasRun); |
|
|
|
ZQUI::ins()->ishow("="); |
|
|
|
|
|
|
|
ZQUI::ins()->ishow("=========================== task info ==========================="); |
|
|
|
ZQUI::ins()->ishow("taskoff name state stackRemainSize priority"); |
|
|
|
for (int i = 0; i < ack.taskNum; i++) { |
|
|
|
ZQUI::ins()->ishow("%d %10s %c %d", i, task[i].taskName, task[i].state, task[i].stackRemindSize, task[i].priority); |
|
|
|
} |
|
|
|
ZQUI::ins()->ishow("="); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void MainWindow::on_PublicState_ConfirmKey_clicked() { PublicState_DeviceIDVal = ui->PublicState_DeviceID->toPlainText().toInt(); } |
|
|
|
|
|
|
|
void MainWindow::on_clearPreview_clicked() { |
|
|
|
// ZQUI()->
|
|
|
|
} |