One, foreword
Data debugging module, used to display the data of communication serial port, customize different color display, you can select filter a serial port to view data, you can also select all data, you can also select pause display check box to suspend the printing of display information. Data debugging can easily check the serial port to send and receive data, in order to verify the data communication is correct, especially can avoid some dispute problems, such as the upper machine under a machine is in accordance with the agreement on the data on both sides to write the program, but the alignment of the suddenly found not in accordance with the contract process, at this time you can open the data debugging module, See the sending and receiving data is in accordance with the specifications, sometimes perhaps under a machine is in accordance with the code to write, but the middle level interference cause data mutations, are possible, such as I once was found under a machine data wrong in a great mess, but the next bit machine program is correct, later to check the original hardware to do power isolation, As a result, there is a battery car on the same power supply plug board, resulting in interference data change, sister, at that time I wanted to pull out the battery car owner to beat first, hey hey.
Actually data debugging module also is not only to use this system, I have done most of the projects have this module, very useful, sending and receiving data can show different color, different and even can also specify the keyword filtering, once detected, according to the corresponding keyword can highlight color for general data transceiver speed is very fast, eyes sometimes look not to come over, But you can’t pause the display, you just want to grab a key piece of data. Light print to send and receive data, or not enough, the general need in data sending and receiving data coding location, at the same time the output corresponding to explain the meaning in Chinese, easier to understand and filter, such as after a polling status command, in addition to the polling state this in the form of a data signal to print out and send a Chinese analytical signal. When the final system debugging operation is correct, you can turn off the printing, improve the efficiency of the program.
Two, functional characteristics
(1) Software module
- Video monitoring module, various docking small window sub-module, including device list, graphic warning, window information, panyt control, preset position, cruise setting, device control, floating map, web browsing, etc.
- Video playback module, including local playback, remote playback, device playback, picture playback, video upload, etc.
- Electronic map module, including picture map, online map, offline map, path planning, etc.
- Log query module, including local logs, device logs, etc.
- System setting module, including system Settings (basic Settings, video parameters, database Settings, map configuration, serial port configuration, etc.), VIDEO recorder management, camera management, polling configuration, user management, etc.
(2) Basic functions
- Support various video streams (RTSP, RTMP, HTTP, etc.), video files (MP4, RMVB, AVI, etc.), local USB camera playback.
- Support multi-screen switching, including 1, 4, 6, 8, 9, 13, 16, 25, 36, 64 screen switching.
- Supports full-screen switching, including the right mouse button, toolbar button, and shortcut keys (Alt + Enter full-screen, esc exit full-screen).
- Supports video polling, including 1, 4, 9, and 16 screen polling. You can set polling group (polling plan), polling interval, and bit stream type.
- Supports the OnVIF protocol, including device search, pte control, device control (picture parameters, check time, system restart, capture pictures, etc.).
- Different users can have different module permissions, such as deleting logs and shutting down the system.
- Support a variety of databases, including sqlite, mysql, sqlserver, postgresql, oracle, rendajincang and so on.
- You can set resolution and frame rate for a local USB camera.
- All docking modules automatically generate corresponding menus to control the display and hide, in the title bar right click can pop up.
- Display all modules, hide all modules, reset the common layout, and reset the full-screen layout.
- Double-click the device to pop up real-time preview video, supporting picture map, online map, offline map, etc.
- The camera node can be dragged to the corresponding window to play the video, and the local file can be dragged to play the video.
- You can delete a video by right-clicking the mouse button, closing the floating bar, or dragging it outside the video surveillance panel.
- The device button on the picture map can be dragged freely to automatically save the location information. You can click the mouse to obtain the longitude and latitude information on the Baidu map to update the location of the device.
- Any channel in the video surveillance panel form supports drag exchange, instant response.
- Encapsulated Baidu map, view switch, movement track, equipment point, mouse click to obtain latitude and longitude.
- Double-click the node, drag the node, drag the window to switch positions and other operations, will automatically update and save the last playing address, the next software open automatic application.
- Volume bar control in the lower right corner, automatically hide when losing focus, volume strip mute icon.
- You can specify a screenshot for a single channel or all channels. The screenshot button is also available on the bottom toolbar.
- The mouse pointer can be automatically hidden when timeout expires and the mouse pointer can be automatically displayed in full screen.
- Support onVIF PTZ control, can move PTZ camera up, down, left and right, including reset and focal length adjustment.
- Support any ONVIF camera, including but not limited to Hikang, Dahua, Yushi, Weiye, Huawei, etc.
- Can save video, can select the time storage or single file storage, optional storage interval time.
- Video stream communication mode can be set TCP + UDP, video decoding can be set speed first, quality first, balance, etc.
- You can set the software name, English name, and LOGO icon.
- You can export stored video files to specific directories or upload them to servers in batches.
(3) Features and functions
- The main interface adopts the mode of docked form, various components in the form of small modules, can be customized to join any module.
- Docking module can drag any position embedded and suspended, support maximum full screen, support multi-screen.
- Dual layout file storage mechanism, normal mode and full-screen mode are corresponding to different layout schemes, automatic switching and saving, for example, full-screen mode can highlight several modules transparent display in the specified position, more science fiction sense of modernization.
- Original onVIF protocol mechanism, using the underlying protocol resolution (UDP broadcast search + HTTP request execution command) more lightweight easy to understand learning expansion, does not rely on any third-party components such as GSOAP.
- Original data import and export mechanism, cross-platform independent of any components, instant data export.
- Built in multiple original components, the universe super value super awesome, Including data import and export components (export to XLS, PDF, printing), database components (database management thread, automatic data cleaning thread, universal paging, data request, etc.), map component, video monitoring component, file multithreading transceiver component, onVIF communication component, universal browser kernel component, etc.
- Customize information box + error box + query box + lower right prompt box (including various formats).
- Exquisite skin change, up to 17 sets of skin styles can be changed at will, all styles are unified, including menu, etc.
- Multiple buttons can be added to the video control hover bar, and buttons can also be added to the small toolbar at the bottom of the monitoring interface.
- Double click the camera node to automatically play the video, double click the node to automatically add the video, it will automatically jump to the next, double click the parent node to automatically add all the videos under the node. Primary stream and sub-stream are optional.
- You can add, delete, and modify the import and export printed information, and immediately apply the new device information to generate a tree list without restarting.
- Optional a variety of kernel free switch, FFMPEG, VLC, MPV, etc., can be set in pro. Ffmpeg is recommended. It is most cross-platform and provides libraries compiled on Linux and MAC platforms by default.
- Supports hard decoding and can be set to hard decoding type (QSV, DXVA2, d3D11VA, etc.).
- The default opengL rendering video, ultra-low CPU resource consumption, support YUYV and NV12 two formats to draw, very awesome.
- Highly customizable, users can easily derive their own functions on this basis, such as adding custom modules, adding operation mode, robot monitoring, uav monitoring, excavator monitoring, etc.
- Support XP, Win7, Win10, Linux, MAC, a variety of domestic systems (UOS, kyrin, Galaxy Kyrin, etc.), embedded Linux and other systems.
- Complete annotation, clear project structure, super detailed complete use of the development manual, accurate to the function description of each code file, continuous iteration version.
3. Experience address
- Experience address: pan.baidu.com/s/1d7TH_GEY… Extraction code: 01Jf File name: bin_video_system.zip
- Domestic site: gitee.com/feiyangqing…
- International site: github.com/feiyangqing…
- Profile: blog.csdn.net/feiyangqing…
- Zhihu homepage: www.zhihu.com/people/feiy…
- Online documentation: feiyangqingyun. Gitee. IO/qwidgetdemo…
Four, effect drawing
Five, core code
#include "frmrobotdebug2.h"
#include "ui_frmrobotdebug2.h"
#include "quihelper.h"
#include "devicerobot.h"
#include "devicerobot2.h"
frmRobotDebug2::frmRobotDebug2(QWidget *parent) : QWidget(parent), ui(new Ui::frmRobotDebug2)
{
ui->setupUi(this);
this->initForm(a); } frmRobotDebug2::~frmRobotDebug2()
{
delete ui;
}
void frmRobotDebug2::initForm(a)
{
// You can change the size of the font
QFont font;
font.setPixelSize(QUIConfig::FontSize + 8);
ui->txtMain->setFont(font);
// Associate robot data sending and receiving
connect(DeviceRobot::Instance(), SIGNAL(sendData(QString, QByteArray)),
this.SLOT(sendData(QString, QByteArray)));
connect(DeviceRobot::Instance(), SIGNAL(receiveData(QString, QByteArray)),
this.SLOT(receiveData(QString, QByteArray)));
connect(DeviceRobot2::Instance(), SIGNAL(sendData(QString, QByteArray)),
this.SLOT(sendData(QString, QByteArray)));
connect(DeviceRobot2::Instance(), SIGNAL(receiveData(QString, QByteArray)),
this.SLOT(receiveData(QString, QByteArray)));
// Test data
QByteArray data = QUIHelper::hexStrToByteArray("November 22, 66, 88");
sendData(AppConfig::PortNameA, data);
sendData(AppConfig::PortNameB, data);
sendData(AppConfig::PortNameC, data);
sendData(AppConfig::PortNameD, data);
receiveData(AppConfig::PortNameA, data);
receiveData(AppConfig::PortNameB, data);
receiveData(AppConfig::PortNameC, data);
receiveData(AppConfig::PortNameD, data);
}
void frmRobotDebug2::append(int type, const QString &data, bool clear)
{
static int currentCount = 0;
static int maxCount = 100;
// Run the command to clear data
if (clear) {
ui->txtMain->clear(a); currentCount =0;
return;
}
// The number of execution entries reached the empty data
if (currentCount >= maxCount) {
ui->txtMain->clear(a); currentCount =0;
}
// Pause the display
if (ui->ckPause->isChecked()) {
return;
}
// Filter the carriage return newline character
QString strData = data;
strData.replace("\r"."");
strData.replace("\n"."");
// Different types of different color display
QString strType;
if (type == 0) {
strType = "Send";
ui->txtMain->setTextColor(QColor("#00B17D"));
} else if (type == 1) {
strType = "Send";
ui->txtMain->setTextColor(QColor("#47A4E9"));
} else if (type == 2) {
strType = "Send";
ui->txtMain->setTextColor(QColor("#22A3A9"));
} else if (type == 3) {
strType = "Send";
ui->txtMain->setTextColor(QColor("#56BEC1"));
} else if (type == 4) {
strType = "Receive";
ui->txtMain->setTextColor(QColor("#D64D54"));
} else if (type == 5) {
strType = "Receive";
ui->txtMain->setTextColor(QColor("#A279C5"));
} else if (type == 6) {
strType = "Receive";
ui->txtMain->setTextColor(QColor("#FD8B28"));
} else if (type == 7) {
strType = "Receive";
ui->txtMain->setTextColor(QColor("#D98078"));
}
strData = QString([% 2] "% 1: % 3").arg(TIMEMS).arg(strType).arg(strData);
ui->txtMain->append(strData);
currentCount++;
}
bool frmRobotDebug2::checkNotPrint(const QString &portName, int &type, QString &flag)
{
type = 0;
flag = QString(Serial port "A");
if (portName == AppConfig::PortNameB) {
type = 1;
flag = QString("A serial port B");
} else if (portName == AppConfig::PortNameC) {
type = 2;
flag = QString("Serial C");
} else if (portName == AppConfig::PortNameD) {
type = 3;
flag = QString(Serial port "D");
}
// Do not print the serial port that is not selected
QString port = ui->cboxPort->currentText(a);boolnotPrintA = (portName == AppConfig::PortNameA && flag ! = port);boolnotPrintB = (portName == AppConfig::PortNameB && flag ! = port);boolnotPrintC = (portName == AppConfig::PortNameC && flag ! = port);boolnotPrintD = (portName == AppConfig::PortNameD && flag ! = port);if (port == "All serial ports") {
notPrintA = notPrintB = notPrintC = notPrintD = false;
}
return (notPrintA || notPrintB || notPrintC || notPrintD);
}
void frmRobotDebug2::sendData(const QString &portName, const QByteArray &data)
{
int type;
QString flag;
if (checkNotPrint(portName, type, flag)) {
return;
}
QString info = QString("% 1% 2").arg(flag).arg(QUIHelper::byteArrayToHexStr(data));
append(0 + type, info);
}
void frmRobotDebug2::receiveData(const QString &portName, const QByteArray &data)
{
int type;
QString flag;
if (checkNotPrint(portName, type, flag)) {
return;
}
QString info = QString("% 1% 2").arg(flag).arg(QUIHelper::byteArrayToHexStr(data));
append(4 + type, info);
}
Copy the code