Background technology
Along with the development of science and technology, self-service product has more and more entered the life of the mankind, and the technology of self-service product is also more and more rationalized and hommization.
Calling of existing hardware equipment is substantially all hardware driving by single, exclusively enjoys taking of equipment.
Cannot realize sharing of many application, equipment can only be used by an application and discharge the application call that exclusive resource just allows other.
Expansion is inconvenient, and later maintenance bothers.The amendment driven all may impact all application, and the result brought needs the carrying out of repeating to test.
Application layer takes to carve notices whether the equipment that will use is in idle condition.
Summary of the invention
The object of the present invention is to provide a kind of method of many Application share hardware device, solve current hardware device effectively and multiple utility program cannot drive the problem shared.
The invention is characterized in: a kind of method of many Application share hardware device, it is characterized in that, comprise application layer, drive layer, service service layer and hardware device, each hardware drive program of some equipment is provided with in described driving layer, it is independently that described application layer calls the hardware drive program driving layer, and each hardware drive program sends to Service service layer by local socket communication mode upon receipt of the instructions, different response process is done according to command type by described Service service layer, and then calls hardware device and make respective reaction.
Advantage of the present invention: the present invention can realize sharing of many application, and expansion is convenient, and later maintenance is easy, can save equipment operating cost.
Embodiment
2 to accompanying drawing 5 by reference to the accompanying drawings, the present invention is a kind of method of many Application share hardware device, comprise application layer, drive layer, service service layer and hardware device, each hardware drive program of some equipment is provided with in described driving layer, it is independently that described application layer calls the hardware drive program driving layer, and each hardware drive program sends to Service service layer by local socket communication mode upon receipt of the instructions, different response process is done according to command type by described Service service layer, and then calls hardware device and make respective reaction.
Above-mentioned driving layer sends to Service service layer by local socket communication mode upon receipt of the instructions, then the result of Service service layer command process is waited for, the work driving layer to do sends hardware operation instruction to Service service layer, and wait for that result returns.
Specific implementation process: as shown in Fig. 1 (original system framework), the upper strata of whole system framework is each application program, is separate, is linked together by master routine between them.Public hardware device is likely called in each application, and original design proposal uses hardware device by calling same driving, but multiple application program cannot use same driving simultaneously.So original driving design to meet the needs that multiprogram calls.Each application is simultaneously all call same driving, if need amendment or expanded function, then must re-start test for original function, have impact to avoid the application of this change on other.Maintenance like that for the later stage is very difficult.
In new system architecture as shown in Fig. 2 (new system architecture), the driving of each application call is independently, and respectively drive and send to Service to serve by local socket communication mode upon receipt of the instructions, Service service does different response process according to command type, wait for printer processes for general instruction as the print command of thermal printer then enters queue, special instruction is as then direct to its operation in order cancellation etc.Order in queue is according to entering order process, and other programs so then can be avoided when invocation facility operates, and another program cannot use equipment to cause fault.Simultaneously also can reduction instruction flow process, it is unnecessary as opened the similar order such as port to send.
Each application program has provides respective hardware driving, and namely Fig. 2 (new system architecture) " hardware driving " illustrated, this avoid the problem that multiple application uses same driving.Simultaneously respectively drive the command interface provided all to remain unchanged, facilitate application layer developer like this, they just can the new driving of compatibility without the need to modifying to program.And each " hardware driving " sends to Service service layer by local socket communication mode upon receipt of the instructions, then wait for the result of Service service layer command process.The work mainly done in " hardware driving " part sends hardware operation instruction to Service service layer, and wait for that result returns, as Fig. 3 (send order and return results).
Service service does different response process according to command type, waits for printer processes for general instruction as the print command of thermal printer then enters queue.Order in queue, according to entering order process, processes, and gets rid of this instruction from queue.Other programs so then can be avoided when invocation facility operates, and another program cannot use equipment to cause fault.Whole flow process as shown in Figure 4 and Figure 5.
The result of Service service processing can reduction instruction flow process, and it is unnecessary as opened the similar order such as port to send.
Present invention employs and be responsible for carrying out alternately with hardware by service end, each stand-alone program sends command request by client to service end, after the service end request of receiving orders, this request is entered queue, service end performs corresponding command request according to queue sequence, directly operates as cancellation operation etc. need not enter queue for special instruction.Would not conflict be produced between each program like this, can hardware device be shared, simplify and call and need not hardware case be concerned about.
The foregoing is only preferred embodiment of the present invention, all equalizations done according to the present patent application the scope of the claims change and modify, and all should belong to covering scope of the present invention.