Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of Qt controller management?

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "what is the method of Qt controller management". In the daily operation, I believe that many people have doubts about the method of Qt controller management. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what is the method of Qt controller management?" Next, please follow the editor to study!

I. Preface

Controller management is mainly to add, delete and modify the controller, including number, port name, controller name, controller address, controller model, number of detectors. The port name indicates which port the current controller belongs to. There can be many ports in a system, one port can correspond to multiple controllers, and one controller can receive multiple detectors. The parameter of the number of detectors is mainly convenient when sending data, knowing in advance how many detectors are to be taken and forming the corresponding data packets to send down, which can avoid invalid data. For example, there are 16 detectors below. There is no need to take the data of 255 detectors, and it is meaningless to get them. After all, the rest are all zero, and it also increases the burden of bus communication. Junk data occupies the bus channel.

There is no storage interval between the communication port and the controller information, and only the detector at the end of the node needs to have a storage interval. Each detector node can set a different storage interval as needed. The communication interaction of this system is communicating with the controller under the communication port. Once the controller is offline, all the detectors under the controller are offline, once the port is down. Then all the controllers under the port are offline and cascaded layer by layer.

II. Functional features

Collect data port, support serial port + network port, serial port support free setting of serial number + baud rate, network support free setting of IP address + communication port, each port supports collection cycle, default one address per second, support setting communication timeout times, default 3 times, support maximum reconnection time, used to re-read offline devices.

Controller information, you can add the controller name, select the controller address + controller model, and set the number of detectors under the controller.

Detector information, can add tag, free to choose detector type, gas type, gas symbol, high reported value, low reported value, buffer value, clear zero value, whether enabled, alarm sound, background map, storage cycle, numerical conversion decimal places, alarm delay time, alarm type (HH,LL,HL) and so on.

Controller model + detector type + gas type + gas symbol, all can be configured freely.

Maps can be imported and deleted, and all detectors can be dragged and saved freely.

Port information + controller information + detector information, support import and export + export to excel+ printing.

Run record + alarm record + user record, support multi-condition combination query, such as time period + controller + detector, etc., all records can be exported to excel+ printing.

Records exported to excel support all versions of table files such as excel+wps and do not rely on software such as excel.

You can delete data within a specified time range, support automatic cleaning of early data, and set the maximum number of saved records.

Support alarm short message forwarding, support multiple receiving mobile phone numbers, you can set the sending interval, such as instant sending or sending all alarm messages once every 6 hours, the text message content is too long, automatically split multiple text messages.

Support alarm email forwarding, support multiple receiving mailboxes, can set sending interval, such as immediate sending or sending all alarm messages once every 6 hours, support attachment sending.

Overreport color + underreport color + normal color + 0 value color + curve background + curve color, etc., are free to choose.

The Chinese title + English title + logo path + copyright of the software can be set freely.

Provide switch settings for boot operation + alarm sound + automatic login + remember password and so on.

Alarm sound can be set to play the number of times, the interface provides 17 kinds of skin file selection.

Cloud data synchronization is supported, and the information of cloud database can be set, such as database name, user name + password, etc.

Support network forwarding and network reception, after the network reception is turned on, the software receives data from udp for analysis. Network forwarding supports multiple target IP, so it realizes the software of local collection, and freely transfers the data to the client to view the detector data at any time.

Automatically remember the user's last stay in the interface + other information, restart and apply automatically.

The alarm automatically switches to the corresponding map, and the detector button flashes.

Double-click the detector icon to control it back.

Support user rights management, administrator + operator two categories, user login + user exit, can remember the password and automatic login, more than three error messages and close the program.

Support four monitoring modes, equipment panel monitoring + map monitoring + table data monitoring + curve data monitoring, free to switch, four synchronous applications.

Support alarm relay linkage, a tag can link multiple modules and relay numbers across serial ports, and support many-to-many.

The local data store supports sqlite+mysql and remote data synchronization to the cloud database. Automatically reconnect.

The data collected by the local device is uploaded to the cloud in real time so that it can be extracted by other methods such as APP or web.

Two kinds of data sources are supported, one is serial port and network to collect equipment data through protocol, the other is database collection. The database acquisition mode can be used as a general system.

Comes with a device simulation tool that supports 16 device data simulations, as well as database data simulations to test data when there is no device.

The default communication protocol uses modbus protocol, and later increases the support of mqtt and other Internet of things protocols to make a general system.

Supports all windows operating systems + linux operating systems and other operating systems.

Third, effect picture

