The disclosure relates to a printer and a control method thereof.
Receipt printer is widely used in fields such as lottery, transportation, supermarket and shopping mall to print securities or transaction documents, for example, lottery, ticket, purchase invoice and the like. These receipts can be used normally only when the content of the receipt is printed completely.
In related art, during the printing process of receipts, due to printer errors such as uplift of top cover, cutter error, paper clogging and printer paper absence, the data of the current receipt is missing and the receipt content printed is incomplete. After these problems occur, two conditions generally appear according to different processes of receipt issuance and a dispute is caused between the seller and the buyer of the receipt. One condition is that: after transmitting the data of a to-be-printed receipt to a printer, the receipt is printed successfully will be concluded by the host control software of the printer, even though the receipt printed is invalid due to a printer error, the control software also considers that a valid receipt is printed out and registers the receipt number in the software system of the host and then deducts the money of the buyer. The other condition is that: if the printer reports an error during the printing process, the host control software of the printer does not register the receipt information, considers that the receipt is not printed out and does not deduct the money of the buyer. In the first condition, due to the printer error, the receipt that the buyer buys can not be used normally and thus strong dissatisfaction is caused. In the second condition, some buyers probably could use the unpaid invalid receipt to pretend a good one. Since there is no evidence to check, an unnecessary dispute is caused between the buyer and the seller.
The inventor discovers that it is difficult to provide a basis for judging whether the printing is normal when printing fails due to a printing error during the printing process in related art.
The disclosure is provided in view of the problem that it is difficult to provide a basis for judging whether the printing is normal when printing fails due to a printing error during the printing process. Therefore, the main purpose of the disclosure is to provide a printer and a control method thereof to solve the above problem.
In order to realize the purpose above, a control method of a printer is provided according to one aspect of the disclosure. The method comprises: detecting the state of the printer; and when the printer is in error state, saving printing data and error information of the printer.
In order to realize the purpose above, a printer is provided according to another aspect of the disclosure. The printer comprises a printing mechanism and a controller, and further comprises: a detection mechanism, configured to detect a state of the printer and to obtain error information when the printer is in error state; a first memory, configured to temporarily store the printing data of the printer; and a second memory, configured to store the error information and the printing data when the printer is in error state.
With the disclosure, the state of the printer is detected; the printing data and the error information of the printer are saved when the printer is in error state; and the printing data and the error information of the printer saved when the printer is in error state can be used as a basis for judging whether the printing is normal. Thus, the problem that it is difficult to provide a basis for judging whether the printing is normal when printing fails due to a printing error during the printing process is solved; therefore, the effect of providing a basis for judging whether the printing is normal when printing fails due to a printing error during the printing process is achieved.
For a better understanding of the disclosure, accompanying drawings described hereinafter are provided to constitute one part of the application; the schematic embodiments of the disclosure and the description thereof are used to illustrate the disclosure but to limit the disclosure improperly. In the accompanying drawings:
It should be noted that the embodiments in the application and the characteristics of the embodiments can be combined if no conflict is caused. The disclosure is described below in detail by reference to the accompanying drawings in conjunction with embodiments.
As shown in
The first memory above can be a RAM memory 14; and the second memory above can be a FLASH memory 15.
As shown in
It should be noted that the embodiment of the disclosure is not limited to the receipt printer, but can be various different printers.
With the disclosure, during the printing process, if the printer experiences an error, the error information and the receipt information are recorded in the FLASH memory of the printer, as a basis for judging whether the receipt printing is normal.
Step 12: detecting the state of the printer.
For example, the state of the printer can be detected by one or more sensors installed in the printer.
Step 14: when the printer is in error state, saving printing data and error information of the printer.
Preferably, when the printing data and the error information of the printer are saved, the printing data can be encrypted first, and then the encrypted printing data is saved.
Moreover, when the printing data and error information of the printer are saved, it can be judged whether the storage space of a memory is enough to save the printing data and the error information, wherein this memory is configured to store the printing data and error information of the printer; in a condition that the storage space of the memory is not enough, the earliest information stored in the memory is deleted.
Through the embodiments above, corresponding records of the error information in the printing process and the receipt information (that is, printing data) can be saved and can provide a basis for solving the dispute between the buyer and the seller of the receipt, thereby preventing the occurrence of the dispute. In addition, the validity of the receipt can be determined by querying the state information of the receipt in the printing process (including the stored error information and printing data), thus the conditions that the receipt issuer charges an invalid receipt and the receipt buyer uses an invalid receipt to pretend a good one can be avoided, and evidence is provided for solving the dispute.
As shown in
Step 101: receiving printing data and printing.
The printer receives the printing data transmitted by the host control software and temporarily stores the printing data into the RAM memory, and the controller controls the printing mechanism to execute the printing action.
Step 102: judging whether the printer is abnormal.
The detection mechanism detects the state of each part of the printer in real time according to the state of each sensor. For example, a paper amount detection sensor generally is provided in a paper house of the printer to detect the amount of remained paper, thereby judging whether the paper is sufficient. When the amount of remained paper is sufficient, it is judged that the printer is normal. When the amount of remained paper is insufficient, it is judged that the printer is abnormal. A paper presence sensor is provided in a medium conveying path to detect the state of the medium, thereby judging whether paper exists or paper is absent in the path. When paper exists during the printing process, it is judged that the printer is normal. Otherwise, it is judged that the printer is abnormal. A moving blade position sensor is provided in a cutter to detect the state of the moving blade of the cutter, thereby judging whether the cutter is reset or blocked. When the moving blade of the cutter is reset, it is judged that the printer is normal. Otherwise, it is judged that the printer is abnormal. A cover uplift sensor is provided between the printer cover and the printer main body to detect the state of the cover, thereby judging the opening or closing state of the cover. When the cover is closed, it is judged that the printer is normal. When the cover is open, it is judged that the printer is abnormal. A temperature detection sensor is provided in the printing head to detect the temperature of the printing head, thereby judging whether the temperature of the printing head is normal or overheated. When the temperature of the printing head is lower than a predetermined value, it is judged that the printer is normal. When the temperature is higher than the predetermined value, it is judged that the printer is abnormal.
It should be noted that the detection mechanism of the printer is not limited to the sensors mentioned above but can be set according to requirements. The sensor of the detection mechanism outputs normal or abnormal detection results according to respective judgment conditions.
Step 103: when the printer is abnormal, interrupting printing, and saving error information and corresponding receipt information into the FLASH memory.
During the printing process, when the controller receives the information fed back by the detection mechanism that the printer is abnormal, the controller would interrupt the printing operation immediately and sends alarm information. Meanwhile, the error information causing the abnormality of the printer and the current receipt information are saved into the FLASH memory, wherein the error information may include error type, error occurrence time and the like; the receipt information may include receipt identification which can identify the receipt content uniquely, for example, sequence number or detailed content of the receipt. By querying the information stored in the FLASH memory, it can be known which receipt is printed incompletely for what reason at what time and thus is invalidated
By recording (or saving) the error information in the printing process and the receipt information corresponding to the error, the control method of the printer provided by the disclosure can determine the validity of the receipt by querying the state of the receipt in the printing process, thereby avoiding the unreasonable charge of the receipt issuer on an invalid receipt and avoiding the pretending use of invalid receipts by the receipt buyer.
Step 201 and Step 202 are the same as Step 101 and Step 102.
Step 203: when the printer is abnormal, interrupting printing, and saving error information and corresponding encrypted receipt information into the FLASH memory.
During the printing process, when the controller receives the information fed back by the detection mechanism that the printer is abnormal, the controller would interrupt the printing operation immediately and sends alarm information. Meanwhile, the error information causing the abnormality of the printer and the current receipt information are saved into the FLASH memory. Before the receipt information is saved, the receipt information is processed first according to a stored key to generate encrypted data, then the encrypted data is stored in the FLASH memory together with the error information in a corresponding way, wherein the key can be stored in the FLASH memory, or can be stored in a separate memory, so that the controller of the printer can encrypt the error information and the printing data using the key when the printer stores the error information and the printing data. Moreover, in a condition that the FLASH memory is a mobile memory, a separate controller can be set in the mobile memory to encrypt the error information and the printing data using the key. In order to keep the corresponding relationship between the error information and the receipt information, the information can be saved in a fixed format.
The error information 44 refers to the error information occurring when the current receipt information is printed. Through this method, the error information and the receipt information are stored in a corresponding way.
By encrypting the receipt information before the receipt information is stored, the control method of the printer provided by the disclosure can prevent the receipt information from being read by lawbreakers and thus can prevent the lawbreakers from forging receipts, thereby improving the security of information storage.
Step 301 and Step 302 are the same as Step 101 and Step 102.
Step 303: interrupting printing.
During the printing process, when the controller receives the information fed back by the detection mechanism that the printer is abnormal, the controller would interrupt the printing operation immediately and sends alarm information.
Step 304: judging whether the FLASH memory is full. If yes, executing Step 305; otherwise, executing Step 306.
The amount of information the FLASH memory can store is relevant to the capacity of the FLASH memory. In order to guarantee that the latest information is normally saved in the FLASH memory, it is necessary to judge whether the FLASH memory is full before the information is stored in the FLASH memory. The specific method is to set a maximum record value according to the capacity of the FLASH memory and the maximum capacity of one piece of information and to set a counter, wherein the value of the counter increases by 1 each time a piece of information is stored in the memory. Before the information is stored, the counter value is compared with the maximum record value, when the counter value is greater than or equal to the maximum record value, it is considered that the FLASH memory is full. When the counter value is less than the maximum record value, it is considered that the FLASH memory is not full. When the FLASH memory is full, Step 305 is executed; otherwise, Step 306 is executed.
Step 305: deleting the earliest recorded information.
In order to save the latest error information and the receipt information, the storage space of the FLASH memory can be released by deleting the earliest recorded information.
Step 306: saving error information and corresponding encrypted receipt information in the FLASH memory.
The error information causing the abnormality of the printer and the current receipt information are saved in the FLASH memory. Before the receipt information is saved, the receipt information is processed first according to a predetermined key to generate encrypted data; then the encrypted data is stored in the FLASH memory together with the error information in a corresponding way.
Therefore, by circularly using the FLASH memory to record the error information in the printing process and the receipt information, the control method of the printer provided by the disclosure reduces the cost of equipment.
Step 401: when the printer is abnormal, sending current receipt information to an intelligent card controller.
When the printer is abnormal, the controller of the printer sends the current receipt information to the intelligent card controller.
Step 402: generating encrypted receipt information by the intelligent card controller.
The intelligent card controller encrypts the current receipt according to the key stored in the third memory of the intelligent card to generate encrypted data.
Step 403: saving error information and the encrypted receipt information.
The controller of the printer stores the encrypted receipt information and the error information into the fourth memory of the intelligent card in a predetermined format.
In the printer and the control method of the printer provided by the embodiment, the controller of the printer does not participate in the generation of receipt encryption information, thus the intelligent card and the key are uniformly managed by the receipt issuing department only and the receipts retailer has no right to read the information; therefore, the security of receipt data is guaranteed.
From the description above, it can be seen that the disclosure provides a basis for judging whether the printing is normal when printing fails due to a printing error during the printing process, and hereby provides evidence for solving the dispute between the buyer and the seller of the receipt and thus prevents the occurrence of the dispute. Moreover, the disclosure can determine the validity of the receipt by querying the state of the receipt in the printing process, thereby avoiding the unreasonable charge of the receipt issuer on an invalid receipt and avoiding the pretending use of invalid receipts by the receipt buyer, and providing evidence for solving disputes.
The above are only the preferred embodiments of the disclosure and not intended to limit the disclosure. For those skilled in the art, various modifications and changes can be made to the disclosure. Any modification, equivalent substitute and improvement made within the spirit and principle of the disclosure are deemed to be included within the scope of protection of the disclosure.
Number | Date | Country | Kind |
---|---|---|---|
201010229679.3 | Jul 2010 | CN | national |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/CN2011/077315 | 7/19/2011 | WO | 00 | 1/9/2013 |