Alarm module and method for Qt program

By introducing the alarm module into the Qt program, the problem of internal security detection and alarm reset of the program is solved, the monitoring and processing of internal alarms of the program is realized, and the operation safety is improved.

CN118585408APending Publication Date: 2024-09-03BEIJING CHIEFTAIN CONTROL ENGINEERING TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410634570.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-21
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

During the running of the Qt program, how to ensure the operational security within the program, especially since the users are dispersed, it is difficult to effectively monitor and handle the alarm status, making it difficult to solve the problems of security detection and alarm reset.

Method used

Provide an alarm module for Qt programs, including a data acquisition unit, a function storage unit and an instruction generation unit, used to obtain and process the alarm status, and call the corresponding execution function to control the behavior of the alarm module, and realize the internal control of the program Alarm monitoring and safety detection.

Benefits of technology

Through the alarm module that is independent of the application program, timely processing and security detection of alarms within the program are realized, which improves the safety of program operation, ensures the recording and processing of alarm information, and enhances the stability and reliability of the program.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118585408A
    Figure CN118585408A
Patent Text Reader

Abstract

The invention provides an alarm module and method for a Qt program. The alarm module comprises a data acquisition unit, a function storage unit and an instruction generation unit, wherein the data acquisition unit is used for acquiring an alarm state in a Qt program; the function storage unit is used for storing a plurality of execution functions in advance, and each execution function is matched with an alarm state; the instruction generation unit is used for generating an execution instruction according to the alarm state, and the execution instruction is used for controlling the alarm module to call an execution function matched with the current alarm state. The alarm module is a functional module independent of an application program and is used for solving the problem that all parts in the program need to be timely processed, subjected to safety detection and subjected to alarm reset, and for program alarm, the alarm module combines information needing to be provided such as names, solutions and time into an independent module, so that the alarm module is convenient to use. The internal alarm monitoring of the program is realized, and the running safety of the program is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of program early warning, and in particular to an alarm module and method for a Qt program. Background Art

[0002] During the running of the program, there may be issues such as matters that need to be handled, security checks, and alarm resets that need to be addressed within the program. Especially for Qt programs, since the users are relatively scattered, it is crucial to ensure the safety of the program's internal operations. This requires providing an alarm module and method for Qt programs to implement alarm monitoring within the program and ensure the safety of program operation. Summary of the invention

[0003] The present invention provides an alarm module and method for a Qt program, so as to realize alarm monitoring inside the program and improve the running safety of the program.

[0004] The present invention provides an alarm module for a Qt program, the alarm module comprising:

[0005] A data acquisition unit, used to obtain the alarm status in the Qt program;

[0006] A function storage unit, used to pre-store a plurality of execution functions, each of which matches an alarm state;

[0007] The instruction generating unit is used to generate an execution instruction according to the alarm state, and the execution instruction is used to control the alarm module to call an execution function matching the current alarm state.

[0008] In some embodiments, the alarm module further includes:

[0009] A data storage unit is used to record the alarm information acquired by the data acquisition unit.

[0010] In some embodiments, the alarm information includes the time when the alarm occurs, the time when the alarm is reset, and the reason why the alarm occurs.

[0011] In some embodiments, the execution function includes:

[0012] A trigger function, the trigger function is used to be called when the alarm state is an alarm trigger;

[0013] A reset function, the reset function is used to be called when the alarm state is an alarm reset;

[0014] A clearing function, the clearing function is used to be called when the alarm state is alarm clearing;

[0015] A change function is used to be called when the alarm state is an alarm change.

[0016] In some embodiments, the alarm change includes an alarm parameter change and an alarm enablement change.

[0017] In some embodiments, the alarm module further includes:

[0018] A query unit, wherein the query unit is used to query the current alarm triggering situation.

[0019] The present invention also provides an alarm method for a Qt program, the alarm method comprising:

[0020] Get the alarm status in the Qt program;

[0021] An execution instruction is generated according to the alarm state, and the execution instruction is used to control the alarm module to call a pre-stored execution function matching the current alarm state.

[0022] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described above when executing the program.

[0023] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the method described above when executed by a processor.

[0024] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method described above is implemented.

[0025] The alarm module for Qt program provided by the present invention includes a data acquisition unit, a function storage unit and an instruction generation unit; wherein the data acquisition unit is used to obtain the alarm state in the Qt program; the function storage unit is used to pre-store a plurality of execution functions, each of which is matched with the alarm state; the instruction generation unit is used to generate an execution instruction according to the alarm state, and the execution instruction is used to control the alarm module to call the execution function matching the current alarm state. The alarm module is a functional module independent of the application program, and is used to solve the problem that each part of the program needs to be processed, security tested, and alarm reset in a timely manner. For the program alarm, the alarm module combines the required information such as "name", "solution", "time", etc. into an independent module, realizes the alarm monitoring inside the program, and improves the safety of program operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0027] Figure 1 One of the structural block diagrams of the alarm module for Qt program provided by the present invention;

