10 changed files with 148 additions and 3 deletions
-
1CMakeLists.txt
-
2a8000_protocol
-
3iflytop_canbus/iflytop_canbus_master.cpp
-
2iflytop_canbus/iflytop_canbus_master.hpp
-
2src/mainwindow.cpp
-
2src/mainwindow.ui
-
11src/tab/board_ext_tab.cpp
-
80src/tab/code_scaner_tab.cpp
-
43src/tab/code_scaner_tab.hpp
-
5src/tab/module_opera_tab.cpp
@ -1 +1 @@ |
|||
Subproject commit 97b8fb482b00a1eef33677f582e4ecbf2ed6db25 |
|||
Subproject commit a85673b9c1b9a54c0e91a3e3f4299106a749e56d |
@ -0,0 +1,80 @@ |
|||
#include "code_scaner_tab.hpp"
|
|||
|
|||
#include "iflytop_canbus/iflytop_canbus_master.hpp"
|
|||
#include "logger.hpp"
|
|||
#include "qt_serial_datachannel.hpp"
|
|||
#include "zexception.hpp"
|
|||
#include "zui/z_function_list_box.hpp"
|
|||
#include "zui/z_reg_table_list_box.hpp"
|
|||
#include "zui/zq_vtab_page.hpp"
|
|||
//
|
|||
#include "./mainwindow.h"
|
|||
#include "zui\zqui.hpp"
|
|||
//
|
|||
using namespace iflytop; |
|||
using namespace std; |
|||
|
|||
extern Ui::MainWindow *main_ui; |
|||
|
|||
extern int getDeviceId(); |
|||
|
|||
CodeScanerTab *CodeScanerTab::inst() { |
|||
static CodeScanerTab *ins = new CodeScanerTab(); |
|||
return ins; |
|||
} |
|||
|
|||
void CodeScanerTab::construct(QTabWidget *fathertab) { |
|||
ZQVTabPage *tab = new ZQVTabPage(fathertab, "扫码器"); |
|||
/***********************************************************************************************************************
|
|||
* 模块操作 * |
|||
***********************************************************************************************************************/ |
|||
{ |
|||
ZQFunctionListBox *box = new ZQFunctionListBox(tab, "方法", 4); |
|||
|
|||
box->newFunc("开始扫描", {}, [this](int argn, const char **args) { |
|||
ICM->callcmd0(getDeviceId(), kcode_scaner_start_scan); |
|||
}); |
|||
|
|||
box->newFunc("停止扫描", {}, [this](int argn, const char **args) { |
|||
ICM->callcmd0(getDeviceId(), kcode_scaner_stop_scan); |
|||
}); |
|||
|
|||
box->newFunc("扫描结果是否准备好", {}, [this](int argn, const char **args) { |
|||
ICM->callcmd0(getDeviceId(), kcode_scaner_result_is_ready); |
|||
ZQUI::ins()->ishow("ready:%d", ICM->getAck(0)); |
|||
}); |
|||
|
|||
box->newFunc("读取扫描结果", {}, [this](int argn, const char **args) { |
|||
ICM->callcmd0(getDeviceId(), kcode_scaner_read_scaner_result); |
|||
|
|||
uint8_t *resultbuf = ICM->getAckBuf(); |
|||
int32_t resultlen = ICM->getAckBufLen(); |
|||
|
|||
ZQUI::ins()->ishow("result:%s(%d)", string(resultbuf, resultbuf + resultlen).c_str(), resultlen); |
|||
}); |
|||
} |
|||
|
|||
/***********************************************************************************************************************
|
|||
* 寄存器操作 * |
|||
***********************************************************************************************************************/ |
|||
{ |
|||
ZRegTableList *tableBox = new ZRegTableList(tab, "寄存器操作"); |
|||
tableBox->initializeRegOperation( |
|||
[this](int32_t add, int32_t val) { //
|
|||
ICM->writereg(getDeviceId(), add, val); |
|||
return true; |
|||
}, |
|||
[this](int32_t add, int32_t *val) { //
|
|||
ICM->readreg(getDeviceId(), add, val); |
|||
return true; |
|||
}); |
|||
|
|||
tableBox->addReg("mod-version", kreg_module_version, ZRegItem::krw | ZRegItem::kdec); |
|||
tableBox->addReg("mod-type", kreg_module_type, ZRegItem::krw | ZRegItem::kdec); |
|||
tableBox->addReg("mod-status", kreg_module_status, ZRegItem::krw | ZRegItem::kdec); |
|||
tableBox->addReg("mod-errorcode", kreg_module_errorcode, ZRegItem::krw | ZRegItem::kdec); |
|||
tableBox->addSpacer(); |
|||
} |
|||
|
|||
tab->addSpacer(); |
|||
} |
@ -0,0 +1,43 @@ |
|||
#pragma once
|
|||
|
|||
#include <QDateTime>
|
|||
#include <QMainWindow>
|
|||
#include <QMessageBox>
|
|||
#include <QObject>
|
|||
#include <QtConcurrent>
|
|||
#include <QtCore/QVariant>
|
|||
#include <QtSerialPort/QSerialPort>
|
|||
#include <QtSerialPort/QSerialPortInfo>
|
|||
#include <QtWidgets/QAction>
|
|||
#include <QtWidgets/QApplication>
|
|||
#include <QtWidgets/QComboBox>
|
|||
#include <QtWidgets/QFormLayout>
|
|||
#include <QtWidgets/QGridLayout>
|
|||
#include <QtWidgets/QGroupBox>
|
|||
#include <QtWidgets/QHBoxLayout>
|
|||
#include <QtWidgets/QLabel>
|
|||
#include <QtWidgets/QLineEdit>
|
|||
#include <QtWidgets/QMainWindow>
|
|||
#include <QtWidgets/QMenu>
|
|||
#include <QtWidgets/QMenuBar>
|
|||
#include <QtWidgets/QPushButton>
|
|||
#include <QtWidgets/QSpacerItem>
|
|||
#include <QtWidgets/QStatusBar>
|
|||
#include <QtWidgets/QTabWidget>
|
|||
#include <QtWidgets/QTextBrowser>
|
|||
#include <QtWidgets/QTextEdit>
|
|||
#include <QtWidgets/QVBoxLayout>
|
|||
#include <QtWidgets/QWidget>
|
|||
//
|
|||
#include <functional>
|
|||
|
|||
namespace iflytop { |
|||
using namespace std; |
|||
|
|||
class CodeScanerTab { |
|||
public: |
|||
static CodeScanerTab *inst(); |
|||
|
|||
void construct(QTabWidget *fathertab); |
|||
}; |
|||
} // namespace iflytop
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue