Disclosure of Invention
The invention mainly solves the technical problem of providing a method for realizing the universal function of printing and stamping based on a new driving platform, the driving of the module is designed on the new platform, and the printing and stamping function of the project can be finished only by completing the character string analysis of the input parameters and the logic calling of each module in the driving layer according to the applied logic for the printing function of each project, so that the development amount is small, and the development efficiency is improved. The degree of modularization of the internal functions of the driver is high, the functions of all the modules are solidified, the processing is stable, all the functions are realized according to the characteristics of bottom hardware, the processing is comprehensive, the independence is strong, the exception handling mode is more flexible and reasonable, and various cases of customer service logic processing are met.
In order to solve the technical problems, the invention adopts a technical scheme that: the utility model provides a method for realize printing general function of stamping based on drive new platform, carries out printing stamp according to the order and the parameter that different drive callers issued, at first turns into the order and the parameter that the application was issued into the inside general parameter of drive, for the application interface is nimble to be called each drive internal function and reduce the coupling nature between each functional module, according to printing stamp module hardware attribute, will print stamp logic flow and split into roughly: the system comprises an internal universal variable initialization function module, a printing module, a stamping module and a printing (stamping) judging and finishing module, wherein the modules are combined and repeatedly called according to the logic function requirements of command combination to realize the function of batch printing and stamping; if the application service does not need a stamping module, the interior of the driver is driven to not call a stamping function according to the adjustment of the configuration;
further, the process of converting the commands and parameters issued by the application into the drive internal general parameter processing comprises the following steps:
A. firstly, judging whether an application access parameter is empty or not, and if the application access parameter is empty, directly returning to failure; if not, judging whether the length of the input parameter is less than 0? If < 0, returning failure;
B. enabling the input parameters issued by the application to be valid, clearing internal general parameter variables, initializing assignment to all the variables, analyzing each field issued by the application, assigning the printer driver to the structure variable according to a defined driver naming mode according to the information of the specified field, assigning the printer driver to the structure variable according to the information of the specified field, and assigning all other fields to the variables corresponding to the structure;
C. the processing mode of each field of the structure is as follows: analyzing the field before the field is specified, and assigning values to the field without changing the value; analyzing the fields after the fields are designated, and assigning values to variables corresponding to all arrays uniformly after corresponding data are obtained;
D. the processing of printing the file field is as follows: when the specified field is analyzed, the file information is assigned to the structure variable and is pressed into the internal universal array variable, the number of the files to be printed by the application can be known through the length of the array, and the storage sequence of the files in the variable array, namely the printing sequence of the files, is completely arranged and printed according to the application issuing sequence;
E. and all the parameters are analyzed and stored in the general array in the drive, the printing function is started to be executed, and the printing of the file is completed according to the printing stamping information stored in the array.
The invention has the beneficial effects that: the invention designs the drive of the module on a new platform, and only for the printing function of each project, the printing and stamping functions of the project can be completed only by completing the character string analysis of the input parameters and the logic call of each module in the drive layer according to the applied logic, so that the development amount is small, and the development efficiency is improved. The degree of modularization of the internal functions of the driver is high, the functions of all the modules are solidified, the processing is stable, all the functions are realized according to the characteristics of bottom hardware, the processing is comprehensive, the independence is strong, the exception handling mode is more flexible and reasonable, and various cases of customer service logic processing are met.
Detailed Description
The following detailed description of the preferred embodiments of the present invention, taken in conjunction with the accompanying drawings, will make the advantages and features of the invention easier to understand by those skilled in the art, and thus will clearly and clearly define the scope of the invention.
Referring to fig. 1 and 2, an embodiment of the present invention includes:
a method for realizing printing and stamping universal functions based on a new driving platform is characterized in that a driving layer adapts to the function switching among different upper layer callers of each project and realizes whether the stamping function is used or not in a configurable mode; defining and driving a plurality of modules with independent single functions inside, and meeting different business logic processing requirements of upper layer callers through the logic combination of the modules with the single functions; defining a drive internal general data storage structure body to meet the stability of drive internal functions and logic processing; in the aspect of exception processing, the printer state is monitored through another thread, and recovery and immediate updating of the printer state are completed.
In the invention, one set of driving program of the new platform can meet the calling of different upper-layer applications. For example, fig. 1 is a design diagram of a general functional architecture for driving printing and sealing by a new platform, and the printing and sealing functions with the same hardware are realized according to different application calling interfaces and issued parameters. The commands and parameters issued by the application are explained as follows: the CmdRawData 1-N and the controlMediaA-B are the same command combination respectively issued by different applications for realizing batch printing stamping, and the Param 1-N and the paramA-B are parameters respectively issued by the applications for different printing stamping functions; in some projects, only CmdRawData 1-N and Param 1-N are used, and the control mediaA-B and Parama-B of the dashed box are not used, according to the definition of the upper layer application itself.
Firstly, commands and parameters issued by an application need to be converted into drive internal general parameters, so that the application interface flexibly calls each drive internal function and reduces the coupling between each function module, and according to the hardware attribute of the printing and stamping module, the printing and stamping logic flow is roughly split into: the system comprises an internal universal variable initialization function module, a printing module, a stamping module and a judging printing (stamping) ending module, wherein the modules are combined and called for many times according to the logic function requirements of CmdRawDataN and ControlMediaN to realize the function of printing and stamping in batches. If the application service does not need a stamping module, the internal stamping function of the dashed frame is not called according to the adjustment of the configuration.
Taking a certain embodiment as an example, fig. 2 is a flow processing diagram of converting application issuing parameters into driving internal general parameters, where the format of the application issuing parameters is:
“pagesource=A4;copies=2;file[0]=
C:\pr_A4.html;file[1]=C:\pr_1/3A4.html;stamp=0;duplex=2;color=0;direction=0;”
to facilitate understanding of the flow chart, the variables used in the figure are illustrated as follows:
charlpbData is a parameter issued by an application;
int nLen is the length of the parameter lpbData;
PRINTINFO m _ STPrintInfo, storing single file print task driving internal general structure;
the individual file print information structure is defined as follows:
the stamp information structure is defined as follows:
vector < PRINTINFO > m _ vecInfo, storing internal general array of batch (multiple files) printing task driver;
pushBack (), pressing the current printing information structure into an array;
clear RawData (), emptying initialization variables;
the printer realizes the printing (stamping) function;
the following will describe the process of issuing parameters by the application, analyzing and converting into driving the internal general parameter processing:
A. firstly, judging whether an application access parameter is empty or not, and if the application access parameter is empty, directly returning to failure; if not, judging whether the length of the input parameter is less than 0? If < 0, returning failure;
B. the method comprises the steps that an input parameter is valid under an application, an internal general parameter variable is cleared, all variables are initialized and assigned, each field issued by the application is analyzed, a printer driver is assigned to a structural body variable m _ stprintinfo.
C. The method is characterized in that a plurality of files to be printed in each application are unknown and uncertain, the parameters are issued through the application, all printing and stamping information is the same except for different files in each task, and the processing mode of each field of a structure body is as follows: resolving the field before the field of 'file [', and the value is not changed after assignment; and after the fields of the file are analyzed, assigning values to variables corresponding to all the arrays uniformly after corresponding data are obtained, so that the application is ensured to issue tasks once, and all the printing tasks except for printing files and other printing and stamping information can be kept consistent.
D. The processing of printing the file field is as follows: each time the field 'file [' is resolved, the file information is assigned to a structure variable m _ stprintinfo.
E. And all the parameters are analyzed and stored in a general array in the drive, the printing function PrintRawData () is started to be executed, and the file is printed according to the printing stamping information stored in the array.
In the aspect of exception handling, because some exceptions need to be manually solved, and manual solving time is often uncertain, under the condition of following the characteristics of hardware and an application business process, another thread is started to specially monitor the state of the printer, and after the exception occurs, a driving layer deletes a printing task, and when the equipment state is in a recoverable state, the printer printing function is recovered.
The invention designs the drive of the module on a new platform, and only for the printing function of each project, the printing and stamping functions of the project can be completed only by completing the character string analysis of the input parameters and the logic call of each module in the drive layer according to the applied logic, so that the development amount is small, and the development efficiency is improved. The degree of modularization of the internal functions of the driver is high, the functions of all the modules are solidified, the processing is stable, all the functions are realized according to the characteristics of bottom hardware, the processing is comprehensive, the independence is strong, the exception handling mode is more flexible and reasonable, and various cases of customer service logic processing are met.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes performed by the present specification and drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.