commit 1a300f4ca7862cfbb675973b816bae7c45fa24e3 Author: typingbugs Date: Sun Jul 28 22:47:24 2024 +0800 完成设置页面和退出页面,开卡页面的画图 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4a0b530 --- /dev/null +++ b/.gitignore @@ -0,0 +1,74 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/CardManageSystem.pro b/CardManageSystem.pro new file mode 100644 index 0000000..228b012 --- /dev/null +++ b/CardManageSystem.pro @@ -0,0 +1,44 @@ +QT += core gui sql + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +CONFIG += c++17 + +# You can make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + main.cpp \ + mainwindow.cpp + +HEADERS += \ + HF15693.h \ + mainwindow.h \ + newCardPage.h \ + quitAppPage.h \ + readerAPI.h \ + settingPage.h + +FORMS += \ + mainwindow.ui + +TRANSLATIONS += \ + CardManageSystem_zh_CN.ts +CONFIG += lrelease +CONFIG += embed_translations + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +DISTFILES += \ + HF15693.dll \ + HF15693.lib + +win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../release/ -lHF15693 +else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../debug/ -lHF15693 +else:unix: LIBS += -L$$PWD/../ -lHF15693 + +LIBS += -L. -lHF15693 diff --git a/CardManageSystem_zh_CN.ts b/CardManageSystem_zh_CN.ts new file mode 100644 index 0000000..630fd35 --- /dev/null +++ b/CardManageSystem_zh_CN.ts @@ -0,0 +1,3 @@ + + + diff --git a/HF15693.h b/HF15693.h new file mode 100644 index 0000000..64fe3c8 --- /dev/null +++ b/HF15693.h @@ -0,0 +1,195 @@ +// 下列 ifdef 块是创建使从 DLL 导出更简单的 +// 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 HF15693_EXPORTS +// 符号编译的。在使用此 DLL 的 +// 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将 +// HF15693_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的 +// 符号视为是被导出的。 +#ifndef __HF15693_H__ +#define __HF15693_H__ + +#ifdef HF15693_EXPORTS +#define HF15693_API __declspec(dllexport) +#else +#define HF15693_API __declspec(dllimport) +#endif + + +#define OP_RESPONSE_FLAG_ERROR 0x01 +#define OP_RESPONSE_FLAG_EXTENSION 0x08 + +#define DATA_LEN 256 +#define MAX_UID 32 +#define UID_LEN 68 +#define DSFID_LEN 4 +#define CMD_LEN 2048 + +// 15693命令代码 +#define CC_INVENTORY "01" +#define CC_QUIET "02" +#define CC_READ_SB "20" +#define CC_WRITE_SB "21" +#define CC_LOCK "22" +#define CC_READ_MP "23" +#define CC_WRITE_MP "24" +#define CC_SELECT "25" +#define CC_READY "26" +#define CC_WRITE_API "27" +#define CC_LOCK_API "28" +#define CC_WRITE_DSFID "29" +#define CC_LOCK_DSFID "2A" +#define CC_GET_INFO "2B" +#define CC_GET_SEC_STAT "2C" + +//命令字 +#define INVENTORY 0 +#define READ_SB 1 +#define WRITE_SB 2 +#define LOCK_B 3 +#define READ_MB 4 +#define WRITE_MB 5 +#define QUIET 6 +#define SELECT 7 +#define READY 8 +#define WRITE_AFI 9 +#define LOCK_AFI 10 +#define WRITE_DSFID 11 +#define LOCK_DSFID 12 +#define T15SYSTEM_INFO 13 +#define MBS_STATUS 14 +#define PROTOCOL 15 +#define FLAG 16 +#define SET 17 + +#ifdef __cplusplus +extern "C" { +#endif + +extern HF15693_API int t15bDataCoding /*数据编码:0 - 1/4; 1 - 1/256*/, t15bFullPower /*全功率*/, t15bSubCarrier /*副载波*/, + t15bDataRate /*高数据率*/, + t15bInventory /*盘点标志*/, t15bSelect /*选择标志/AFI标志*/, t15bAddress /*地址标志/槽数据标志*/, + t15bOption /*可选标志*/; + +extern HF15693_API char t15UID[UID_LEN], t15FirstBN[3], t15NumBl[3], t15Data[DATA_LEN], + t15DSFID[DSFID_LEN], t15AFI[5]; + +// 与字节序相关的函数,在函数内部不处理,需使用者自行处理 + +////////////////////////////// +//工具函数 +/********************************************* +/* 描述:打开串口 +/* 输入:串口号,如若打开com1,则参数为 1 +/* 输出:无 +/* 返回:true 打开成功;false 打开失败 +/* 其他: +/*********************************************/ +HF15693_API bool t15portOpen(int comno); + +/********************************************* +/* 描述:关闭串口 +/* 输入:无 +/* 输出:无 +/* 返回:true 关闭成功;false 关闭失败 +/* 其他: +/*********************************************/ +HF15693_API bool t15portClose(); + +/********************************************* +/* 描述:设置协议 +/* 输入:无 +/* 输出:无 +/* 返回: 0 设置成功; ~0 设置失败 +/* 其他: +/*********************************************/ +HF15693_API int t15setProtocol(); + +/********************************************* +/* 描述:执行命令 +/* 输入:cmdno - 命令字 +/* 输出:cmdstr - 向下发出的命令字段;reply - 对命令回复的字段 +/* 返回:(int) 命令回复字段中的有效字节数 +/* 其他: +/*********************************************/ +HF15693_API int t15execute(int cmdno, char *cmdstr,char *reply); + +///////////////////////////////////// + +/********************************************* +/* 描述:从一个字串中提取一个表示十六进制数字的子串,子串间以',' '[' 分隔 +/* 输入: str - 原字串 +/* 输出: str - 指向原串中提取到的子串的下一下字符, word - 提取到的子串 +/* 返回: 0 - 成功 , 1 - 失败 +/* 其他: +/*********************************************/ +HF15693_API int getXWord (char **str, char *word); + +/********************************************* +/* 描述:从一个字串中提取一个表示十六进制数字的子串,子串间以',' '[' 分隔 +/* 输入: str - 原字串 +/* 输出: word - 提取到的子串 +/* 返回: +/* 其他: +/*********************************************/ +HF15693_API int getXWord2 ( char *str, char *word); + +/********************************************* +/* 描述:更改字节序 +/* 输入:pin - 原字串 , lenbytes - 字串数据长度 +/* 输出:pout - 更改字节序后的字串 +/* 返回:无 +/* 其他:此函数会在pout后补0,使用者须保证其长度。 +/* 如,字串"123456" 更改字节序后变为 "563412" +/*********************************************/ +HF15693_API void t15changeByteOrder(char *pout,const char *pin,int lenbytes); + +/********************************************* +/* 描述:更改带块安全状态信息(block security status)的字串的字节序 +/* 输入:pin - 原字串 , lenbytes - 字串数据长度,不包含'块安全状态信息'的长度 +/* 输出:sbss - 原字串中的bss值 ,pout - 更改字节序后的字串 +/* 返回:无 +/* 其他:字串的存储空间由使用者保证,会在pout后补0;sbss是用字串表示的一个字节的十六进制数 +/*********************************************/ +HF15693_API void t15changeByteOrder2(char *sbss,char *pout, char *pin,int lenbytes); + +/********************************************* +/* 描述:更改字串的字节序,字串包含多个块的数据 +/* 输入:pin - 原字串 , numblocks - 原字串中包含的块数目 +/* 输出:pout - 更改字节序后的字串 +/* 返回:无 +/* 其他:每个块数据长度由pin长度和numblocks决定;会在pout后补0 +/*********************************************/ +HF15693_API void t15changeByteOrder_MB(char *pout, char *pin, int numblocks); + +/********************************************* +/* 描述:更改带块安全状态信息(block security status)的字串的字节序,字串包含多个块的数据 +/* 输入:pin - 原字串;lenbytes - 字串数据长度,不包含'块安全状态信息'的长度; numblocks - 原字串中包含的块数目 +/* 输出:mbss - 原字串中的bss值 ,pout - 更改字节序后的字串 +/* 返回:无 +/* 其他:各个块的bss依次存放于mbss中,多个块的数据依次存放于pout中 +/*********************************************/ +HF15693_API void t15changeByteOrder_MB2(char *mbss,char *pout, char *pin,int lenbytes, int numblocks); + +/********************************************* +/* 描述:解析返回的RSSI值 +/* 输入:字串表示的RSSI +/* 输出:无 +/* 返回:指向解析过的RSSI信息的内存块 +/* 其他:返回的指针指向的内存由函数分配管理 +/*********************************************/ +HF15693_API char* t15hex2rssi (char *str); + +/********************************************* +/* 描述:解析标签信息字串 +/* 输入:data - 原标签信息字串;flag - 标签信息标志 +/* 输出:(其他参数) +/* 返回:0 +/* 其他: +/*********************************************/ +HF15693_API int t15getTagSysInfo (char *data, const unsigned char flag,char *uid, char *dsfid, char *afi, + char *blSize, char *numBl, char *ic); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/HF15693.lib b/HF15693.lib new file mode 100644 index 0000000..a692b21 Binary files /dev/null and b/HF15693.lib differ diff --git a/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug/debug/qmake_qmake_qm_files.qrc b/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug/debug/qmake_qmake_qm_files.qrc new file mode 100644 index 0000000..047b309 --- /dev/null +++ b/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug/debug/qmake_qmake_qm_files.qrc @@ -0,0 +1,5 @@ + + +D:/Courseware/Integrated_Practice_of_IoT_System/CardManageSystem/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug/debug/CardManageSystem_zh_CN.qm + + diff --git a/doc/source/.$ER.drawio.bkp b/doc/source/.$ER.drawio.bkp new file mode 100644 index 0000000..1c4cb18 --- /dev/null +++ b/doc/source/.$ER.drawio.bkp @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/source/ER.drawio b/doc/source/ER.drawio new file mode 100644 index 0000000..53608a7 --- /dev/null +++ b/doc/source/ER.drawio @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..b5923bd --- /dev/null +++ b/main.cpp @@ -0,0 +1,23 @@ +#include "mainwindow.h" + +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + + QTranslator translator; + const QStringList uiLanguages = QLocale::system().uiLanguages(); + for (const QString &locale : uiLanguages) { + const QString baseName = "CardManageSystem_" + QLocale(locale).name(); + if (translator.load(":/i18n/" + baseName)) { + a.installTranslator(&translator); + break; + } + } + MainWindow w; + w.show(); + return a.exec(); +} diff --git a/mainwindow.cpp b/mainwindow.cpp new file mode 100644 index 0000000..295c184 --- /dev/null +++ b/mainwindow.cpp @@ -0,0 +1,47 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" +#include "settingPage.h" +#include "quitAppPage.h" +#include "newCardPage.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui::MainWindow) +{ + ui->setupUi(this); + + // 工具栏设置 + addToolBar(Qt::LeftToolBarArea, ui->toolBar); + ui->toolBar->setAllowedAreas(Qt::LeftToolBarArea | Qt::RightToolBarArea); + ui->toolBar->setFloatable(false); + ui->toolBar->setMovable(false); + + // 状态栏设置 + ui->statusBar->setStyleSheet(QString("QStatusBar::item{border: 0px}")); + + readerConnectStatusCheckBox = new QCheckBox(); + readerConnectStatusCheckBox->setChecked(false); + ui->statusBar->addWidget(readerConnectStatusCheckBox); + + comNumberLabel = new QLabel("当前无连接"); + ui->statusBar->addWidget(comNumberLabel); + + databaseConnectStatusCheckBox = new QCheckBox(); + databaseConnectStatusCheckBox->setChecked(false); + ui->statusBar->addWidget(databaseConnectStatusCheckBox); + + databaseLabel = new QLabel("数据库无连接"); + ui->statusBar->addWidget(databaseLabel); + + deviceLabel = new QLabel(device); + ui->statusBar->addWidget(deviceLabel); + + ui->stackedWidget->setCurrentWidget(ui->settingPage); +} + + +MainWindow::~MainWindow() +{ + delete ui; +} + diff --git a/mainwindow.h b/mainwindow.h new file mode 100644 index 0000000..43c1afa --- /dev/null +++ b/mainwindow.h @@ -0,0 +1,62 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include +#include +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE +namespace Ui { +class MainWindow; +} +QT_END_NAMESPACE + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = nullptr); + ~MainWindow(); + + void updateStatusBarComNumber(); + bool ready(); + +private slots: + void on_settingAction_triggered(); + void on_quitAppAction_triggered(); + void on_NewCardAction_triggered(); + + void on_connectReaderButton_clicked(); + void on_confirmQuitButton_clicked(); + void on_connectDatabaseButton_clicked(); + void on_inventoryButton_clicked(); + + + +private: + Ui::MainWindow *ui; + Reader reader; + QSqlDatabase db; + QString databaseIpAddr = ""; + int databasePort = 3306; + QString databasePassword = ""; + QString device = QString("未指定设备名"); + bool depositAllowed = false; + + QStatusBar *statusBar; + QStackedWidget *stackedWidget; + + QCheckBox *readerConnectStatusCheckBox; + QLabel *comNumberLabel; + QCheckBox *databaseConnectStatusCheckBox; + QLabel *databaseLabel; + QLabel *deviceLabel; +}; +#endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui new file mode 100644 index 0000000..2fac4c6 --- /dev/null +++ b/mainwindow.ui @@ -0,0 +1,441 @@ + + + MainWindow + + + + 0 + 0 + 708 + 493 + + + + MainWindow + + + + + + -50 + -40 + 701 + 481 + + + + true + + + 2 + + + + + + 310 + 260 + 80 + 23 + + + + 确认 + + + + + + 270 + 180 + 161 + 51 + + + + 确认退出应用吗? + + + Qt::AlignmentFlag::AlignCenter + + + + + + + + 240 + 70 + 229 + 118 + + + + + + + + Microsoft JhengHei UI + 11 + false + + + + 连接读卡器 + + + Qt::AlignmentFlag::AlignCenter + + + + + + + + + 选择端口:COM + + + + + + + + 80 + 20 + + + + + 9 + + + + 3 + + + + + + + + + + + 直连模式 + + + true + + + true + + + + + + + + + + + 320 + 200 + 80 + 23 + + + + 连接 + + + + + + 250 + 260 + 231 + 159 + + + + + + + + Microsoft JhengHei UI + 11 + false + + + + 连接数据库 + + + Qt::AlignmentFlag::AlignCenter + + + + + + + + + + + 端口: + + + + + + + 172.29.68.245 + + + + + + + IP地址: + + + + + + + 密码: + + + + + + + + 80 + 20 + + + + + 9 + + + + 1024 + + + 65534 + + + 3306 + + + + + + + + + + 设备名: + + + + + + + + + + + + + + + + 330 + 430 + 80 + 23 + + + + 连接 + + + + + + + + 210 + 130 + 347 + 84 + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + + + + 卡号: + + + + + + + 学/工号: + + + + + + + 查询 + + + + + + + + + 300 + 230 + 80 + 23 + + + + 开卡 + + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + + + toolBar_2 + + + LeftToolBarArea + + + false + + + + + + + + + + + + 设置 + + + QAction::MenuRole::NoRole + + + + + 退出 + + + QAction::MenuRole::NoRole + + + + + 消费 + + + QAction::MenuRole::NoRole + + + + + 开卡 + + + QAction::MenuRole::NoRole + + + + + 查询 + + + QAction::MenuRole::NoRole + + + + + 充值 + + + QAction::MenuRole::NoRole + + + + + 挂失 + + + QAction::MenuRole::NoRole + + + + + + diff --git a/newCardPage.h b/newCardPage.h new file mode 100644 index 0000000..1663aca --- /dev/null +++ b/newCardPage.h @@ -0,0 +1,35 @@ +#ifndef NEWCARDPAGE_H +#define NEWCARDPAGE_H + +#include "mainwindow.h" +#include "ui_mainwindow.h" + + +/* + * 功能:切换到开卡页面 + * 触发:点击工具栏的“开卡” +*/ +void MainWindow::on_NewCardAction_triggered() +{ + if (!ready()) + { + QMessageBox::warning(this, QString("提示"), QString("读卡器或数据库未连接,请设置。")); + ui->stackedWidget->setCurrentWidget(ui->settingPage); + return; + } + + ui->stackedWidget->setCurrentWidget(ui->newCardPage); +} + + +/* + * 功能:读卡器扫描卡片 + * 触发:点击开卡页面的“查询” +*/ +void MainWindow::on_inventoryButton_clicked() +{ + +} + + +#endif // NEWCARDPAGE_H diff --git a/quitAppPage.h b/quitAppPage.h new file mode 100644 index 0000000..49da04e --- /dev/null +++ b/quitAppPage.h @@ -0,0 +1,28 @@ +#ifndef QUITAPPPAGE_H +#define QUITAPPPAGE_H + +#include "mainwindow.h" +#include "ui_mainwindow.h" + + +/* + * 功能:切换到退出页面 + * 触发:点击工具栏的“退出” +*/ +void MainWindow::on_quitAppAction_triggered() +{ + ui->stackedWidget->setCurrentWidget(ui->quitAppPage); +} + + +/* + * 功能:退出程序 + * 触发:在退出页面点击“确认”按钮 +*/ +void MainWindow::on_confirmQuitButton_clicked() +{ + this->close(); +} + + +#endif // QUITAPPPAGE_H diff --git a/readerAPI.h b/readerAPI.h new file mode 100644 index 0000000..c3b3e2a --- /dev/null +++ b/readerAPI.h @@ -0,0 +1,43 @@ +#ifndef READERAPI_H +#define READERAPI_H + +#include + + +class Reader +{ +private: + int comNumber = -1; // com口号,若未连接为-1 + +public: + bool is_connected() + { + return comNumber > 0; + } + + bool connectReader() + { + if (t15portOpen(comNumber)) + { + return true; + } + else + { + comNumber = -1; + return false; + } + } + + void setComNumber(int comNumber) + { + this->comNumber = comNumber; + } + + int getComNumber() + { + return comNumber; + } +}; + + +#endif // READERAPI_H diff --git a/settingPage.h b/settingPage.h new file mode 100644 index 0000000..74080fa --- /dev/null +++ b/settingPage.h @@ -0,0 +1,118 @@ +#ifndef SETTINGPAGE_H +#define SETTINGPAGE_H + +#include "mainwindow.h" +#include "ui_mainwindow.h" + + +/* + * 功能:切换到设置页面 + * 触发:点击工具栏的“设置” +*/ +void MainWindow::on_settingAction_triggered() +{ + ui->stackedWidget->setCurrentWidget(ui->settingPage); +} + + +/* + * 功能:设置连接的读卡器的COM口号并更新状态栏的相应内容 + * 输入:要设置的COM口号 + * 返回:无 +*/ +void MainWindow::updateStatusBarComNumber() +{ + if (reader.is_connected()) + { + readerConnectStatusCheckBox->setChecked(true); + QString s = "已连接读卡器COM:" + QString::number(reader.getComNumber()); + comNumberLabel->setText(s); + } + else + { + readerConnectStatusCheckBox->setChecked(false); + QString s = "当前无连接"; + comNumberLabel->setText(s); + } +} + + +/* + * 功能:连接读卡器 + * 触发:在设置页面的连接读卡器部分点击“连接”按钮 +*/ +void MainWindow::on_connectReaderButton_clicked() +{ + int comNumber = ui->comNumberBox->value(); + reader.setComNumber(comNumber); + bool connectSuccess = reader.connectReader(); + + if (!connectSuccess) { + QString warningMessage = QString("COM") + QString::number(comNumber); + warningMessage += QString("上未识别到读卡器。\n请输入正确的COM口号。"); + QMessageBox::warning(this, "读卡器状态提示", warningMessage); + } + + updateStatusBarComNumber(); +} + + +/* + * 功能:连接数据库并检查设备名 + * 触发:在设置页面的连接数据库部分点击“连接”按钮 +*/ +void MainWindow::on_connectDatabaseButton_clicked() +{ + databaseIpAddr = ui->ipAddrEdit->text(); + databasePort = ui->portBox->value(); + databasePassword = ui->passwordEdit->text(); + + db = QSqlDatabase::addDatabase("QMYSQL"); + db.setHostName(databaseIpAddr); + db.setPort(databasePort); + db.setPassword(databasePassword); + db.setDatabaseName("cardManageSystem"); + db.setUserName("cardManageSystem"); + + if (!db.open()) + { + QMessageBox::warning(this, QString("数据库状态提示"), QString("数据库连接失败,请重试。")); + databaseConnectStatusCheckBox->setChecked(false); + databaseLabel->setText(QString("数据库未连接")); + databaseIpAddr = ""; + return; + } + databaseConnectStatusCheckBox->setChecked(true); + databaseLabel->setText(QString("数据库已连接:") + databaseIpAddr + QString(":") + QString::number(databasePort)); + + device = ui->deviceEdit->text(); + QSqlQuery query; + QString sql = QString("select * from device where id = '%1';").arg(device); + query.exec(sql); + if (query.next()) + { + if (query.value(2).toBool()) depositAllowed = true; + else depositAllowed = false; + } + else + { + device = QString("未指定设备名"); + QMessageBox::warning(this, QString("设备名提示"), QString("该设备名无效,请重试。")); + } + deviceLabel->setText(device); +} + + +/* + * 功能:检查读卡器和数据库是否准备好 + * 输入:无 + * 返回:true - 已准备好 | false - 未准备好 +*/ +bool MainWindow::ready() +{ + if (!reader.is_connected() || databaseIpAddr.isEmpty()) return false; + return true; +} + + +#endif // SETTINGPAGE_H