This application claims priority to Japanese Application No. 2015-058009, filed Mar. 20, 2015, the entirety of which is incorporated by reference herein.
1. Technical Field
The present invention relates to a print control apparatus that controls a printer with a bi-directional communication function as a function of the Version 4 printer driver.
2. Related Art
A terminal operating under an environment of Windows (registered trademark) has a bi-directional communication function (BiDi) for executing bi-directional communication with a device such as a printer. Usage of the bi-directional communication function enables the terminal to transmit a request from an application to the printer and acquire response data from the printer in response to the request through a communication unit.
In the Version 4 printer driver (hereinafter, also referred to as “V4 printer driver”) operating under an environment of Windows 8 or its successors, the bi-directional communication function is defined as an extension function for device control. With the extension function, processing of transmitting a command from the application to the printer and processing of acquiring response data from the printer are executed by different interfaces (IFs) formed by Javascript (registered trademark). For example, in order to transmit the command issued by the application to the printer, a series of processing is executed using a set method of the extension function. On the other hand, in order to acquire the response data from the printer, a series of processing is executed using a get method of the extension function.
An example of related art is given at the following URL: http://msdn.microsoft.com/library/windows/hardware/br259124
In the bi-directional communication function of the V4 printer driver, synchronization between the processing by the set method and the processing by the get method is not made. Therefore, the command transmitted by the set method and the data acquired by the get method do not correspond to each other in some cases.
An advantage of some aspects of the invention is to provide a print control apparatus and a print control program capable of suppressing inconsistency between a transmission command and response data in a bi-directional communication function as an extension function of the V4 printer driver.
A print control apparatus according to an aspect of the invention controls a printer with a bi-directional communication function using a communication unit. A “terminal” may be any apparatus such as a personal computer, a tablet terminal, and a smartphone as long as the apparatus includes the V4 printer driver and can control the printer. The “communication unit” is an interface realizing communication between the printer and the print control apparatus and is an interface operating in accordance with the universal serial bus (USB), the transmission control protocol/internet protocol (TCP/IP), infrared communication, or the like.
A communication controller makes a transmission request for transmitting a transmission command generated in a print controller to the printer. The transmission command that is requested to be transmitted by the communication controller includes a transmission command generated by an application installed in the print controller and a transmission command generated by the communication controller.
The transmission controller transmits the transmission command to the printer through the communication unit in response to the transmission request. A reception controller acquires response data corresponding to the transmission command, having been transmitted from the transmission controller, from the printer through the communication unit and stores the acquired response data in a region of a storage unit in accordance with a type of the response data. Herein, the “transmission controller” and the “reception controller” are functions that are realized by the extension function of the V4 printer driver.
The communication controller acquires the response data stored in the region of the storage unit, which is determined in accordance with the type of the transmission command, as the response data corresponding to the transmission command.
In the aspect of the invention configured as described above, the reception controller stores the response data acquired from the printer in the region of the storage unit in accordance with the type of the response data and the communication controller acquires the response data from the corresponding region of the storage unit in accordance with the type of the transmission command. Therefore, acquisition of response data that does not correspond to the transmission command can be suppressed.
The invention will be described with reference to the accompanying drawings, wherein like numbers reference like elements
Hereinafter, embodiments of the present invention will be described in accordance with the following order.
The display 11 includes a display unit 111 for displaying an image and a touch panel module 112 for receiving an operation from a user. The display unit 111 includes a liquid crystal display (LCD) and a driver circuit for driving the LCD, for example, and is connected to the video card 13. The video card 13 connects the bus 15 and the display 11. The touch panel module 112 includes a sensor of an electrostatic capacity system or a resistive film system, and outputs a voltage value in accordance with a user operation position to the I/O IF 14.
The operation key 12 is configured by push-in-type buttons and is a user interface receiving an operation by the user.
The I/O IF 14 outputs a signal that is generated based on the operation on the touch panel module 112 or the operation key 12 by the user to the bus 15.
The CPU 16, the external storage device 17, the I/O IF 14, the RAM 18, the ROM 19, the video card 13, and the USB IF 20 are connected to the bus 15. The bus 15 includes a chip set (not illustrated) and controls communication between the CPU 16 and other devices.
The CPU 16 loads a program stored in the external storage device 17 or the ROM 19 on the RAM 18 and executes it so as to control the terminal 10 integrally. A basic input output system (BIOS) program that is executed when the CPU 16 starts the operation is stored in the ROM 19. The RAM 18 functions as a work area on which the program and data that are processed by the CPU 16 are loaded.
The external storage device 17 stores therein an operation system (OS) program 17a for giving a function to the CPU 16 as an OS, an application program 17b for giving functions of applications to the CPU 16, and a printer driver program (PDRV program) 17c controlling a printer 200 in cooperation with the OS. The OS program 17a is Windows 10 (Windows is a registered trademark), for example. The application program 17b allows the CPU 16 to realize the functions of the applications such as drawing software, a PDF file viewer, a browser, and a Web application. The PDRV program 17c is the V4 printer driver and includes an extension function.
The USB IF 20 includes a USB controller and a USB cable, and connects the bus 15 and the printer 200. In the embodiment, the communication unit is configured by the USB IF 20.
The printer 200 is an ink jet printer or a laser printer. The printer 200 conforms to the PDRV program 17c stored in the external storage device 17 and the driving thereof is controlled based on print data or a transmission command that is transmitted from the terminal 10 through the USB IF 20. It should be noted that the internal configuration of the printer 200 is well-known and description thereof is omitted.
The application 160 generates print data containing an image and text. The print data is supposed to be data adapted to the format of XML paper specification (XPS) but may be data adapted to other formats. Further, the application 160 has a function of issuing, to the printer 200, maintenance commands to acquire status information indicating a state of an ink remaining amount or the like and execute processing of cleaning or the like. Hereinafter, the command that is issued by the application 160 is referred to as a transmission command SC.
The OS 170 includes a spooler 171 and a USB port monitor 172 and controls the printer 200 in cooperation with the printer driver 180. The spooler 171 controls output processing of data (spool data) in print processing and transmission and reception of data in bi-directional communication. The USB port monitor 172 manages port numbers that are used by the application 160, the printer driver 180, and so on in communication, and substantially carries out communication using the above port numbers in the print processing and the bi-directional communication.
The printer driver 180 includes a high-level communication module 181, a graphics module 182, and an extension function unit 183. The high-level communication module (communication controller) 181 receives the print data from the application 160, and receives and transmits control data (transmission command SC, response data RD) from and to the application 160. In the print processing, the graphics module 182 converts the print data generated by the application 160 into a format which is supported by the printer 200. The extension function unit 183 is configured by modules for extending functions that are used in the print processing and the bi-directional communication.
The extension function unit 183 includes a plurality of function modules for respective functions. Each function module is configured by a script file formed by Javascript and an extensible markup language (XML) file. The XML file functions as a schema defining each function and the script file operates based on the XML file so as to provide an extended function to the printer driver 180. The respective function modules are made to operate by being called from the spooler 171.
Hereinafter, the function unit that is realized when the terminal 10 (CPU 16) uses the setSchema( ) is also referred to as a transmission controller and the function unit that is realized when the terminal 10 (CPU 16) uses the getSchemas( ) is also referred to as a reception controller.
Next, a print control method using the bi-directional communication function will be described.
At S1, the application 160 issues, to the printer 200, the transmission command to request status information (response data RD). For example, the status information is information that the application 160 displays on a UI screen indicating the state of the printer 200.
At step S2, the high-level communication module 181 performs processing of transmitting the transmission command to the printer 200.
At step S21, the high-level communication module 181 stores a type of the transmission command acquired from the application 160. The type of the transmission command is determined based on the contents of processing that are requested by the application 160, such as a request for the status information and a request for execution of the maintenance processing, for example.
At step S22, the high-level communication module 181 calls a function for calling setSchema( ) to the spooler 171. With the function called by the high-level communication module 181, a call request for setSchema( ) of the USB Bidi Extender 184 is made to the spooler 171.
At step S23, the high-level communication module 181 updates transmission time information STI. The transmission time information STI is information indicating time at which the high-level communication module 181 has started processing of transmitting the transmission command to the printer 200.
Returning to
At step S4, the transmission controller 185 controls the USB port monitor 172 and transmits the transmission command to the printer 200. The transmission command is transmitted to the printer 200 through the USB IF 20 with the function of the USB port monitor 172. When the printer 200 receives the transmission command through the USB IF 20, it interprets the transmission command and forms the response data RD corresponding to the transmission command.
Next, the reception control that is performed in the terminal 10 will be described.
When conditions under which the response data RD is requested are satisfied, the high-level communication module 181 makes an acquisition request for the response data RD at step S11. The acquisition request by the high-level communication module 181 is made when the spooler 171 executes the function for calling getSchemas( ).
At step S12, the spooler 171 calls getSchemas( ) from the USB Bidi Extender 184 of the extension function unit 183 in accordance with the function that is executed by the high-level communication module 181. By getSchemas( ) being executed, the CPU 16 functions as the reception controller 186.
At step S13, the reception controller 186 performs processing of acquiring the response data RD.
At step S131, the reception controller 186 acquires the response data RD transmitted from the printer 200 through the USB IF 20 (
At step S132, the reception controller 186 determines whether or not it has acquired the response data RD from the printer 200. When the reception controller 186 has acquired the response data RD (YES; at step S132), the reception controller 186 stores the received response data RD in the corresponding storage region (response data storage region) of the RAM 18 at step S133. The address of the response data storage region in which the reception controller 186 stores the response data RD is defined in the XML file of the extension function unit 183.
At step S134, the reception controller 186 updates reception time information RTI. The reception time information RTI is information indicating time at which the terminal 10 has acquired the response data RD. In
On the other hand, at step S132, when the reception controller 186 has not acquired the response data RD from the printer 200 (NO; at step S132), the reception controller 186 finishes the processing without executing the processing at step S133 and S134. In this case, the corresponding response data storage region in the RAM 18 is not updated.
Returning to
At step 151 in
At step S152, the high-level communication module 181 compares the transmission time information STI and the reception time information RTI. In the first embodiment, the high-level communication module 181 checks the response data using the transmission time information STI and the reception time information RTI in addition to the response data storage region provided for each response data. With this, inconsistency between the transmission command SC and the response data RD, that is, understanding the wrong response data RD as response data corresponding to the transmitted transmission command is suppressed.
In
When the transmission time information STI precedes (is earlier than) the reception time information RTI (YES; at step S152), at step S153, the high-level communication module 181 determines that the appropriate response data RD has been received because the transmission time and the reception time are consistent in time series, and then transmits the response data RD to the application 160 for the following reason. That is, when time indicated by the transmission time information STI precedes (is earlier than) time indicated by the reception time information RTI, as illustrated in
When the transmission time information STI follows (is closer to the current time than) the reception time information RTI (NO; at step S152), at step S154, the high-level communication module 181 determines that the appropriate response data RD has not been received because the transmission time and the reception time are not consistent in time series, and issues a request for the response data RD to the spooler 171 again for the following reason. That is, when time indicated by the transmission time information STI follows (is closer to the current time than) time indicated by the reception time information RTI, as illustrated in
In the first embodiment as described above, in the terminal (print control apparatus) 10 having the bi-directional communication function of the V4 printer driver, the reception controller 186 stores the response data RD that is acquired from the printer 200 in the response data storage region in the RAM 18 in accordance with the type thereof. Then, the high-level communication module (communication controller) 181 acquires the response data from the corresponding response data storage region in accordance with the type of the transmission command SC.
For example, in the case where the response data RD corresponding to the transmission command SC transmitted previously could not be acquired from the printer 200, or in the case where reading out, rewriting, or the like of data defined in the XML file is performed in the OS 170, correspondence between the transmission command SC and the response data RD can be kept appropriately by providing the response data storage region for each response data. As a result, the high-level communication module 181 can suppress acquisition of the response data RD that does not correspond to the transmission command SC.
The high-level communication module 181 holds the transmission time information indicating time at which the transmission request for the transmission command SC has been made and the reception controller 186 stores the reception time information indicating time at which the response data has been acquired in the storage unit. Then, the high-level communication module 181 determines whether or not the response data stored in the response data storage region corresponds to the transmission command SC based on the reception time information and the transmission time information, thereby strictly suppressing the wrong acquisition of response data that does not correspond to the transmission command SC.
Usage of the USB IF as the communication unit is merely an example, and the communication unit may be an interface with which the printer and the host device makes one-to-one communication such as infrared communication and IEEE1394.
The terminal may be any devices such as a tablet terminal and a smartphone other than the personal computer as long as it includes the V4 printer driver and can control the printer.
It is needless to say that the invention is not limited to the above-mentioned embodiments. It is obvious to those skilled in the art to combine, change, or modify the following configurations, parts, and so on: Parts, configurations, and the like as disclosed in the above-mentioned embodiments, which can be replaced by one another, being applied while combinations thereof are changed appropriately;
Parts, configurations, and the like that are not disclosed in the above-mentioned embodiments but are well-known techniques and can be made replacement between them and the parts, the configurations, and the like as disclosed in the above-mentioned embodiments being applied while appropriately replacing them or changing combinations thereof; and
Parts, configurations, and the like that are not disclosed in the above-mentioned embodiments but can be conceived as substitutions for the parts, the configurations, and the like as disclosed in the above-mentioned embodiments by those skilled in the art based on well-known techniques and the like being applied while replacing them or changing combinations thereof.
Number | Date | Country | Kind |
---|---|---|---|
2015-058009 | Mar 2015 | JP | national |