[0028] Figure 2 The second structural block diagram of the alarm module for Qt program provided by the present invention;

[0029] Figure 3 One of the flow charts of the alarm method for Qt program provided by the present invention;

[0030] Figure 4 The second flowchart of the alarm method for Qt program provided by the present invention;

[0031] Figure 5 The third flowchart of the alarm method for Qt program provided by the present invention;

[0032] Figure 6 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0034] Please refer to Figure 1 , Figure 1 One of the structural block diagrams of the alarm module for Qt program provided by the present invention;

[0035] In a specific implementation manner, the alarm module provided by the present invention is an independent module developed for Qt programs and used to alarm Qt programs, such as Figure 1 As shown, the alarm module for Qt program includes:

[0036] The data acquisition unit 110 is used to obtain the alarm status in the Qt program; for example, the Qt program can be Qt, and the alarm module is implemented by relying on the Qt database; the alarm status can specifically be alarm triggering, alarm resetting, alarm clearing and alarm change, etc., and the alarm change further includes alarm parameter changes and alarm activation changes.

[0037] The function storage unit 120 is used to pre-store a plurality of execution functions, each of which matches an alarm state; that is, the execution function corresponds to the alarm state one by one, and the execution function is pre-stored in the function storage unit. When the corresponding alarm state is obtained, the execution function is called, and when the execution function is executed, the corresponding alarm action can be realized.

[0038] An instruction generating unit 130, configured to generate an execution instruction according to the alarm state, wherein the execution instruction is used to control the alarm module to call an execution function matching the current alarm state;

[0039] The data storage unit 140 is used to record the alarm information acquired by the data acquisition unit; wherein the alarm information includes the time when the alarm occurs, the time when the alarm is reset, and the reason why the alarm occurs.

[0040] The query unit 150 is used to query the current alarm triggering situation, that is, to query whether there is an alarm triggering at present, or to query whether there is no alarm triggering at present.

[0041] In some embodiments, the execution function includes:

[0042] Trigger function, the trigger function is used to call when the alarm state is alarm triggered; for alarms without range restrictions, the trigger function will directly identify alarm triggers. If the alarm has a range restriction, the current value used for judgment needs to be passed into this function, and this module will make a judgment according to the range parameter of the alarm. If it is within the range, it will not be triggered, and if it is out of the range, the alarm will be triggered. If the alarm is in the start state, a signal that the alarm has been triggered will be issued, and the trigger function will be called to control the software platform to issue an alarm message;

[0043] Reset function, the reset function is used to call when the alarm state is alarm reset; that is, when the user believes that the alarm problem has been solved and can be cleared, or believes that the alarm has little impact on the overall system, the reset function can be called. The reset function is divided into regular reset and forced reset. In regular reset, the module will count the alarm in the clear state. When the count reaches the clear count upper limit, it determines that the alarm can be reset. In forced reset, the module will not judge the count in the clear state and directly reset the alarm;

[0044] Clear function, the clear function is used to call when the alarm state is alarm clear; when the user uses the module, a position for alarm clearing needs to be specified, which is mainly used to determine whether the alarm can be cleared. This position is generally placed in the normal running part of the program. If there is an alarm, the alarm clearing instruction will not be executed. If the alarm disappears, the alarm clearing instruction will be executed. The alarm can only be reset normally when the alarm clearing count reaches the upper limit, mainly to prevent the program from being in the alarm state and normal state more frequently, resulting in frequent alarm triggering;

[0045] Change function, the change function is used to call when the alarm state is an alarm change; the change function includes alarm activation change and alarm parameter change. The activation of the alarm affects the signal that triggers the alarm. If an unactivated alarm is triggered, this module will not issue an alarm signal. If an enabled alarm is triggered, this module will issue an alarm signal. At the same time, the unactivated alarm will automatically reset the alarm when the clear count reaches the upper limit. Alarm parameter change is used to modify the upper and lower limits of the alarm range.

[0046] Taking Qt as an example, the main functions of the alarm module provided by the present invention are briefly described below.

[0047] like Figure 2 As shown in the figure, the alarm module is an open function module, which can also add functions through secondary development. Figure 2 Taking the scenario shown as an example, the alarm module can be used to record the time when the alarm occurs, the time when the alarm is reset, the cause of the alarm, the alarm level, the alarm clear count, the upper limit of the alarm clear count, etc.; string (string is a string type in programming languages ​​such as C++, Java, VB, etc.) contains the alarm code, alarm name, alarm description, alarm source, alarm solution and basic alarm information; bool (Boolean variable) includes alarm enable, alarm occurred and alarm existence parameters, etc.; double (double precision floating point type) is the upper limit and lower limit of the normal range;

