Printing service architecture, method and control system based on local service
By deploying a local service-based printing service architecture on the user side, using the control endpoint module and batch endpoint module to interact with the printer, the problems of unstable communication and inability to interact with the printer are solved in USB printing technology, efficient printing task management and two-way communication are achieved, and printing efficiency and user experience are improved.
Patent Information
- Application Number
- CN202510126977.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-27
- Publication Date
- 2025-06-03
AI Technical Summary
The existing USB printing technology has problems such as instability in communication, inability to interact in real time, delay in printing startup, and crosstalk during multi-task printing.
Adopting a local service-based printing service architecture, the control endpoint module and batch endpoint module interact with the printer to realize status query, printing control and data transmission. This architecture allows different applications on the user side to communicate with the printing service architecture through IP:Port, monitor printer status in real time and perform appropriate control.
It effectively solves the problems of improper resource management, data crosstalk and inability to achieve two-way interaction in traditional USB printing methods, realizes efficient printing task management and two-way communication, and improves printing efficiency and user experience.
Smart Images

Figure CN120085818A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of USB printing, and particularly to a printing service architecture, method and control system based on local services. Background Art
[0002] The current local USB printing method on the market directly communicates with the printer through the USB interface of the computer, which has the advantages of simple operation and stable data transmission, but there are some limitations. USB printing cannot achieve real-time two-way interaction during the data transmission process. Secondly, crosstalk problems are likely to occur when multiple tasks are executed in parallel. For example, in the Windows system, multiple applications can access the printer through the USB connection at the same time. If data or instructions are sent simultaneously, data crosstalk will occur. In the MacOS or Linux system, if an application has already connected to the USB, other applications cannot successfully connect, which is not conducive to managing multiple printing tasks from different applications at the same time.
[0003] In addition, when the printer configuration is low or the resolution of the printed file is too high, data needs to be received and printed simultaneously during the printing process. If the printer malfunctions or the printing speed is too slow, communication blockage may occur, and subsequent data and instructions (such as canceling printing, querying status, etc.) cannot be responded to, thereby affecting the printing efficiency and reducing the operation flexibility.
[0004] In summary, although the existing USB printing technology meets the daily printing needs to a certain extent, there are still problems such as unstable communication, inability to achieve real-time two-way interaction, printing startup delay, and crosstalk during multi-task printing.
[0005] In view of this, the present application is proposed. Summary of the Invention
[0006] The present invention provides a printing service architecture, method and control system based on local services, which can at least partially improve the above problems.
[0007] To achieve the above object, the present invention adopts the following technical solutions:
[0008] A printing service architecture based on local services, one end of the printing service architecture is connected to the application program and / or driver of the user side, the other end is connected to the printer through USB, and interacts with the printer through a control endpoint module and a bulk endpoint module;
[0009] The control endpoint module is used to send a status query instruction, a printing control instruction to the connected printer and receive the printer feedback information;
[0010] The bulk endpoint module is used to send the printing data sent by the user side to the printer in a manner of transmitting and printing simultaneously;
[0011] Wherein, when a printing exception or a transmission exception occurs during the process of printing while transmitting a job, the control endpoint module sends a status query instruction to the printer and receives first feedback information from the printer, and the control endpoint module sends a printing control instruction to the printer to control the printer to pause or cancel the printing job.
[0012] The present invention also provides a printing service method based on local services, which includes:
[0013] The control endpoint module sends a status query instruction, a printing control instruction to the connected printer and receives printer feedback information;
[0014] The bulk endpoint module sends the printing data sent by the client to the printer in a way of printing while transmitting;
[0015] Wherein, when a printing exception or a transmission exception occurs during the process of printing while transmitting a job, the control endpoint module sends a status query instruction to the printer and receives first feedback information from the printer, and the control endpoint module sends a printing control instruction to the printer to control the printer to pause or cancel the printing job.
[0016] The present invention also provides a USB printing control system based on local services, which includes a client, a printer, and the USB printing control architecture according to any one of the above, and the data end of the USB printing control device based on local services is communicatively connected to the data ends of the client and the printer.
[0017] In summary, the printing service architecture based on local services can be regarded as a dedicated printing service program installed on the client, responsible for receiving and processing printing requests from different application programs and drivers on the client, and communicating with the printer; through the IP:Port method, different application programs and drivers on the client can communicate with the printing service architecture, send printing tasks and instructions, can obtain the working status of the printer in real time, and make appropriate control and adjustment accordingly. It effectively solves the problems of improper resource management, data crosstalk and inability to achieve two-way interaction in the traditional USB printing method.
[0018] Briefly speaking, the present invention is to deploy an independent printing service architecture on the user side, centrally manage the printing requests from different application programs and drivers on the user side, and communicate efficiently with the printer. This service can monitor the printer status in real time, achieve two-way communication, avoid data crosstalk, and record the progress when the communication is interrupted or data error occurs, so as to achieve the breakpoint resume function; communicate with different application programs and drivers on the user side through the IP:Port method, receive printing tasks and instructions, and manage multiple printing tasks through the printing task management module to ensure the correctness and integrity of task output. In addition, the original printing data is processed and optimized to reduce the startup time of printing tasks and improve printing efficiency. The user can configure the service through the control panel to adapt to different office environments and printing loads. Description of the Drawings
[0019] Figure 1 is a schematic structural diagram of a printing service architecture based on local service provided by the first embodiment of the present invention;
[0020] Figure 2 is an overall process schematic diagram of a printing service method based on local service provided by the second embodiment of the present invention. Detailed Embodiments
[0021] In order to make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below with reference to the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0022] Please refer to Figure 1 , the first embodiment of the present invention discloses a printing service architecture based on local service. One end of the printing service architecture is connected to the application program and / or driver of the user side, and the other end is connected to the printer through USB, and interacts with the printer through the control endpoint module and the bulk endpoint module;
[0023] The control endpoint module is used to send a status query instruction, a print control instruction to the connected printer and receive the printer feedback information;
[0024] The bulk endpoint module is used to send the printing data sent by the user side to the printer in the way of printing while transmitting;
[0025] Wherein, when a printing exception or a transmission exception occurs during the printing while transmitting operation, the control endpoint module sends a status query instruction to the printer and receives the first feedback information of the printer, and the control endpoint module sends a print control instruction to the printer to control the printer to pause or cancel the printing job.
[0026] In this embodiment, the printing service architecture is a middleware or printing service architecture integrated on the client side. It runs as an independent process and is responsible for receiving printing requests from different applications on the client side (such as various text, picture, document editing applications or drivers), performing data processing and conversion, and communicating with the printer.
[0027] Specifically, first ensure that the printing service architecture has been successfully installed on the client side and is connected to the printer through the USB interface. The printing service architecture acts as a background process, ready at any time to receive printing requests from the applications on the client side; when the user selects the printing option in the application on the client side, the printing service architecture will immediately respond to the start printing signal. The start printing signal sent by the application on the client side is received through the USB control endpoint connected to the printer. This signal triggers the printing service architecture to enter the active state and prepares to communicate with the printer. In actual use, the printing service architecture can query the current status of the printer to ensure that the printer is in an available state (such as paper margin, error status, etc.) and is ready to receive new printing tasks. This prevents sending printing tasks when the printer is busy or has an error, thus avoiding possible communication conflicts and printing failures.
[0028] It should be noted that the printing process uses two endpoints for division of labor. The USB control endpoint is used to send and receive instructions and actively return status, and the bulk endpoint is used to send printing data more purely. When the bulk endpoint is blocked by printing data, the communication of the control endpoint is normal, enabling the printer to not only send status to the printing service architecture but also receive instructions sent by the printing service architecture. Among them, through the USB control endpoint, usually endpoint 0, small control commands can be sent, such as requesting the device to perform certain operations or starting data transmission. The amount of such data is usually small, meeting the limitations of control transfer, that is, each packet is up to 64 bytes or larger, depending on the USB protocol version. When transferring large amounts of data, usually through the bulk endpoint, the bulk endpoint is suitable for large-scale operations such as file transfer and image transfer.
[0029] During the process of sending print data to the printer, the print data is sent in packets starting from the bulk endpoint according to the maximum packet length. The sending order of the data is based on the length of the print data of the current page and the offset of the cache. During the sending process, there is no need to wait for the printer to confirm that the current protocol packet has been successfully received. Instead, packets are continuously sent to reduce communication waiting time. Specifically, when the control endpoint module receives the first feedback information from the printer, the user can view the first feedback information in real time through the interface of the user terminal, and then send corresponding print control instructions to the printer through the control endpoint module to control the printer to pause or cancel the print job. This is because the control endpoint is constantly polling and reading the data replied by the printer. Therefore, when the printer is abnormal or the transmission is abnormal, the user can directly send information to the control endpoint. At this time, only the read data needs to be parsed to understand what corresponding steps need to be executed next.
[0030] For example: when the first feedback information is a data verification error, at this time, it may be necessary to resend a certain packet of a certain page to the printer. The user sends a corresponding instruction through the control endpoint module, and the print service architecture can directly send the corresponding data packet.
[0031] When the first feedback information is that the printer resources are restricted, the user sends a stop sending instruction through the control endpoint module to notify the print service architecture to pause sending data, and the print service architecture will correspondingly stop sending the next data packet.
[0032] When the first feedback information is an unrecoverable error, the user sends a stop printing instruction through the control endpoint module to further notify the print service architecture to cancel the print task.
[0033] In a preferred embodiment, the control endpoint module can send a print control instruction to the printer based on the first feedback information to control the printer to pause or cancel the print job. For example: when the first feedback information is a data verification error, the control endpoint module automatically sends a corresponding instruction, and the print service architecture can directly send the corresponding data packet; when the first feedback information is that the printer resources are restricted, the control endpoint module automatically sends a stop sending instruction to notify the print service architecture to pause sending data, and the print service architecture will correspondingly stop sending the next data packet; when the first feedback information is an unrecoverable error, the control endpoint module automatically sends a stop printing instruction to further notify the print service architecture to cancel the print task.
[0034] Specifically, in this embodiment, the client can communicate with the printing service architecture in the IP:Port manner to send printing tasks and instructions. This communication method allows the printing service architecture to establish a stable connection with the client at the network level, ensuring that printing tasks and instructions can be accurately transmitted from the client to the printing service architecture. Through this communication method, the printing service architecture can receive printing tasks and instructions sent by the application on the client through the control endpoint module. These tasks and instructions include the files to be printed, printing settings, and any specific printing requirements.
[0035] In this embodiment, the printing service architecture connects the client to the printer, thereby optimizing the use of printer connection resources; this means that multiple applications on the client can communicate with the printer through the same printing service architecture and use the same USB connection, solving the problems of resource preemption and exclusivity.
[0036] Preferably, the control endpoint module is further configured to:
[0037] When a priority printing item is detected during the process of printing while transmitting, send a printing control instruction to the printer to control the printer to pause or cancel the printing job, terminate the current data transmission of the bulk endpoint, and issue a printing request instruction for the priority printing item to the bulk endpoint module;
[0038] The bulk endpoint module is configured to send the printing data corresponding to the printing request instruction to the printer when receiving the printing request instruction for the priority printing item.
[0039] Specifically, in this embodiment, when it is determined that the priority of the current task is relatively high, the printer is controlled to pause or cancel the printing job, and the current data transmission of the bulk endpoint is terminated; and according to the issued printing request instruction for the priority printing item, the printing task with a higher priority is printed.
[0040] Preferably, it further includes: a format conversion module, configured to perform format conversion on the printing data received from the client to generate printing instructions suitable for printer processing, where the format conversion module is in a driving state in all operating states of the printing service architecture;
[0041] A printing task management module, configured to manage the current task queue of the printer, and obtain real-time information fed back by the printer through the control endpoint, where the management operations include querying, queue sorting, canceling the queue, and pausing the printing task;
[0042] A printer locking module, configured to lock the current printing application of the printer according to the real-time information fed back by the printer, and reject the printing request instructions sent by other applications on the client;
[0043] Among them, each task record information in the task queue includes a task ID, task creator information, total number of printed pages, total number of printed copies, current number of printed pages, length of printed data received for the current page, and current number of printed copies.
[0044] Specifically, in this embodiment, the print task management module manages print tasks initiated by multiple applications based on a queue mechanism; this queue management mechanism ensures that multiple print tasks can be processed orderly, avoids data crosstalk between tasks, and improves print efficiency. At the same time, the print service architecture preprocesses the print data, including format conversion and resource preloading, which not only reduces the startup time of print tasks but also improves the overall print efficiency.
[0045] Preferably, the format conversion module includes a data preprocessing unit and an instruction conversion unit;
[0046] The data preprocessing unit is used to preprocess the print data received from the user side, and the preprocessing includes at least one of image processing, grayscale processing, and size adjustment;
[0047] The instruction conversion unit is used to perform format conversion on the preprocessed print data to generate print instructions suitable for printer processing.
[0048] Specifically, in this embodiment, after receiving a print request, the print service architecture processes the original print data, including operations such as format conversion and resource preloading (such as fonts and images), thereby reducing the startup time of print tasks and improving the overall print efficiency; and it can automatically optimize the data format according to the printer model to ensure the best print quality and compatibility.
[0049] In this embodiment, when the print process starts, first check whether there are unfinished print tasks. If there is unfinished print data, directly send the print data and prepare to continue sending the unfinished tasks. Subsequently, send a query request to the printer through the control endpoint to obtain the current task queue information; this query can help the user side determine whether to allow creating a new print task or view the detailed information of existing tasks. If the task queue is full, you can choose to manage or cancel existing tasks to make room for new tasks. And when it is confirmed that a new task is allowed to be created, the print service architecture sends a create task request to the printer through the control endpoint and obtains a task ID.
[0050] Specifically, first query the task list of the current printer. The user side can cancel tasks and view the task sources on the visualization interface of the printing service architecture (such as: Web page or service client, etc.). The task queue in the printer contains information such as task ID (taskID), task creator information, total number of printed pages, total number of printed copies, current number of printed pages, length of printed data received for the current page, current number of printed copies, and whether it is allowed to create another printing task. In actual use, the user side can notify the printer to cancel the corresponding printing task through the task ID (TaskID) information to avoid resource waste and task conflicts; it can also create a printing task and needs to locally maintain the cache of the printed data for task recovery and resume from breakpoint, and inform the printer of the creator information, total number of printed pages, and total number of printed copies. After successful creation, the printer will return the task ID (taskID).
[0051] Preferably, the printing task management module is further configured to, after receiving a printing task initiated by an application program, sort the tasks in the task queue according to the priority relationship and printing status between the new printing task and the original printer tasks.
[0052] Specifically, in this embodiment, the printing service structure manages the printing tasks initiated by multiple applications through a queue mechanism. After each printing task enters the queue, the printing service architecture schedules it according to its priority and status to avoid data crosstalk between different tasks; effectively solve the printing conflict problem in a multi-application environment and ensure the correctness and integrity of task output. That is, after receiving a printing task, the task is placed in the printing queue according to the priority of the task and the current status of the printer.
[0053] Preferably, the bulk endpoint module is further configured to: perform compression and packetization processing on the printing data corresponding to the printing task sent by the current application of the user side, and perform caching to obtain multi-packet compressed printing data, and send the multi-packet compressed printing data to the printer packet by packet through the data channel;
[0054] Obtain the printing data corresponding to the printing task sent by the current application of the user side, parse the printing data, and determine the maximum data packet length allowed by the printer for parsing;
[0055] Decompose and compress the printing data into multiple data packets according to the maximum data packet length;
[0056] Send the compressed data packets to the printer packet by packet through the data channel, where the data area of the data packet includes task ID + current page number + printing data offset + printing data length + printing data;
[0057] Among them, during the printing data transmission process, a communication protocol including a protocol area and a data area is adopted for communication, and its protocol rules are: packet header + packet sequence number + data area length + protocol header checksum + data area + data area CRC checksum.
[0058] Specifically, in this embodiment, the client will cache the task ID and related printing information (such as task creator information, total number of printed pages, total number of copies to be printed, current printed page number, length of received printing data, etc.). These information will be used for task recovery and resume from breakpoint, especially in the case where the printing service architecture is shut down or the USB connection is interrupted. Among them, the maximum packet length that the printer allows to parse can be queried to optimize the data packet splitting and sending strategy and improve the transmission efficiency.
[0059] In this embodiment, a communication protocol including a protocol area and a data area is adopted for communication. Using this communication protocol including a protocol area and a data area for data transmission ensures the reliability and accuracy of data transmission. Among them, the packet header is used to identify the start of the data packet; the packet sequence number is used to identify the order of the data packets to ensure that the data packets are assembled in the correct order; the data area length identifies the length of the data area so that the receiving end knows the size of the data area; the protocol header checksum is used to check the integrity of the entire protocol header to ensure that the information in the protocol area is correct; the data area is implemented by specific instructions such as querying, setting, and printing data, and needs to be extended by itself; the data area CRC checksum is used to check the integrity of the data area to ensure that the data has not been tampered with during transmission. If it has been tampered with, it needs to be resent.
[0060] During the data transmission process, the receiving end verifies and assembles the data packets according to the information in the protocol area. If a data error or communication interruption is detected, transmission continues from the error point through the resume from breakpoint mechanism to ensure the integrity and continuity of data transmission.
[0061] Preferably, the control endpoint module is also used to receive the data transmission progress sent by the printer in real time;
[0062] When it is determined that the data transmission progress is completed, the printer is controlled to perform printing until all the printing data is printed, and the printing is ended or the next printing task is processed;
[0063] Among them, the data transmission progress includes: successful data reception, resend the current protocol packet, pause sending, completion, and error.
[0064] Specifically, in this embodiment, the print service architecture enhances the flexibility of the printing system, and the user end can also configure the print service architecture through the control panel, including setting print priority, managing print queues, monitoring print status, etc. This function ensures that the user can adjust the operating parameters of the print service architecture according to actual needs to adapt to different office environments and printing loads.
[0065] In addition, the printer will notify the print service architecture of the progress of print data transmission in real time through the control endpoint. The notification content includes the task ID, the current number of printed pages, the length of print data received for the current page, and the subsequent actions that the print service architecture needs to perform (such as successful data reception, retransmission of the current protocol packet, suspension of transmission, completion, error, etc.). Among them, when the CRC check of the data area is correct and the corresponding task ID, page number, print offset and other information are matched, the data is judged to be received successfully, and the cache information of the offset needs to be updated at this time; when the CRC check is incorrect or other errors occur, the receiving end will require the user end to resend the current protocol packet to ensure data integrity. At this time, it is necessary to restart the packet transmission from the offset of the last "data reception success"; when the printer resources are tight and cannot continue to receive data, it will receive an instruction to suspend transmission and need to wait for the resources to be released before continuing the transmission. At this time, stop sending data and wait until the "data reception success" notification is received before continuing to send; the print data of the current page has been fully received and verified, and the print task can continue to process the next page of data; when the task ID, page number, print offset and other information do not match, or other serious errors occur, the printer will return an error notification, cancel the data transmission, and record the printing error. Appropriate measures need to be taken according to the specific situation.
[0066] Preferably, the printing service architecture further includes a pop-up reminder module;
[0067] The pop-up reminder module is used to:
[0068] When it is determined that the current state of the printer is an abnormal state, a pop-up window reminder is sent to the user terminal to remind the user to cancel printing or retry printing, wherein the abnormal state includes an unrecoverable error, a recoverable error, and a cancelable mark;
[0069] When the application result is judged to be a printing failure, a pop-up window reminder is sent to the user to remind the user to cancel the printing or retry the printing;
[0070] During the data transmission process, when it is detected that the USB connection with the printer is interrupted or the user end is closed, retry to connect to the printer and send a pop-up reminder to the printer or the user end to remind the user that the printing failed;
[0071] When it is detected that the printer is reconnected and the printer status is normal, query the breakpoint in the print data based on the print data offset where the last data transmission progress was successful; based on the breakpoint, resend the untransmitted compressed print data to the printer in packets.
[0072] Specifically, in this embodiment, when the printer has an abnormal status, the user is reminded to cancel or retry through a pop-up window. The error types with abnormal status include: one is an irrecoverable error, such as paper jams, etc., which requires manual handling before retrying; the other is a recoverable error, such as canceling the existing tasks in the printer and then going through the query status process; the third is a cancellable annotation, that is, no data is received after a timeout.
[0073] In this embodiment, during the printing process, the print service architecture can achieve instruction interaction and effectively monitor the printing status, thus avoiding data crosstalk in communication. By controlling the endpoint to start listening for print data transmission progress notifications, real-time feedback information from the printer can be obtained, including the reception status of tasks and subsequent instructions. That is, during the data transmission process, if there is a network connection interruption with the printer or the user-side application is accidentally closed, after reconnecting, based on the offset of the last "data received successfully" cached, the unfinished print task can be resumed and continued to be sent.
[0074] Through status recording and processing, the resume function is realized. When a communication interruption or data transmission error occurs during the printing process, the print service architecture will automatically record the current print offset. After the communication is restored, the unfinished print task can be continued to be executed, realizing the resume function; this function ensures the continuity of the print task and reduces the time and resource waste caused by interruptions.
[0075] Simply put, during the printing process, the print service architecture will monitor the status of the printer in real time and receive the status feedback of the printer through the USB control endpoint; that is, when a communication interruption or data error occurs, it can record the current progress and realize the resume function; after reconnecting, the unfinished print task can be continued to ensure the integrity and continuity of the data.
[0076] Please refer to Figure 2 , for example, regular heartbeats can be performed through the control endpoint to monitor progress information, task status, single-page status, etc. in real time. When an abnormal disconnection is detected through heartbeat timeout, such as 5S, an automatic reconnection is performed. If the reconnection fails, a pop-up window will remind the user, and if the reconnection is successful, resume from the breakpoint will be performed.
[0077] This two-way communication mechanism enables the print service architecture to respond promptly to changes in the printer's status, such as low ink cartridges or out-of-paper, and thus perform appropriate control and adjustment. If a communication interruption or data error occurs during the printing process, the print service architecture will record the current printing progress, and after the communication is restored, continue the printing task from the recorded progress point, realizing the function of resuming interrupted downloads. This function significantly improves the continuity of printing tasks and reduces the time and resource waste caused by interruptions.
[0078] In summary, in view of the problems of unstable communication, improper resource management, data crosstalk, and inability to perform two-way interaction existing in traditional USB-connected printers, a USB printing method based on local services is proposed. By deploying a dedicated print service architecture on the user side, it not only optimizes the use of printer connection resources but also realizes two-way communication with the printer, effectively monitors the printing status, avoids data crosstalk in communication, and records the progress when communication is interrupted or data is in error, realizing the function of resuming interrupted downloads, significantly enhancing the continuity and reliability of printing tasks. Generally speaking, the USB printing method based on local services realizes efficient communication and two-way interaction with the printer, optimizes the management of printing tasks, improves printing efficiency and user experience; the implementation of this method provides users with a more stable, reliable and efficient printing solution, greatly improving the stability and efficiency of printing work.
[0079] Please refer to Figure 2 , the second embodiment of the present invention provides a print service method based on local services, which is applied to the print service architecture described in any one of the above, and includes:
[0080] The control endpoint module sends a status query instruction, a print control instruction to the connected printer and receives the printer feedback information;
[0081] The bulk endpoint module sends the print data sent by the user side to the printer in a way of printing while transmitting;
[0082] Wherein, when a printing exception or a transmission exception occurs during the printing-while-transmitting operation, the control endpoint module sends a status query instruction to the printer and receives the first feedback information of the printer, and the control endpoint module sends a print control instruction to the printer to control the printer to pause or cancel the printing job.
[0083] The third embodiment of the present invention provides a USB printing control system based on local services, which includes a user side, a printer, and a USB printing control architecture based on local services described in any one of the above. The data end of the USB printing control device based on local services is communicatively connected to the data ends of the user side and the printer.
[0084] The above are the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and modifications can be made, and these improvements and modifications are also regarded as the protection scope of the present invention.
Claims
1. A printing service architecture based on local services, characterized in that: The print service architecture is connected to the application and / or driver at the user end at one end, and is connected to the printer via USB at the other end, and interacts with the printer via a control endpoint module and a batch endpoint module; The control endpoint module is used to send status query instructions and print control instructions to the connected printer and receive printer feedback information; The batch endpoint module is used to send the print data sent by the user end to the printer in a transmission and printing manner; Among them, when a printing abnormality or transmission abnormality occurs during a transmission and printing job, the control endpoint module sends a status query instruction to the printer and receives the first feedback information of the printer, and the control endpoint module sends a print control instruction to the printer to control the printer to pause or cancel the print job.
2. The local service-based printing service architecture according to claim 1, characterized in that: The control endpoint module is also used to: When a priority printing item is detected during the transmission and printing process, a print control instruction is sent to the printer to control the printer to pause or cancel the print job, terminate the current data transmission of the batch endpoint, and issue a print request instruction of the priority printing item to the batch endpoint module; The batch endpoint module is used to send the print data corresponding to the print request instruction to the printer when receiving the print request instruction of the priority print item.
3. The local service-based printing service architecture according to claim 1, characterized in that: Also includes: A format conversion module, used for converting the format of the print data received from the user end, and generating a print instruction suitable for processing by the printer, wherein the format conversion module is in a driving state in all operating states of the print service architecture; The print task management module is used to manage the current task queue of the printer and obtain the real-time information fed back by the printer through the control endpoint, wherein the management operations include querying, queue sorting, queue cancellation, and pausing print tasks; The printer locking module is used to lock the current printing application of the printer according to the real-time information fed back by the printer, and refuse to receive the printing request instructions sent by other applications of the user end; Among them, each task record information in the task queue includes task ID, task creator information, total number of printed pages, total number of printed copies, current number of printed pages, length of print data received for the current page, and current number of printed copies.
4. The local service-based printing service architecture according to claim 3, characterized in that: The format conversion module includes a data preprocessing unit and an instruction conversion unit; The data preprocessing unit is used to preprocess the print data received from the user end, wherein the preprocessing includes at least one of image processing, grayscale processing and size adjustment; The instruction conversion unit is used to convert the format of the pre-processed printing data to generate a printing instruction suitable for processing by the printer.
5. The local service-based printing service architecture according to claim 3, characterized in that: The printing task management module is also used to sort the new printing tasks and the original printer tasks in the task queue according to the priority relationship and printing status after receiving the printing tasks initiated by the application.
6. The local service-based printing service architecture according to claim 1, characterized in that: The batch endpoint module is also used to: compress and packetize the print data corresponding to the print task sent by the current application of the user end, cache it, obtain multiple packages of compressed print data, and send the multiple packages of compressed print data to the printer in packages through the data channel; Acquire the print data corresponding to the print task sent by the current application of the user end, parse the print data, and determine the maximum data packet length allowed to be parsed by the printer; Decompose and compress the print data into multiple data packets according to the maximum data packet length; The compressed data packets are sent to the printer in packets through the data channel, wherein the data area of the data packet includes the task ID+the current page number+the print data offset+the print data length+the print data; Among them, during the printing data transmission process, a communication protocol including a protocol area and a data area is used for communication, and its protocol rules are: packet header + packet sequence number + data area length + protocol header check + data area + data area CRC check.
7. The local service-based printing service architecture according to claim 1, characterized in that: The control endpoint module is also used to receive the data transmission progress sent by the printer in real time; When it is determined that the data transmission progress is completed, the printer is controlled to print until all the print data is printed, and the printing is ended or the next print task is processed; The data transmission progress includes: successful data reception, retransmission of current protocol packet, pause of transmission, completion and error.
8. The local service-based printing service architecture according to claim 3, characterized in that: The printing service architecture also includes a pop-up reminder module; The pop-up reminder module is used to: When it is determined that the current state of the printer is an abnormal state, a pop-up window reminder is sent to the user terminal to remind the user to cancel printing or retry printing, wherein the abnormal state includes an unrecoverable error, a recoverable error, and a cancelable mark; When the application result is judged to be a printing failure, a pop-up window reminder is sent to the user to remind the user to cancel the printing or retry the printing; During the data transmission process, when it is detected that the USB connection with the printer is interrupted or the user end is closed, retry to connect to the printer and send a pop-up reminder to the printer or the user end to remind the user that the printing failed; When it is detected that the printer is reconnected and the printer is in normal state, the interruption point in the print data is queried according to the print data offset of the last successful data transmission progress; based on the interruption point, the unsent compressed print data is resent to the printer in packets.
9. A printing service method based on local service, characterized in that: The method is applied to the printing service architecture according to any one of claims 1 to 8, and comprises: The control endpoint module sends status query instructions and print control instructions to the connected printer and receives printer feedback information; The batch endpoint module sends the print data sent by the user end to the printer in a transmission and printing manner; Among them, when a printing abnormality or transmission abnormality occurs during a transmission and printing job, the control endpoint module sends a status query instruction to the printer and receives the first feedback information of the printer, and the control endpoint module sends a print control instruction to the printer to control the printer to pause or cancel the print job.
10. A USB printing control system based on local service, characterized in that: It comprises a user end, a printer, and a local service-based USB printing control architecture as described in any one of claims 1 to 8, wherein the data end of the local service-based USB printing control device is communicatively connected with the data end of the user end and the printer.