Core code # include "frmconfigdevice.h" # include "ui_frmconfigdevice.h" # include "quiwidget.h" # include "dbhelper.h" # include "dbdelegate.h" # include "excelapi.h" # include "printapi.h" # include "api.h" frmConfigDevice::frmConfigDevice (QWidget * parent): QWidget (parent), ui (new Ui::frmConfigDevice) {ui- > setupUi (this); this- > initForm (); this- > initData (); this- > changeStyle () } frmConfigDevice::~frmConfigDevice () {delete ui;} void frmConfigDevice::showEvent (QShowEvent *) {model- > select ();} void frmConfigDevice::initForm () {API::initTableView (ui- > tableView); ui- > widgetTop- > setProperty ("flag", "navbtn"); if (QUIHelper::deskWidth ()

< 1440) { ui->

LabTip- > setText ("prompt → to restart the application");} else {ui- > labTip- > setText ("prompt that the → must be consistent with the field controller information, and restart the application after the change");}} void frmConfigDevice::initData () {model = new QSqlTableModel (this); model- > setTable ("DeviceInfo"); model- > setSort (0, Qt::AscendingOrder); model- > setEditStrategy (QSqlTableModel::OnManualSubmit) Model- > select (); ui- > tableView- > setModel (model); ui- > tableView- > setProperty ("model", true); columnNames.clear (); columnNames setItemDelegateForColumn (3, d_cbox_deviceAddr); / / Controller model delegation, associated controller model, drop-down change right value change d_cbox_deviceType = new DbDelegate (this); connect (d_cbox_deviceType, SIGNAL (valueChanged (QString)), this, SLOT (typeValueChanged (QString) SetDelegateType ("QComboBox"); ui- > tableView- > setItemDelegateForColumn (4, d_cbox_deviceType); deviceTypeChanged (); / / the number of detectors is entrusted with DbDelegate * d_txt_nodeNumber = new DbDelegate (this); if (App::WorkMode = = 0) {ditertxtroomnodeNumber-> setDelegateEnable (false) } else {connect (d_txt_nodeNumber, SIGNAL (valueChanged (QString)), this, SLOT (numberValueChanged (QString);} / / connect (d_txt_nodeNumber, SIGNAL (valueChanged (QString)), this, SLOT (numberValueChanged (QString); ui- > tableView- > setItemDelegateForColumn (5, d_txt_nodeNumber); / / used to switch styles and automatically change colors delegates = 0) {nodeNumber = DBData::TypeInfo_NodeNumber.at (index) } int row = ui- > tableView- > currentIndex (). Row (); model- > setData (model- > index (row, 5), nodeNumber);} void frmConfigDevice::numberValueChanged (const QString & value) {/ / determine whether the maximum value entered exceeds int row = ui- > tableView- > currentIndex (). Row (); QString deviceType = model- > index (row, 4). Data (). ToString (); int index = DBData::TypeInfo_DeviceType.indexOf (deviceType) If (index > = 0) {int nodeNumber = DBData::TypeInfo_NodeNumber.at (index); if (value.toInt () > nodeNumber) {model- > setData (model- > index (row, 5), nodeNumber); QUIHelper::showMessageBoxError (QString ("current controller maximum number of detectors is% 1!\ nPlease re-enter!") .arg (nodeNumber) } void frmConfigDevice::on_btnAdd_clicked () {int count = model- > rowCount (); model- > insertRow (count); int deviceID = model- > index (count-1,0). Data (). ToInt () + 1; QString portName = model- > index (count-1,1). Data (). ToString (); QString deviceName = model- > index (count-1,2). Data (). ToString () Int deviceAddr = model- > index (count-1,3). Data (). ToInt () + 1; QString deviceType = model- > index (count-1,4). Data (). ToString (); int nodeNumber = model- > index (count-1,5). Data (). ToInt (); if (deviceName.endsWith ("# dispatching Room Controller") {deviceName = QString ("% dispatching Room Controller") .arg (deviceAddr) } / / set the first piece of data, if (count = = 0) {deviceID = 1; portName = DBData::PortInfo_Count > 0 without the previous reference data? DBData::PortInfo_PortName.first (): "Communication port-1"; deviceName = "dispatching room controller"; deviceAddr = 1; deviceType = "FC-1003-8"; nodeNumber = 8; if (App::WorkMode = = 2) {deviceName = "default controller"; deviceType = "WF-1000"; nodeNumber = 16 }} / / set the newly added row defaults model- > setData (model- > index (count, 0), deviceID); model- > setData (model- > index (count, 1), portName); model- > setData (model- > index (count, 2), deviceName); model- > setData (model- > index (count, 3), deviceAddr); model- > setData (model- > index (count, 4), deviceType); model- > setData (model- > index (count, 5), nodeNumber) Ui- > tableView- > setCurrentIndex (model- > index (count, 0));} void frmConfigDevice::on_btnSave_clicked () {model- > database (). Transaction (); if (model- > submitAll ()) {model- > database (). Commit (); DBHelper::loadDeviceInfo (); / / the controller name emit deviceNameChanged () that synchronizes the probe table first;} else {model- > database (). Rollback () QUIHelper::showMessageBoxError ("failed to save information, information cannot be empty, please fill in again!");}} void frmConfigDevice::on_btnDelete_clicked () {if (ui- > tableView- > currentIndex () .row ()

< 0) { QUIHelper::showMessageBoxError("请选择要删除的控制器!"); return; } if (QUIHelper::showMessageBoxQuestion("确定要删除该控制器吗? 控制器对应的所有探测器都会被删除!") == QMessageBox::Yes) { int row = ui->

TableView- > currentIndex (). Row (); QString deviceName = model- > index (row, 2). Data (). ToString (); DBHelper::deleteNodeInfo (deviceName); model- > removeRow (row); model- > submitAll (); int count = model- > rowCount (); ui- > tableView- > setCurrentIndex (model- > index (count-1,0);} void frmConfigDevice::on_btnReturn_clicked () {model- > revertAll () } void frmConfigDevice::on_btnClear_clicked () {int count = model- > rowCount (); if (count select ();}} void frmConfigDevice::on_btnExcel_clicked () {QString name = "controller information"; QString fileName = QString ("% 1% 2") .arg (name) .arg (QDateTime::currentDateTime (). ToString ("yyyy-MM-dd-HH-mm-ss")) QString file = API::getSaveFileNames (fileName, "Excel (* .xls)"); if (file.isEmpty ()) {return;} QString columns = "DeviceID,PortName,DeviceName,DeviceAddr,DeviceType,NodeNumber"; QString where = "order by DeviceID asc"; QStringList content = DBHelper::getContent ("DeviceInfo", columns, where, "", ";"); int rowCount = content.count () If (rowCount = = 0) {QUIHelper::showMessageBoxError ("No data to be processed!"); return;} ExcelAPI::Instance ()-> saveExcel (file, name, name, ", columnNames, columnWidths, content); QString msg = QString (" Export% 1 to Excel ") .arg (name); DBHelper::addUserLog (" user actions ", msg); if (QUIHelper::showMessageBoxQuestion (msg +" success! Are you sure you want to open it now?) = QMessageBox::Yes) {QString url = QString ("file:///%1").arg(file); QDesktopServices::openUrl (QUrl (url, QUrl::TolerantMode));}} void frmConfigDevice::on_btnPrint_clicked () {QString name =" Controller Information "; QString columns =" DeviceID,PortName,DeviceName,DeviceAddr,DeviceType,NodeNumber "; QString where =" order by DeviceID asc " QStringList content = DBHelper::getContent ("DeviceInfo", columns, where, "", ";); int rowCount = content.count (); if (rowCount = = 0) {QUIHelper::showMessageBoxError (" No data to be processed! "); return;} PrintAPI::Instance ()-> print (name,", columnNames, columnWidths, content); QString msg = QString (" print% 1 ") .arg (name) DBHelper::addUserLog ("user Action", msg);} void frmConfigDevice::on_btnInput_clicked () {QString fileName; bool ok = DBHelper::inputData (columnNames.count (), App::FileFilter, "DeviceInfo", fileName, QUIHelper::appPath () + "/ db", true); if (! fileName.isEmpty ()) {DBHelper::addUserLog ("user Action", "Import Controller Information") If (ok) {QUIHelper::showMessageBoxInfo ("import controller information successfully!", 3); model- > select ();} else {QUIHelper::showMessageBoxError ("failed to import controller information!", 3);} void frmConfigDevice::on_btnOutput_clicked () {QString columns = "*"; QString where = "order by DeviceID asc" QString title = columnNames.join (App::FileSpliter); QStringList content = DBHelper::getContent ("DeviceInfo", columns, where, title); QString fileName; bool ok = DBHelper::outputData ("Controller Information", App::FileFilter, content, fileName, QUIHelper::appPath () + "/ db"); if (! fileName.isEmpty ()) {DBHelper::addUserLog ("user actions", "Export Controller Information") If (ok) {QUIHelper::showMessageBoxInfo ("exporting controller information successfully!", 3);} else {QUIHelper::showMessageBoxError ("failed to export controller information!", 3);} at this point, the study on "what is the method of Qt controller management" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report