Summary of the invention
Based on the existing shortcoming of existing warning system, the invention provides a kind of device and method of realizing inserting multiple alarming processing.
The present invention is achieved in that
A kind of device of realizing inserting multiple alarming processing comprises primary application program, alarm hardware equipment, software alarm system, and it is characterized in that: described device also comprises:
The software alarm administration module, corresponding alarm hardware driver module, corresponding software alarm system drive module;
Described software alarm administration module is by primary application invokes;
Adopt unified interface interchange between described software alarm administration module and described alarm hardware driver module, the described software alarm system drive module; This unified interface further comprises:
Initialization interface: be used to provide initialization to each alarm driver module;
Configuration interface: be used for different hardware devices, or different software system drive mode, carry out parameter configuration, all parameter configuration work is finished by each alarm driver module;
The receiving alarm information interface: computer system sends a warning message to the alarm driver module by this interface, receive this information after, send a warning message to relevant hardware equipment or software systems, reach the purpose that produces alarm;
Withdraw from interface: be used to withdraw from all to the calling of alarm driver module, discharge the memory headroom that distributes, withdraw from the thread of foundation, and other resource of in system initialization and operational process, distributing, stop the driver module that all have started simultaneously,
Described alarm hardware equipment or software alarm system are driven by separately alarm hardware driver module or software alarm system drive module respectively, to finish corresponding alarm access capability.
A kind of method that realizes inserting multiple alarming processing comprises the steps:
Step 1: definition and primary application program interface further comprise:
Initialization interface is used to finish the initial work of software alarm administration module, as the distribution of internal memory, and the foundation of thread etc.;
User's inputting interface calling interface is used for the invoke user inputting interface, makes things convenient for the configuration of user to each driving, starts etc.;
Receiving alarm information interface: be used for receiving alarm information;
Withdraw from interface: be used to withdraw from the software alarm administration module, no longer alarm inserted; Discharge the memory headroom that distributes simultaneously, withdraw from the thread of foundation, and other resource of in system initialization and operational process, distributing,
Step 2: definition and each driver module interface, the interface between software alarm administration module and each driver module adopts the unified interface function, further comprises:
Initialization interface: be used to provide initialization to each alarm driver module;
Configuration interface: be used for different hardware devices, or different software system drive mode, carry out parameter configuration, all parameter configuration work is finished by each alarm driver module;
The receiving alarm information interface: computer system sends a warning message to the alarm driver module by this interface, receive this information after, send a warning message to relevant hardware equipment or software systems, reach the purpose that produces alarm;
Withdraw from interface: be used to withdraw from all to the calling of alarm driver module, discharge the memory headroom that distributes, withdraw from the thread of foundation, and other resource of in system initialization and operational process, distributing, stop the driver module that all have started simultaneously,
Step 3: the creation procedure framework, comprise the defined interface of step 1 and step 2, and in order to allow needed other the necessary function of program run, variable, thread etc.,
Step 4: write the interface function with primary application program, according to writing the interface function that the primary application program needs call with the interface definition of primary application program in the step 1,
Step 5: write the interface function with each driver module, according to writing the interface function that calls with each driver module with the interface definition of each driver module in the step 2,
Step 6: create alarm management user inputting interface, be used to allow the user can be according to different alarm access waies, to user's operations such as different alarm hardware equipment or software alarm system increase, unload, dispose, start, stop,
Step 7: create and write each driver module,, write one or more alarm driver modules, the unified interface that adopts in step 2 of each driver module according to the difference of the alarm access way of user's needs; Except that will seeking unification with the software alarm module interface, other can be write according to the driving parameters difference of alarm hardware equipment or software alarm system.
The receiving alarm information interface receiving alarm information interface in the invocation step two also in the described step 1, system sends a warning message to the alarm driver module by this interface, drives hardware device or software systems and reaches the purpose that produces alarm.
Described step 2: definition and each driver module interface further comprise:
Read the brief information interface: be used for after application system has increased certain alarm driver module, read the descriptive information of this alarm module, and can in software alarm administration module or primary application program, show, be convenient to check whether the alarm driver module that is called is correct;
Start interface: be used for starting the alarm driver module, prepare receiving alarm from the software alarm administration module, and prepare to send a warning message to relevant hardware alarm equipment or software alarm system, as opening of serial ports, the foundation of communication etc.;
Stop interface: when the capable alarm of inaccurate received shipment driver module, call the transmission that this interface stops warning information, this interface can be closed serial ports, removes the operations such as connection of communication.
The increase user operation of in the described step 6 different alarm hardware equipment or software alarm system being carried out:
Increase a kind of alarm driver module, this driver module is articulated in the application system;
Direct calling module file, as dynamic link libraries (.dll), OCX control file (.ocx) etc., and from module file the illustrative words of acquisition module;
In the software alarm administration module, preserve the tabulation of a driver module that has increased, after the increase, the information of driver module is added in this tabulation, call after being convenient to.
The unloading user operation of in the described step 6 different alarm hardware equipment or software alarm system being carried out:
Unload a kind of alarm driver module that has been articulated in the application system;
Generally be that the alarm module that has articulated is not being re-used, or select when making a mistake, directly in application program with the alarm driver module deletion of appointment.
The configure user operation of in the described step 6 different alarm hardware equipment or software alarm system being carried out:
For articulating different alarm driver modules, carry out the difference configuration,
Configuration information comprises:
The parameter that the initialization of different driving module own is required;
Computing machine is the required messaging parameter of driving arrangement or system herewith, as: if drive, the string slogan can be arranged by serial ports, baud rate, verification modes etc. are if local area network communication can have the I P address, port numbers etc.;
Different alarm levels,
All configuration parameters all should be finished in the alarm driver module.
The startup user operation of in the described step 6 different alarm hardware equipment or software alarm system being carried out:
The alarm driver module that increases is started up, it is come into force, can receive the alarm signal that application system produces, comprising:
Automated manner starts, and when application program launching, the alarm driver module that will increase automatically starts up, and receiving alarm information is sent different alarm signals;
Manual mode starts, and when application program launching, the alarm driver module of increase does not start automatically, can not receiving alarm information, can not send alarm signal, have only when manual with this alarm driver module startup after, this module just plays a role.
Stopped user's operation to what different alarm hardware equipment or software alarm system carried out in the described step 6:
The alarm driver module that has started is stopped, thereby no longer send alarm signal in this alarm mode.
Driver module can adopt the module file form in the described step 7, as dynamic link libraries (.dll), and OCX control file (.ocx) etc.
Effect of the present invention is: when requirement or the actual needs because of the user, or change takes place in the alarm hardware equipment that inserts or software alarm system or when changing, only need corresponding alarm hardware driver module of increase or software alarm system drive module to get final product, needn't remove to change stable primary application program, software alarm administration module, and other stable alarm hardware driver module or software alarm system drive module, thereby better accomplish the stability of system, also kept good integrality of system and dirigibility simultaneously.For a software design, this is considerable undoubtedly.
Embodiment
System architecture of the present invention is as shown in Figure 2:
Compare with the structure of existing warning system, the present invention has added software alarm administration module, different alarm hardware driver module or different software alarm system drive modules, or other alarm driver module, has formed new multiple alarm access way.Wherein the software alarm administration module is a core of the present invention, it is by primary application invokes, it adopts standard design simultaneously, so-called standard design refer to it with different alarm hardware driver module or different software alarm system drive module between adopt unified interface interchange, each alarm hardware equipment or software alarm system are driven by separately alarm hardware driver module or software alarm system drive module respectively, finish corresponding alarm access capability.
Below detailed introduce performing step of the present invention, the performing step of software alarm administration module as shown in Figure 3:
Step 1 definition and primary application program interface
Software alarm administration module and primary application program interface are fairly simple, can be by following interface definition:
(1) initialization interface:
All comprise necessary initial work in most of modularization process softwares, this interface is exactly the initial work that is used for finishing the software alarm administration module.As the distribution of internal memory, the foundation of thread etc.
(2) user's inputting interface calling interface:
The main invoke user inputting interface of this interface makes things convenient for the configuration of user to each driving, starts etc., and relevant user's inputting interface information can be referring to following step 6.
(3) receiving alarm information interface:
This interface mainly is a receiving alarm information, and the receiving alarm information interface in the invocation step 2, and computer system sends a warning message to the alarm driver module by this interface, drives hardware device or software systems and reaches the purpose that produces alarm.
(4) withdraw from interface:
This interface withdraws from the software alarm administration module, no longer alarm is inserted.Discharge the memory headroom that distributes simultaneously, withdraw from the thread of foundation, and other resource of in system initialization and operational process, distributing.
Step 2 definition and each driver module interface
Interface between software alarm administration module and each driver module adopts the unified interface function, can comprise following interface definition:
(1) initialization interface:
This interface is used to provide the initialization to each alarm driver module.
(2) read the brief information interface:
After in application system, having increased certain alarm driver module, need read the descriptive information of alarm module, and can in software alarm administration module or primary application program, show, be convenient to check whether the alarm driver module that is called is correct.
(3) configuration interface:
Different hardware devices or software systems type of drive difference, required separately parameter is also different, utilizes this interface can reach this purpose, and all parameter configuration work is finished by each alarm driver module.
(4) start interface:
This interface is used for starting the alarm driver module, prepares receiving alarm from the software alarm administration module, and prepares to send a warning message to relevant hardware alarm equipment or software alarm system, as opening of serial ports, and the foundation of communication etc.
(5) receiving alarm information interface:
This interface is a most important interface, other all interfaces all for this reason interface prepare, system by this interface to the alarm driver module send a warning message, receive this information after, send a warning message to relevant hardware equipment or software systems, reach the purpose that produces alarm.
(6) stop interface:
When the capable alarm of inaccurate received shipment driver module, call the transmission that this interface stops warning information, this interface can be closed serial ports, removes the operations such as connection of communication.
(7) withdraw from interface:
This interface will withdraw from all to alarming calling of driver module, discharge the memory headroom that distributes, and withdraw from the thread of foundation, and other resource of distributing in system initialization and operational process.Stop the driver module that all have started simultaneously.
Annotate: in the superincumbent interface function, initialization interface, configuration interface, the receiving alarm information interface, it is necessary withdrawing from interface, other interface can be accepted or rejected according to actual conditions.For reading the brief information interface,, can not adopt if the user need not understand the module information that has articulated; For starting interface, if as long as system has articulated the alarm driver module that needs, module just works, needn't start-up by hand, can not need this interface; For stopping interface, if system is when quitting a program, just withdraw from the alarm driver module, can not adopt yet.But in order to increase the dirigibility of system, these all interface functions are adopted in suggestion.
Step 3 creation procedure framework
When definition finish and primary application program and and each driver module between interface after, we just can design program.
Step 1 and the defined interface of step 2 above in program frame, need comprising, and in order to allow needed other the necessary function of program run, variable, thread etc.
Step 4 is write the interface function with primary application program
According to writing the interface function that the primary application program needs call with the interface definition of primary application program in the step 1.
Step 5 is write the interface function with each driver module
According to writing the interface function that calls with each driver module with the interface definition of each driver module in the step 2.
Step 6 is created alarm management user inputting interface
Alarm management user inputting interface mainly is in order to allow the user different alarm hardware equipment or software alarm system be increased according to different alarm access waies, to dispose, users such as startup operation.
On the interface, can comprise following function: increase, unloading, configuration starts, and stops etc., and the Interface Design style can design according to personal habits, if any product standard, need design according to product standard.Being described as follows of each function:
● increase
Increase a kind of alarm driver module, this driver module is articulated in the application system.
Can adopt following mode to increase: a kind of is the mode that adopts tabulation, need to select the module of access from tabulation, another kind is direct calling module file, as dynamic link libraries (.dll), OCX control file (.ocx) etc., and from module file the illustrative words of acquisition module.
From the method for two kinds of top increases, the back is a kind of more desirable, if adopt the tabulation mode, certainly will will carry out the change of code to the tabulation content displayed of software alarm administration module, makes the integrality of program be subjected to destruction.Then a kind of mode needn't be changed the code of software alarm administration module, only needs the interface function that calling module provided, and just can recognize the descriptive information of module.
In the software alarm administration module, need to preserve the tabulation of a driver module that has increased, after the increase, the information of driver module is added in this tabulation, call after being convenient to.
● unloading:
Unload a kind of alarm driver module that has been articulated in the application system.Generally be that the alarm module that has articulated is not being re-used, or when making a mistake, select this function, this function be directly in application program with the alarm driver module deletion of appointment.
● configuration:
Because the alarm driver module difference that articulates, therefore the processing mode to these alarm driver modules is also not exclusively the same, and promptly configuration is different.
Under general situation, configuration information comprises:
(1) the required parameter of the own initialization of different driving module;
(2) the computing machine required messaging parameter of driving arrangement or system herewith, as: if drive, the string slogan can be arranged by serial ports, baud rate, verification modes etc. are if local area network communication can have the IP address, port numbers etc.
(3) different alarm level for alarming processing, is not that all alarms are all exported, and need filter out some inessential or unwanted alarm, so just need carry out corresponding alarm level or other filter type is provided with.
In addition, be noted that necessarily that in design all configuration parameters all should finish in the driver module in alarm.Otherwise module of every increase, the software alarm administration module will be done change, and the integrality of system just has been subjected to destruction.
● start:
Startup is that the alarm driver module that will increase starts up, and it is come into force, and can receive the alarm signal that application system produces.
Starting mode can be designed to two kinds, and a kind of automated manner starts, and a kind of is that manual mode starts, and the meaning of this dual mode is as follows:
The automated manner startup is meant that when application program launching the alarm driver module that will increase automatically starts up, and receiving alarm information is sent different alarm signals.
Manual mode is just in time opposite, and when application program launching, the alarm driver module of increase does not start automatically, can not receiving alarm information, can not send alarm signal, have only when manual with this alarm driver module startup after, this module just plays a role.
● stop:
Stopping is that alarm driver module with having started stops, thereby no longer sends alarm signal in this alarm mode.
Annotate: the function at these top interfaces, removing increases, unloading, dispose these several functions necessary outside, it not is necessary starting and stopping, startup can be finished or during program start, comes into force in increase, stops to come into force when unloading or program withdraw from.But in order to keep the complete of program function, this two functions are not removed in suggestion.
Each driver module is created and write to step 7
Can write one or more alarm driver modules according to the difference of the alarm access way of user's needs, the unified interface that adopts in step 2 of each driver module.Except that will seeking unification with the software alarm module interface, other can be write according to the driving parameters difference of alarm hardware equipment or software alarm system.Driver module can adopt the module file form, as dynamic link libraries (.dll), and OCX control file (.ocx) etc.
Be below alarm hardware equipment or software alarm system some for example:
Wherein alarm hardware equipment can comprise:
Special-purpose sound alarm case;
The alarm printer;
Can be on mobile phone the note equipment of display alarm information;
But display alarm information beeper;
Can send the sound card of alarm sound;
The LED display of display alarm information;
Special-purpose smell alarm device etc.
The software alarm system can comprise:
Can alarm literal, the software systems itself that color shows;
The comprehensive warning management system;
Other software support platform etc.;
Certainly, can also freely articulate other warning system owing to user's different demands.
By top design, can accomplish according to different needs, adopt one or more alarm access way, increase at any time and delete, needn't change the primary application program framework, accomplish to alarm more flexible, convenient that the way of output selects.This mode has also increased the reliability of system and debugging property simultaneously.Non-single for an alarm form, and changeable warning system, very big meaning had.