Automatic repair method for communication of driving peripheral
Technical Field
The invention relates to a method for automatically repairing communication of a drive peripheral, and belongs to the technical field of self-service equipment.
Background
The self-service equipment generally accesses hardware modules of various types and models, communication abnormal conditions inevitably occur in the use process, but a flexible and quick recovery mechanism for disconnection and reconnection is needed for ensuring the subsequent continuous use of the equipment, so that the operation efficiency of the equipment is improved, and the manual operation cost is reduced.
The general method adopts the single module to reset or close and open when the equipment is abnormal, and tries to reestablish the connection, and each module maintains and repairs itself, but has many disadvantages: for example, the same function needs to be realized by each module independently at the bottom of code reuse rate; for the composite device, such as two-in-one, three-in-one, and the like, the device ports are shared, and the efficiency is low when the device is repeatedly repaired during operation.
Disclosure of Invention
In view of the above technical problems, the present invention aims to: the method for automatically repairing the communication of the driving peripheral realizes a universal shared communication repairing method, reduces repeated development, and is convenient for standardization and unified management and maintenance of platforms and projects.
The technical solution of the invention is realized as follows: a method for automatically repairing communication of a drive peripheral comprises the following steps that firstly, all modules are driven to use a common equipment base class, different modules of a shared port can be intelligently identified, and sharing management and rapid synchronization of handles are realized; secondly, the inheritance characteristics of object-oriented development are used based on the driving architecture, the general functions are realized by using a base class through an STL standard template library, and subclasses are directly used; thirdly, setting communication abnormal identifiers of the shared port module and the shared port module after communication is abnormal; fourthly, trying to repair, and only once repairing the composite module of the shared device base class, the composite module and the shared port; if the repair is successful, setting a connection success identifier, then setting a connection success identifier of the shared port module, feeding back through the base class and repairing the shared port module; and if the repair fails, directly finishing the repair, and trying to repair after re-detection.
Preferably, all modules use the same device base class, a unique object is created when any module is opened, and the platform layer performs unified control by recording each object instance.
Due to the application of the technical scheme, compared with the prior art, the invention has the following advantages:
according to the automatic repair method for the peripheral communication, all module drivers use a common equipment base class, a unique object can be created when any module is opened, the platform layer performs unified control by recording each object instance, different modules of a shared port are intelligently identified, sharing management and quick synchronization of handles are realized, repair efficiency is improved, and only one-time repair is needed for a composite module of the shared port; code reuse rate is improved, and BUG and failure rate are reduced; the interface is unified, the platform standardization is improved, and the management and control are convenient.
Drawings
The technical scheme of the invention is further explained by combining the accompanying drawings as follows:
fig. 1 is a flowchart of an automatic repair method for driving peripheral communication according to the present invention.
Detailed Description
The invention is described below with reference to the accompanying drawings.
As shown in fig. 1, the method for automatically repairing communication of a driver peripheral according to the present invention includes steps of, firstly, driving all modules to use a common device base class, all modules to use the same device base class, creating a unique object when any module is opened, and performing unified control by recording each object instance by a platform layer, so that different modules of a shared port can be intelligently identified, and sharing management and quick synchronization of handles are realized; secondly, the inheritance characteristics of object-oriented development are used based on the driving architecture, the general functions are realized by using a base class through an STL standard template library, and subclasses are directly used; thirdly, setting communication abnormal identifiers of the shared port module and the shared port module after communication is abnormal; fourthly, trying to repair, and only once repairing the composite module of the shared device base class, the composite module and the shared port; if the repair is successful, setting a connection success identifier, then setting a connection success identifier of the shared port module, feeding back through the base class and repairing the shared port module; and if the repair fails, directly finishing the repair, and trying to repair after re-detection.
According to the automatic repair method for the peripheral communication, all module drivers use a common equipment base class, a unique object can be created when any module is opened, the platform layer performs unified control by recording each object instance, different modules of a shared port are intelligently identified, sharing management and quick synchronization of handles are realized, repair efficiency is improved, and only one-time repair is needed for a composite module of the shared port; code reuse rate is improved, and BUG and failure rate are reduced; the interface is unified, the platform standardization is improved, and the management and control are convenient.
The above-mentioned embodiments are merely illustrative of the technical idea and features of the present invention, and the purpose thereof is to enable those skilled in the art to understand the contents of the present invention and implement the present invention, and not to limit the scope of the present invention, and all equivalent changes or modifications made according to the spirit of the present invention should be covered in the scope of the present invention.