[0048] The alarm module for Qt program provided by the present invention includes a data acquisition unit, a function storage unit and an instruction generation unit; wherein the data acquisition unit is used to obtain the alarm state in the Qt program; the function storage unit is used to pre-store a plurality of execution functions, each of which is matched with the alarm state; the instruction generation unit is used to generate an execution instruction according to the alarm state, and the execution instruction is used to control the alarm module to call the execution function matching the current alarm state. The alarm module is a functional module independent of the application program, and is used to solve the problem that each part of the program needs to be processed, security tested, and alarm reset in a timely manner. For the program alarm, the alarm module combines the required information such as "name", "solution", "time", etc. into an independent module, realizes the alarm monitoring inside the program, and improves the safety of program operation.

[0049] In addition to the above alarm module, the present invention also provides an alarm method for Qt program, the alarm method comprising:

[0050] Get the alarm status in the Qt program;

[0051] An execution instruction is generated according to the alarm state, and the execution instruction is used to control the alarm module to call a pre-stored execution function matching the current alarm state.

[0052] Still taking Qt as an example, Figure 3 As shown, the alarm method uses the Alarm_subscribe function to subscribe to the alarm according to the definitions of the Alarm structure. For the part that needs to be judged by the parameter range, "%param%" is used to determine the position in the alarm information. When the alarm signal is issued, the module can put the value of the current parameter into the alarm information; the trigger function (Alarm_check) is called when the alarm trigger judgment is required, the reset function (Alarm_Reset) is called when the alarm needs to be reset, and the forced reset function (Alarm_Reset_force) is called when the alarm needs to be forced to reset. When the alarm clearing times are increased by one, the clearing function (Alarm_Clear) is called, the change function (Alarm_setParam) is called when the alarm parameters need to be changed, and the enable change function (Alarm_changeEnable) is called when the alarm enablement change needs to be made. The query function (isAcivite) is called to check whether there is an alarm being triggered, and the query function (isClear) is called to query whether there is no alarm being triggered. Among them, such as Figure 4 As shown, accessible variables include triggered enabled alarms and triggered non-enabled alarms; Figure 5As shown, when the alarm content changes, the external party is notified that the alarm pool can be accessed for information display; when a new alarm is triggered, a signal is sent out, which is used to respond to the alarm; a signal is sent out when all alarms are cleared; and a signal is sent out when a certain alarm is cleared.

[0053] In the above specific implementation, the alarm method for Qt program provided by the present invention obtains the alarm state in the Qt program, generates an execution instruction according to the alarm state, and the execution instruction is used to control the alarm module to call a pre-stored execution function that matches the current alarm state. The alarm method is implemented based on a functional module independent of the application program, and is used to solve the problem of timely processing, security detection, and alarm reset of various parts in the program, realizes alarm monitoring inside the program, and improves the safety of program operation.

[0054] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the above method.

[0055] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the part of the technical solution of the present invention that essentially contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instruction sets that enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0056] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform the above method.

[0057] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0058] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0059] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An alarm module for Qt program, characterized in that: The alarm module comprises: A data acquisition unit, used to obtain the alarm status in the Qt program; A function storage unit, used to pre-store a plurality of execution functions, each of which matches an alarm state; The instruction generating unit is used to generate an execution instruction according to the alarm state, and the execution instruction is used to control the alarm module to call an execution function matching the current alarm state.

2. The alarm module for Qt program according to claim 1, characterized in that: Also includes: A data storage unit is used to record the alarm information acquired by the data acquisition unit.

3. The alarm module for Qt program according to claim 2, characterized in that: The alarm information includes the time when the alarm occurs, the time when the alarm is reset, and the reason why the alarm occurs.

4. The alarm module for Qt program according to claim 1, characterized in that: The execution function includes: A trigger function, the trigger function is used to be called when the alarm state is an alarm trigger; A reset function, the reset function is used to be called when the alarm state is an alarm reset; A clearing function, the clearing function is used to be called when the alarm state is alarm clearing; A change function is used to be called when the alarm state is an alarm change.

5. The alarm module for Qt program according to claim 4, characterized in that: The alarm changes include alarm parameter changes and alarm activation changes.

6. The alarm module for Qt program according to claim 1, characterized in that: Also includes: A query unit, wherein the query unit is used to query the current alarm triggering situation.

7. An alarm method for a Qt program, characterized in that: The alarm method comprises: Get the alarm status in the Qt program; An execution instruction is generated according to the alarm state, and the execution instruction is used to control the alarm module to call a pre-stored execution function matching the current alarm state.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to claim 7 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to claim 7 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to claim 7 is implemented.