JP6680060B2 - Print control device and print control program - Google Patents

Print control device and print control program Download PDF

Info

Publication number
JP6680060B2
JP6680060B2 JP2016083231A JP2016083231A JP6680060B2 JP 6680060 B2 JP6680060 B2 JP 6680060B2 JP 2016083231 A JP2016083231 A JP 2016083231A JP 2016083231 A JP2016083231 A JP 2016083231A JP 6680060 B2 JP6680060 B2 JP 6680060B2
Authority
JP
Japan
Prior art keywords
response data
transmission command
transmission
identification information
printer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2016083231A
Other languages
Japanese (ja)
Other versions
JP2017194758A (en
Inventor
哲也 若▲狭▼
哲也 若▲狭▼
裕保 尾形
裕保 尾形
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Seiko Epson Corp
Original Assignee
Seiko Epson Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2016083231A priority Critical patent/JP6680060B2/en
Publication of JP2017194758A publication Critical patent/JP2017194758A/en
Application granted granted Critical
Publication of JP6680060B2 publication Critical patent/JP6680060B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Accessory Devices And Overall Control Thereof (AREA)

Description

本発明は、プリンターを制御する印刷制御装置および印刷制御プログラムに関する。   The present invention relates to a print control device and a print control program that control a printer.

Windows(登録商標)環境下で動作する端末では、プリンター等のデバイスとの間で双方向通信を実行するための双方向通信機能(BiDi)を備えている。双方向通信機能を用いることで、端末は、アプリケーションからの要求のプリンターへの送信と、この要求に応じたプリンターからの応答データの取得とを、通信部を介して実現することができる。   A terminal operating under a Windows (registered trademark) environment has a bidirectional communication function (BiDi) for executing bidirectional communication with a device such as a printer. By using the bidirectional communication function, the terminal can realize the transmission of the request from the application to the printer and the acquisition of the response data from the printer in response to the request via the communication unit.

Windows8以降の環境下で動作するVersion4プリンタードライバー(以下、V4プリンタードライバーとも記載する。)では、双方向通信機能はデバイス制御のための拡張機能として定義されている。この拡張機能では、アプリケーションからプリンターへコマンドを送信する処理と、プリンターからの応答データを取得する処理とは、Javascript(登録商標)で作成された別々のインターフェイス(IF)により実現されている。例えば、アプリケーションで発行したコマンドをプリンターに送信するためには、拡張機能のsetメソッドを用いて一連の処理が行われる。一方、プリンターからの応答データの取得は、拡張機能のgetメソッドを用いて一連の処理が行われる。   In a Version 4 printer driver (hereinafter, also referred to as a V4 printer driver) that operates under the environment of Windows 8 or later, the bidirectional communication function is defined as an extended function for device control. In this extended function, the process of transmitting a command from the application to the printer and the process of acquiring response data from the printer are realized by separate interfaces (IF) created by Javascript (registered trademark). For example, in order to send the command issued by the application to the printer, a series of processes are performed using the set method of the extended function. On the other hand, to acquire response data from the printer, a series of processes is performed using the get method of the extended function.

また、XPS(XML Paper Specification)仕様で記述されたXPSファイルを処理するXPSプリンタードライバーが開示されている(特許文献1参照)。   Further, an XPS printer driver that processes an XPS file described in the XPS (XML Paper Specification) specification is disclosed (see Patent Document 1).

特開2013‐257820号公報JP, 2013-257820, A

V4プリンタードライバーにおける双方向通信機能では、setメソッドによる処理とgetメソッドによる処理との間で同期が取られていない(それぞれの処理が独立して行われる)ため、setメソッドで送信したコマンドと、getメソッドで取得したデータとが対応していない場合があった。   In the bidirectional communication function of the V4 printer driver, the processing by the set method and the processing by the get method are not synchronized (each processing is performed independently), so the command sent by the set method and In some cases, it did not correspond to the data acquired by the get method.

本発明は、上述の課題に鑑みたもので、送信コマンドと応答データとの不対応が生じることを抑制できる印刷制御装置および印刷制御プログラムを提供する。   The present invention has been made in view of the above problems, and provides a print control device and a print control program capable of suppressing the occurrence of incompatibility between a transmission command and response data.

本発明の態様の1つは、印刷制御装置は、プリンターと通信する通信部と、前記プリンターを送信対象とする送信コマンドの送信要求を行う通信制御部と、記憶部と、前記送信要求に応じて、前記送信コマンドを前記通信部を介して前記プリンターに送信する送信制御部と、応答データを前記通信部を介して前記プリンターから取得し、取得した応答データに識別情報を付加し、当該識別情報を付加した応答データを前記記憶部に格納する受信制御部と、を有し、前記通信制御部は、第1の送信コマンドの送信要求を行う前に前記記憶部から取得した応答データに付加されている識別情報と、前記第1の送信コマンドの送信要求を行った後に前記記憶部から取得した応答データに付加されている識別情報との比較に基づいて、前記第1の送信コマンドの送信要求を行った後に前記記憶部から取得した応答データが前記第1の送信コマンドに対応するか否かを判定する。
当該構成によれば、印刷制御装置は、前記比較に基づいて送信コマンド(第1の送信コマンド)に対応する応答データを確実に取得することができる。
According to one aspect of the present invention, a print control device includes a communication unit that communicates with a printer, a communication control unit that requests a transmission of a transmission command for the printer, a storage unit, and a response to the transmission request. Te, a transmission control unit which transmits the transmission command to the printer via the communication unit, acquires the response data from the printer via the communication unit, identification information is added to the obtained response data includes a reception control unit that stores a response data added with the identification information in the storage unit, wherein the communication control unit acquires from the storage unit before performing the transmission request of the first transmission command Based on a comparison between the identification information added to the response data and the identification information added to the response data acquired from the storage unit after the transmission request of the first transmission command is made. Send of Determines whether the response data obtained from the storage unit after the command transmission request corresponds to the first transmission command.
With this configuration, the print control apparatus can reliably acquire the response data corresponding to the transmission command (first transmission command) based on the comparison.

本発明の態様の1つは、前記記憶部は、送信コマンドの種別に応じた応答データ格納領域を有し、前記受信制御部は、前記プリンターから取得した応答データの内容に応じて当該応答データが対応する前記種別を判別し、判別した種別に応じた応答データ格納領域に前記プリンターから取得した応答データを格納し、前記通信制御部は、前記第1の送信コマンドの種別に対応する応答データ格納領域から応答データを取得するとしてもよい。
当該構成によれば、通信制御部は、第1の送信コマンドと種別が異なる送信コマンドに対応した応答データを、第1の送信コマンドに対応する可能性のある応答データとして記憶部から取得することを、回避できる。
One aspect of the present invention, the storage unit includes a response data storage area according to the type of the transmission command, the reception control unit, in accordance with the contents of response data obtained from the printer the The type of the response data is determined, the response data acquired from the printer is stored in the response data storage area corresponding to the determined type, and the communication control unit corresponds to the type of the first transmission command. response data storage region into a response data may to get.
According to this configuration, the communication control unit acquires, from the storage unit, the response data corresponding to the transmission command whose type is different from that of the first transmission command, as the response data that may correspond to the first transmission command. Can be avoided.

本発明の態様の1つは、前記通信制御部は、前記第1の送信コマンドの送信要求を行う前に前記第1の送信コマンドの種別に対応する応答データ格納領域から取得した応答データに付加されている識別情報と、前記第1の送信コマンドの送信要求を行った後に前記第1の送信コマンドの種別に対応する応答データ格納領域から取得した応答データに付加されている識別情報とが相違する場合に、前記第1の送信コマンドの送信要求を行った後に前記第1の送信コマンドの種別に対応する応答データ格納領域から取得した応答データが前記第1の送信コマンドに対応する応答データであると判定する。一方、前記比較の対象とした2つの識別情報が同じである場合には、前記通信制御部は、前記受信制御部に前記プリンターからの応答データの取得を再度要求する。
このような構成によれば、第1の送信コマンドに対応する応答データを最終的には取得することができる。また、前記通信制御部は、前記第1の送信コマンドの送信要求を行う前に前記第1の送信コマンドの種別に対応する応答データ格納領域から空データを取得した場合には、前記第1の送信コマンドの送信要求を行った後に前記第1の送信コマンドの種別に対応する応答データ格納領域から取得した応答データが前記第1の送信コマンドに対応する応答データであると判定すればよい。
According to one aspect of the present invention, the communication control unit adds to the response data acquired from the response data storage area corresponding to the type of the first transmission command before requesting the transmission of the first transmission command. And the identification information added to the response data acquired from the response data storage area corresponding to the type of the first transmission command after the transmission request of the first transmission command is made is different. In this case, the response data obtained from the response data storage area corresponding to the type of the first transmission command after the transmission request of the first transmission command is the response data corresponding to the first transmission command. Judge that there is. On the other hand, when the two pieces of identification information as the comparison targets are the same, the communication control unit requests the reception control unit again to acquire response data from the printer.
With such a configuration, the response data corresponding to the first transmission command can be finally acquired. Further, when the communication control unit acquires empty data from the response data storage area corresponding to the type of the first transmission command before making a transmission request for the first transmission command, the communication control unit determines It may be determined that the response data acquired from the response data storage area corresponding to the type of the first transmission command after the transmission request of the transmission command is the response data corresponding to the first transmission command.

前記通信部は、USB(Universal Serial Bus)規格に対応するインターフェイスである。また、印刷制御装置は、前記通信制御部からの要求に応じて拡張機能を呼び出すスプーラーを有し、前記送信制御部と前記受信制御部とは前記スプーラーにより読み出されて実行されるとしてもよい。   The communication unit is an interface compatible with the USB (Universal Serial Bus) standard. Further, the print control device may include a spooler that calls an extended function in response to a request from the communication control unit, and the transmission control unit and the reception control unit may be read and executed by the spooler. .

本発明の技術的思想は、印刷制御装置以外によっても実現される。例えば、印刷制御装置が搭載するコンピューターに本発明にかかる処理を実行させるプログラム(印刷制御プログラム)や、印刷制御装置が実行する工程を含んだ方法(印刷制御方法)や、当該プログラムを記憶したコンピューター読取可能な記憶媒体等を、それぞれ発明として捉えることができる。また、印刷制御装置(印刷制御プログラム、印刷制御方法)は、プリンターとの通信を制御すると言えるため、これを通信制御装置(通信制御プログラム、通信制御方法)等と称してもよい。   The technical idea of the present invention can be realized by means other than the print control device. For example, a program (print control program) that causes a computer installed in the print control apparatus to execute the process according to the present invention, a method including a step executed by the print control apparatus (print control method), or a computer that stores the program. A readable storage medium or the like can be regarded as an invention. Further, since the print control device (print control program, print control method) can be said to control communication with the printer, this may be referred to as a communication control device (communication control program, communication control method) or the like.

印刷制御装置の構成を例示するブロック図。FIG. 3 is a block diagram illustrating the configuration of a print control device. CPUにより実現されるソフトウェアの機能を例示する図。The figure which illustrates the function of the software implement | achieved by CPU. CPUにより実現される機能のうち双方向通信に係る機能を模式的に示す図。The figure which shows typically the function regarding bidirectional communication among the functions implement | achieved by CPU. 通信処理を説明するためのシーケンス図。A sequence diagram for explaining communication processing. 受信制御部がステップS5,S13で実行する処理を示すフローチャート。The flowchart which shows the process which a reception control part performs by step S5 and S13. 応答データ格納領域を説明するための図。The figure for demonstrating a response data storage area. 格納領域規定テーブルを例示する図。The figure which illustrates a storage area definition table. 上位通信モジュールがステップS16で実行する処理を示すフローチャート。The flowchart which shows the process which a high-order communication module performs in step S16.

下記の順序に従って本発明の実施形態を説明する。
1.印刷制御装置の構成:
2.ソフトウェアの機能構成:
3.通信処理:
4.まとめ:
The embodiments of the present invention will be described in the following order.
1. Print controller configuration:
2. Functional configuration of software:
3. Communication processing:
4. Summary:

1.印刷制御装置の構成:
図1は、印刷制御装置の構成を例示するブロック図である。以下では、印刷制御装置の一例として、端末10を例に説明を行う。端末10は、プリンタードライバーを搭載してプリンターを制御できるものであればよく、パーソナルコンピューター(PC)や、タブレット型端末や、スマートフォンや、これらと同等の性能を有する各種装置である。また、端末10が有する構成の一部を印刷制御装置や通信制御装置と称してもよい。端末10は、ディスプレイ11、操作キー12、ビデオカード13、I・OIF14、バス15、CPU16、外部記憶装置17、RAM18、ROM19、USBIF20、を備えている。
1. Print controller configuration:
FIG. 1 is a block diagram illustrating the configuration of the print control apparatus. The terminal 10 will be described below as an example of the print control apparatus. The terminal 10 is only required to be equipped with a printer driver and capable of controlling the printer, and is a personal computer (PC), a tablet terminal, a smartphone, or various devices having equivalent performance to these. Further, a part of the configuration of the terminal 10 may be referred to as a print control device or a communication control device. The terminal 10 includes a display 11, operation keys 12, a video card 13, an I / OIF 14, a bus 15, a CPU 16, an external storage device 17, a RAM 18, a ROM 19, and a USBIF 20.

ディスプレイ11は、画像を表示する表示部111や、利用者からの操作を受け付けるタッチパネルモジュール112を備えている。表示部111は、例えば、LCD(Liquid Crystal Display)や、LCDを駆動するためのドライバー回路を備え、ビデオカード13に接続されている。ビデオカード13は、バス15とディスプレイ11とを接続している。また、タッチパネルモジュール112は、静電容量方式や抵抗膜方式のセンサーを備え、利用者の操作位置に応じた電圧値を、I・OIF14に出力する。   The display 11 includes a display unit 111 that displays an image and a touch panel module 112 that receives an operation from a user. The display unit 111 includes, for example, an LCD (Liquid Crystal Display) and a driver circuit for driving the LCD, and is connected to the video card 13. The video card 13 connects the bus 15 and the display 11. In addition, the touch panel module 112 includes a capacitance type sensor or a resistance film type sensor, and outputs a voltage value according to the operation position of the user to the I / OIF 14.

操作キー12は、押し込み式のボタンにより構成され、利用者の操作を受け付けるユーザーインターフェイスである。
I・OIF14は、利用者によるタッチパネルモジュール112または操作キー12の操作に応じて生成される信号をバス15に出力する。
バス15には、CPU16、外部記憶装置17、I・OIF14、RAM18、ROM19、ビデオカード13、USBIF20が接続されている。バス15は、不図示のチップセットを備え、CPU16と他のデバイスとの通信を制御する。
The operation key 12 is a user interface that is configured by push-in buttons and that accepts user operations.
The I / OIF 14 outputs to the bus 15 a signal generated according to the operation of the touch panel module 112 or the operation key 12 by the user.
A CPU 16, an external storage device 17, an I / OIF 14, a RAM 18, a ROM 19, a video card 13, and a USBIF 20 are connected to the bus 15. The bus 15 includes a chip set (not shown) and controls communication between the CPU 16 and other devices.

CPU16は、外部記憶装置17またはROM19に記憶されたプログラムをRAM18に展開して実行することで、端末10を統合的に制御する。ROM19には、CPU16が起動する際に実行されるBIOSプログラムが記憶されている。RAM18は、CPU16により処理されるプログラムやデータを展開するワークエリアとして機能する。   The CPU 16 integrally controls the terminal 10 by expanding the program stored in the external storage device 17 or the ROM 19 into the RAM 18 and executing the program. The ROM 19 stores a BIOS program that is executed when the CPU 16 starts up. The RAM 18 functions as a work area for developing programs and data processed by the CPU 16.

外部記憶装置17には、OS(Operating System)としての機能をCPU16に付与するOSプログラム17a、アプリケーションの機能をCPU16に付与するアプリケーションプログラム17b、OSと協働してプリンター200を制御するプリンタードライバープログラム(PDRVプログラム)17cが記憶されている。OSプログラム17aは、例えば、Windows10(Windowsは登録商標)である。アプリケーションプログラム17bは、描画ソフト、PDFファイルビューア、ブラウザー、Webアプリケーションといったアプリケーションの機能をCPU16に実現させる。PDRVプログラム17cは、V4プリンタードライバーであり、拡張機能を備えている。   The external storage device 17 has an OS program 17a that gives the CPU 16 functions as an OS (Operating System), an application program 17b that gives application functions to the CPU 16, and a printer driver program that controls the printer 200 in cooperation with the OS. (PDRV program) 17c is stored. The OS program 17a is, for example, Windows 10 (Windows is a registered trademark). The application program 17b causes the CPU 16 to realize application functions such as drawing software, a PDF file viewer, a browser, and a Web application. The PDRV program 17c is a V4 printer driver and has extended functions.

USBIF20は、USBコントローラーや、USBケーブルを備え、バス15とプリンター200とを接続している。この実施形態では、通信部は、USBIF20により実現されている。
プリンター200は、インクジェットプリンターやレーザープリンターである。プリンター200は、プリンター以外の機能、例えば、スキャナーやファクシミリ等の機能も併せ持つ複合機であってもよい。プリンター200は、外部記憶装置17に記憶されたPDRVプログラム17cに対応しており、端末10からUSBIF20を通じて送信される印刷用データや送信コマンドによりその駆動が制御される。なお、プリンター200の内部構成は周知でありその説明は省略する。
The USBIF 20 includes a USB controller and a USB cable, and connects the bus 15 and the printer 200. In this embodiment, the communication unit is realized by the USBIF 20.
The printer 200 is an inkjet printer or a laser printer. The printer 200 may be a multifunction machine that also has functions other than the printer, such as a scanner and a facsimile. The printer 200 corresponds to the PDRV program 17c stored in the external storage device 17, and its drive is controlled by print data and a transmission command transmitted from the terminal 10 through the USBIF 20. The internal configuration of the printer 200 is well known, and the description thereof will be omitted.

2.ソフトウェアの機能構成:
図2は、CPU16により実現されるソフトウェアの機能を例示する図である。図2では、外部記憶装置17に記憶された各プログラムによりCPU16に実現される機能をアプリケーション160、OS170、プリンタードライバー180として示している。
2. Functional configuration of software:
FIG. 2 is a diagram illustrating the functions of software implemented by the CPU 16. In FIG. 2, the functions realized by the CPU 16 by the programs stored in the external storage device 17 are shown as an application 160, an OS 170, and a printer driver 180.

アプリケーション160は、画像や文章を含む印刷用データを生成する。印刷用データはXPS(XML Paper Specification)のフォーマットに対応するものを想定しているが、これ以外のフォーマットに対応するものであってもよい。また、アプリケーション160は、プリンター200に対して、インク残量等の状態を示すステータス情報を要求するコマンドや、クリーニング等のメンテナンス処理を実行させるコマンドを発行する機能を備えている。以下では、アプリケーション160が発行するコマンドを送信コマンドSCと記載する。   The application 160 generates print data including images and sentences. The print data is assumed to be compatible with the XPS (XML Paper Specification) format, but may be compatible with other formats. Further, the application 160 has a function of issuing a command to the printer 200 for requesting status information indicating a state such as the remaining ink amount, and a command for executing maintenance processing such as cleaning. Hereinafter, the command issued by the application 160 will be referred to as a transmission command SC.

OS170は、スプーラー171、USBポートモニター172を備え、プリンタードライバー180と協働してプリンター200を制御する。スプーラー171は、印刷処理時のデータ(スプールデータ)の出力処理や、双方向通信時のデータの送受信を制御する。USBポートモニター172は、アプリケーション160やプリンタードライバー180が通信を行う際に使用するポート番号の管理や、印刷処理時や双方向通信時におけるこのポート番号を用いた実質的な通信を行う。   The OS 170 includes a spooler 171, 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) at the time of print processing and transmission / reception of data at the time of bidirectional communication. The USB port monitor 172 manages a port number used when the application 160 and the printer driver 180 communicate with each other, and performs substantial communication using this port number during print processing and bidirectional communication.

プリンタードライバー180は、上位通信モジュール181、グラフィックスモジュール182、拡張機能部183を備えている。プリンタードライバー180は、印刷制御プログラムの一例である。上位通信モジュール181(通信制御部)は、アプリケーション160からの印刷用データの受信や、アプリケーション160との間で行われる制御用データ(送信コマンドSC、応答データRD)の受け渡しを実行する。グラフィックスモジュール182は、印刷処理時に、アプリケーション160が生成した印刷用データをプリンター200が対応するフォーマットに変換する。拡張機能部183は、印刷処理時や双方向通信時に行われる機能を拡張するためのモジュールにより構成されている。   The printer driver 180 includes an upper communication module 181, a graphics module 182, and an extended function unit 183. The printer driver 180 is an example of a print control program. The upper communication module 181 (communication control unit) receives print data from the application 160 and passes control data (transmission command SC, response data RD) to and from the application 160. The graphics module 182 converts print data generated by the application 160 into a format supported by the printer 200 during print processing. The extended function unit 183 is configured by a module for extending the function performed during print processing or bidirectional communication.

拡張機能部183は、その機能ごとに複数の機能モジュールを備えている。各機能モジュールは、Javascriptにより構成されたスクリプトファイルや、XML(eXtensible Markup Language)ファイルにより構成されている。XMLファイルは、各機能を定義するスキーマとして機能し、スクリプトファイルは、このXMLファイルに基づいて動作することで、プリンタードライバー180に拡張された機能を提供する。各機能モジュールは、スプーラー171から呼び出されることで、実施される。   The extended function unit 183 includes a plurality of function modules for each function. Each functional module is configured by a script file configured by Javascript or an XML (eXtensible Markup Language) file. The XML file functions as a schema that defines each function, and the script file operates based on the XML file to provide the printer driver 180 with an expanded function. Each functional module is implemented by being called from the spooler 171.

図3は、CPU16により実現される各機能のうち、USBIF20を用いた双方向通信に係る機能を模式的に示した図である。双方向通信は、スプーラー171が、拡張機能部183が備える機能モジュールのうち、USB Bidi Extender184を呼び出すことで実行される。USB Bidi Extender184のうち、スクリプトファイル内に実装されているメソッド(関数)であるsetSchema()は、上位通信モジュール181がアプリケーション160から取得した送信コマンドSCを、USBポートモニター172からUSBIF20によりプリンター200に送信する機能を実現する。スクリプトファイル内に実装されているメソッド(関数)であるgetSchemas()は、プリンター200が送信コマンドSCに対応して生成する応答データRDをUSBIF20を通じて取得する機能を実現する。getSchemas()で取得される応答データRDは、XMLファイル内の要素で定義されたRAM18の該当領域(後述する応答データ格納領域)に記憶される。該当領域に記憶された応答データRDは、上位通信モジュール181により取得され、アプリケーション160に返信される。
以下では、端末10(CPU16)がsetSchema()を用いることで実現される機能部を送信制御部185と、getSchemas()を用いることで実現される機能部を受信制御部186とも記載する。
FIG. 3 is a diagram schematically showing a function related to bidirectional communication using the USBIF 20 among the functions realized by the CPU 16. The bidirectional communication is executed by the spooler 171 by calling the USB Bidi Extender 184 among the function modules included in the extension function unit 183. In the USB Bidi Extender 184, setSchema (), which is a method (function) implemented in a script file, sends a send command SC acquired from the application 160 by the upper communication module 181 to the printer 200 from the USB port monitor 172 by the USBIF 20. Realize the function to send. The method (function) getSchemas () implemented in the script file realizes the function of acquiring the response data RD generated by the printer 200 in response to the transmission command SC through the USBIF 20. The response data RD acquired by getSchemas () is stored in the corresponding area (response data storage area described later) of the RAM 18 defined by the elements in the XML file. The response data RD stored in the corresponding area is acquired by the upper communication module 181, and is returned to the application 160.
Hereinafter, the functional unit realized by the terminal 10 (CPU 16) using setSchema () is also referred to as a transmission control unit 185, and the functional unit realized by using getSchemas () is also referred to as a reception control unit 186.

3.通信処理:
次に、双方向通信機能を用いた端末10とプリンター200との通信処理を説明する。
図4は、当該通信処理を説明するためのシーケンス図である。図4は、アプリケーション160、上位通信モジュール181、スプーラー171、送信制御部185、受信制御部186、プリンター200による処理をそれぞれ示している。
3. Communication processing:
Next, a communication process between the terminal 10 and the printer 200 using the bidirectional communication function will be described.
FIG. 4 is a sequence diagram for explaining the communication process. FIG. 4 shows processes performed by the application 160, the upper communication module 181, the spooler 171, the transmission control unit 185, the reception control unit 186, and the printer 200, respectively.

ステップS1では、アプリケーション160は、プリンター200に応答データRD(例えば、ステータス情報を記述した応答データ)を要求するための送信コマンドSCを発行する。ステータス情報は、例えば、アプリケーション160がプリンター200の状態を示すユーザーインターフェイス(UI)画面を表示させる情報である。   In step S1, the application 160 issues the transmission command SC for requesting the response data RD (for example, the response data describing the status information) from the printer 200. The status information is, for example, information that causes the application 160 to display a user interface (UI) screen indicating the status of the printer 200.

ステップS2では、上位通信モジュール181は、アプリケーション160から取得した、ステップS1で発行された送信コマンドSCの種別を記憶する。送信コマンドSCの種別は、例えば、ステータス情報の要求や、メンテナンス処理の実行命令といったように、アプリケーション160が要求する処理の内容に応じて定められている。ステップS1で発行された送信コマンドSCは、第1の送信コマンドに該当する。本発明において、第1の送信コマンドとは、その内容や種別が限定される訳ではない。便宜上“第1の〜”と表現することで、端末10が現在実行中の通信処理(図4)の発端としてアプリケーション160が発行した送信コマンドSC(第1の送信コマンド)を、端末10が過去に実行した通信処理(図4)の発端としてアプリケーション160が発行した送信コマンドSCと区別しているに過ぎない。   In step S2, the upper communication module 181 stores the type of the transmission command SC issued in step S1 acquired from the application 160. The type of the transmission command SC is determined according to the content of the process requested by the application 160, such as a request for status information or a maintenance process execution command. The transmission command SC issued in step S1 corresponds to the first transmission command. In the present invention, the content and type of the first transmission command are not limited. For the sake of convenience, by expressing it as “first to”, the terminal 10 may send the transmission command SC (first transmission command) issued by the application 160 as the origin of the communication processing (FIG. 4) currently being executed by the terminal 10. It is simply distinguished from the transmission command SC issued by the application 160 as the origin of the communication processing (FIG. 4) executed in step S1.

ステップS3では、上位通信モジュール181は、スプーラー171に対してgetSchemas()を呼び出すための関数をコールする。つまり、上位通信モジュール181は、スプーラー171に対する、USB Bidi Extender184のgetSchemas()の呼び出し要求を行う。また、このような要求を、応答データRDの取得要求とも言う。   In step S3, the upper communication module 181 calls a function for calling getSchemas () to the spooler 171. That is, the upper communication module 181 requests the spooler 171 to call getSchemas () of the USB Bidi Extender 184. Further, such a request is also referred to as a request to acquire the response data RD.

ステップS4では、スプーラー171は、上位通信モジュール181がコールする関数に応じて、USB Bidi Extender184のgetSchemas()を呼び出す。getSchemas()の呼び出しにより、CPU16は受信制御部186として機能することとなる。   In step S4, the spooler 171 calls getSchemas () of the USB Bidi Extender 184 according to the function called by the upper communication module 181. By calling getSchemas (), the CPU 16 functions as the reception control unit 186.

ステップS5では、受信制御部186は、応答データRDをプリンター200から取得するための処理を行う。
図5は、受信制御部186がステップS5で実行する処理を示すフローチャートである。なお、受信制御部186は、後述するステップS13でも当該図5に示すフローチャートを実行する。ステップS51では、受信制御部186は、プリンター200が送信する(ステップS6)応答データRDを、USBIF20を介して取得する。
In step S5, the reception control unit 186 performs a process for acquiring the response data RD from the printer 200.
FIG. 5 is a flowchart showing the processing executed by the reception control unit 186 in step S5. The reception control unit 186 also executes the flowchart shown in FIG. 5 in step S13 described later. In step S51, the reception control unit 186 acquires the response data RD transmitted by the printer 200 (step S6) via the USBIF 20.

ステップS52では、受信制御部186は、ステップS51においてプリンター200からの応答データRDの取得に成功したか否かを判定する。応答データRDを取得、つまりプリンター200から応答データRDを受信できた場合(ステップS52:Yes)はステップS53へ進む。ステップS53では、受信制御部186は、受信した応答データRDを識別情報IDとともに、記憶部(例えばRAM18)の対応する記憶領域(応答データ格納領域)に格納する。受信制御部186により応答データRDが格納される応答データ格納領域のアドレスは、拡張機能部183のXMLファイルに定義されている。   In step S52, the reception control unit 186 determines whether or not the acquisition of the response data RD from the printer 200 has succeeded in step S51. When the response data RD is acquired, that is, when the response data RD can be received from the printer 200 (step S52: Yes), the process proceeds to step S53. In step S53, the reception control unit 186 stores the received response data RD together with the identification information ID in the corresponding storage area (response data storage area) of the storage unit (for example, the RAM 18). The address of the response data storage area in which the response data RD is stored by the reception control unit 186 is defined in the XML file of the extended function unit 183.

一方、プリンター200からの応答データRDの取得に成功しなかった場合(ステップS52:No)、受信制御部186は、ステップS53を実行することなく、図5に示すフローチャートを終了する。プリンター200は、端末10から送信された送信コマンドSCへの応答として、応答データRDを生成して返す。ステップS1で送信コマンドSCが発行されて以降、ステップS5の段階では、この送信コマンドSCは未だプリンター200に送信されていない。従って、ステップS5の段階では、実際にはプリンター200から応答データRDは送信されず(ステップS6は発生せず)、ステップS52において“No”の判定をすることになる。   On the other hand, if the acquisition of the response data RD from the printer 200 has not succeeded (step S52: No), the reception control unit 186 ends the flowchart illustrated in FIG. 5 without executing step S53. The printer 200 generates and returns response data RD as a response to the transmission command SC transmitted from the terminal 10. After the transmission command SC is issued in step S1, the transmission command SC has not yet been transmitted to the printer 200 at the stage of step S5. Therefore, at step S5, the response data RD is not actually transmitted from the printer 200 (step S6 does not occur), and a “No” determination is made at step S52.

ここで、ステップS53の詳細を説明しておく。
図6は、応答データ格納領域の位置を説明するための図である。拡張機能部183のXMLファイルにより、応答データRDが対応する送信コマンドSCの種別に応じて応答データ格納領域が指定されている。図6の例では、送信コマンドSCの種別、例えば、第1種別の送信コマンドSC1、第2種別の送信コマンドSC2、第3種別の送信コマンドSC3…毎に、RAM18の記憶領域内に応答データ格納領域18a,18b,18c…といった各領域が確保されている。ステップS53では、受信制御部186は、拡張機能部183のXMLファイルを参照することにより、前記ステップS51で受信した応答データRDを、その応答データRDが対応する送信コマンドSCの種別に応じた応答データ格納領域に格納する。なお、受信制御部186等は、応答データRDが対応する送信コマンドSCの種別については、例えば、応答データRDの内容と送信コマンドSCの種別との対応付けを予めしている拡張機能部183のXMLファイルを参照することにより、判別することができる。
Here, the details of step S53 will be described.
FIG. 6 is a diagram for explaining the position of the response data storage area. The XML file of the extended function unit 183 specifies the response data storage area according to the type of the transmission command SC corresponding to the response data RD. In the example of FIG. 6, response data is stored in the storage area of the RAM 18 for each type of the transmission command SC, for example, for each of the first type transmission command SC1, the second type transmission command SC2, the third type transmission command SC3. Areas 18a, 18b, 18c ... Are secured. In step S53, the reception control unit 186 refers to the XML file of the extended function unit 183 to refer to the response data RD received in step S51 as a response according to the type of the transmission command SC corresponding to the response data RD. Store in the data storage area. It should be noted that the reception control unit 186 and the like of the extended function unit 183, which preliminarily associates the content of the response data RD with the type of the transmission command SC, for the type of the transmission command SC to which the response data RD corresponds, for example. It can be determined by referring to the XML file.

ステップS53では、受信制御部186は、応答データRDに上述したように識別情報IDを付加し、識別情報IDを付加した応答データRDを応答データ格納領域に格納する。識別情報IDを応答データRDに付加するとは、識別情報IDと応答データRDとを一対一で対応付けるという意味である。受信制御部186は、ステップS53を実行する度に異なる識別情報IDを生成し、そのとき応答データ格納領域へ格納する応答データRDに付加する。受信制御部186は、例えば、ステップS53の度に乱数を発生させることによりユニークな識別情報IDを生成することができる。あるいは、受信制御部186は、予め定められた規則に従ってユニークな識別情報IDを生成してもよい。ステップS53では、受信制御部186は、識別情報IDを付加した応答データRDを、対応する応答データ格納領域に格納する際、それまで当該応答データ格納領域に記憶されていた情報(応答データRDおよび識別情報ID)に上書きする。   In step S53, the reception control unit 186 adds the identification information ID to the response data RD as described above, and stores the response data RD to which the identification information ID is added in the response data storage area. Adding the identification information ID to the response data RD means associating the identification information ID with the response data RD in a one-to-one correspondence. The reception control unit 186 generates a different identification information ID each time step S53 is executed, and adds it to the response data RD stored in the response data storage area at that time. The reception control unit 186 can generate a unique identification information ID, for example, by generating a random number each time step S53. Alternatively, the reception control unit 186 may generate a unique identification information ID according to a predetermined rule. In step S53, when the reception control unit 186 stores the response data RD to which the identification information ID is added in the corresponding response data storage area, the information (response data RD and ID information) is overwritten.

ステップS7(図4)では、上位通信モジュール181は、応答データRDおよび応答データRDに付加されている識別情報IDを取得する。つまり、上位通信モジュール181は、応答データRDおよび識別情報IDが格納されている参照先の応答データ格納領域を、ステップS2で記憶した送信コマンドSCの種別に従って特定し、当該特定した応答データ格納領域から応答データRDおよび識別情報IDを取得する。このような参照先の応答データ格納領域の特定は、例えば、拡張機能部183に記憶されている格納領域規定テーブルRTを用いて行われる。   In step S7 (FIG. 4), the upper communication module 181 acquires the response data RD and the identification information ID added to the response data RD. That is, the upper communication module 181 identifies the response data storage area of the reference destination in which the response data RD and the identification information ID are stored according to the type of the transmission command SC stored in step S2, and the identified response data storage area. The response data RD and the identification information ID are acquired from. The specification of the response data storage area of such a reference destination is performed using, for example, the storage area definition table RT stored in the extended function unit 183.

図7は、ステップS7(および後述のステップS15)で用いる格納領域規定テーブルRTを例示している。格納領域規定テーブルRTには、送信コマンドSCの種別(例えば、第1種別の送信コマンドSC1、第2種別の送信コマンドSC2、第3種別の送信コマンドSC3…)毎に、参照先の応答データ格納領域を特定可能な格納領域特定情報が記憶されている。格納領域特定情報としては、例えば、参照先の応答データ格納領域をXMLファイルで定義したスキーマ名称(スキーマ名称1,2,3…)や、この応答データ格納領域をXMLファイルで間接的に示す定義名称を用いることができる。これ以外にも、応答データ格納領域の先頭アドレス等を用いるものであってもよい。上位通信モジュール181はステップS2で記憶した送信コマンドSCの種別をもとに、格納領域規定テーブルRTから応答データ格納領域の格納領域特定情報を取得し、格納領域特定情報に対応する応答データ格納領域から応答データRDおよび識別情報IDを取得する。むろん、ステップS53(図5)において、受信制御部186は、応答データRDおよび識別情報IDを応答データ格納領域へ格納する際に、格納領域規定テーブルRTを参照して格納先の応答データ格納領域を特定することができる。   FIG. 7 exemplifies the storage area definition table RT used in step S7 (and step S15 described later). In the storage area definition table RT, the reference destination response data is stored for each type of the transmission command SC (for example, the first type transmission command SC1, the second type transmission command SC2, the third type transmission command SC3 ...). Storage area specifying information capable of specifying an area is stored. As the storage area specifying information, for example, a schema name (schema name 1, 2, 3, ...) In which the response data storage area of the reference destination is defined in the XML file, or a definition indirectly indicating the response data storage area in the XML file is used. The name can be used. In addition to this, the start address of the response data storage area or the like may be used. The upper communication module 181 acquires the storage area specifying information of the response data storing area from the storage area defining table RT based on the type of the transmission command SC stored in step S2, and the response data storing area corresponding to the storage area specifying information. The response data RD and the identification information ID are acquired from. Of course, in step S53 (FIG. 5), the reception control unit 186 refers to the storage area definition table RT when storing the response data RD and the identification information ID in the response data storage area, and stores the response data in the storage area. Can be specified.

このようにステップS7で上位通信モジュール181が取得した識別情報IDは、第1の送信コマンドの送信要求を行う前に記憶部(RAM18)から取得した応答データに付加されている識別情報、に該当する。また、ステップS7で上位通信モジュール181が取得した識別情報IDは、端末10が現在実行中の通信処理(図4)よりも過去に、受信制御部186がプリンター200から取得した応答データRDに付加して記憶部(RAM18)内の応答データ格納領域に応答データRDとともに格納した識別情報である。   In this way, the identification information ID acquired by the upper communication module 181 in step S7 corresponds to the identification information added to the response data acquired from the storage unit (RAM 18) before the transmission request of the first transmission command is made. To do. Further, the identification information ID acquired by the higher-level communication module 181 in step S7 is added to the response data RD acquired by the reception control unit 186 from the printer 200 earlier than the communication process currently being executed by the terminal 10 (FIG. 4). The identification information is stored together with the response data RD in the response data storage area in the storage unit (RAM 18).

次に、ステップS8では、上位通信モジュール181は、スプーラー171に対してsetSchema()を呼び出すための関数をコールするとともに、アプリケーション160から取得した(ステップS1で発行された)送信コマンドSCを送信する。つまり、上位通信モジュール181は、スプーラー171に対する、USB Bidi Extender184のsetSchema()の呼び出し要求を行う。このような要求は、送信コマンドSCの送信要求に該当する。   Next, in step S8, the upper communication module 181 calls the function for calling setSchema () to the spooler 171, and transmits the transmission command SC (issued in step S1) acquired from the application 160. . That is, the upper communication module 181 requests the spooler 171 to call setSchema () of the USB Bidi Extender 184. Such a request corresponds to the transmission request of the transmission command SC.

ステップS9では、スプーラー171は、上位通信モジュール181がコールする関数により、USB Bidi Extender184のsetSchema()を呼び出し、送信コマンドSCをsetSchema()の引数として設定する。setSchema()の呼び出しにより、CPU16は送信制御部185として機能することになる。   In step S9, the spooler 171 calls setSchema () of the USB Bidi Extender 184 by the function called by the upper communication module 181, and sets the transmission command SC as an argument of setSchema (). By calling setSchema (), the CPU 16 functions as the transmission control unit 185.

ステップS10では、送信制御部185は、USBポートモニター172を制御し、送信コマンドSCをプリンター200に送信する。USBポートモニター172の機能により送信コマンドSCはUSBIF20を介してプリンター200に送信される。プリンター200はUSBIF20を介して送信コマンドSCを受信すると、送信コマンドSCを解釈し、送信コマンドSCに対応する応答データRDを生成する。   In step S10, the transmission control unit 185 controls the USB port monitor 172 to transmit the transmission command SC to the printer 200. The transmission command SC is transmitted to the printer 200 via the USBIF 20 by the function of the USB port monitor 172. When the printer 200 receives the transmission command SC via the USBIF 20, the printer 200 interprets the transmission command SC and generates response data RD corresponding to the transmission command SC.

ステップS8の後に、上位通信モジュール181は、ステップS11を実行する。また、ステップS11を起因として、ステップS12,S13が実行される。ステップS11,S12,S13は、上述のステップS3,S4,S5と同じ処理である。
上述したように、受信制御部186は、ステップS13においても図5のフローチャートを実行する。ステップS13の段階では、上位通信モジュール181は、ステップS1で発行された送信コマンドSCについての送信要求(ステップS8)を実行済みである。従って、ステップS13で実行する図5のフローチャートにおいては、ステップS51で、プリンター200が送信する(ステップS14)応答データRDを、USBIF20を介して取得できる可能性が高い。
After step S8, the upper communication module 181 executes step S11. Further, steps S12 and S13 are executed due to step S11. Steps S11, S12 and S13 are the same processes as steps S3, S4 and S5 described above.
As described above, the reception control unit 186 also executes the flowchart of FIG. 5 in step S13. At the stage of step S13, the upper communication module 181 has already executed the transmission request (step S8) for the transmission command SC issued at step S1. Therefore, in the flowchart of FIG. 5 executed in step S13, it is highly possible that the response data RD transmitted by the printer 200 (step S14) in step S51 can be acquired via the USBIF 20.

次に、ステップS15では、上位通信モジュール181は、応答データRDおよび応答データRDに付加されている識別情報IDを取得する。ステップS15は、ステップS7と同じ処理である。ステップS15で応答データRDおよび識別情報IDを取得するための参照先の応答データ格納領域は、ステップS7で応答データRDおよび識別情報IDを取得するために参照した応答データ格納領域と同じである。ただし、ステップS15で応答データRDおよび識別情報IDを取得するための参照先の応答データ格納領域は、前記ステップS13により、格納する応答データRDおよび識別情報IDが更新(上書き)されている可能性が高い。ステップS15で上位通信モジュール181が取得した識別情報IDは、第1の送信コマンドの送信要求を行った後に記憶部(RAM18)から取得した応答データに付加されている識別情報、に該当する。また、ステップS15で上位通信モジュール181が取得した応答データRDは、第1の送信コマンドの送信要求を行った後に記憶部(RAM18)から取得した応答データ、に該当する。   Next, in step S15, the upper communication module 181 obtains the response data RD and the identification information ID added to the response data RD. Step S15 is the same process as step S7. The response data storage area of the reference destination for obtaining the response data RD and the identification information ID in step S15 is the same as the response data storage area referred to for obtaining the response data RD and the identification information ID in step S7. However, the response data RD and the identification information ID to be stored may be updated (overwritten) by the step S13 in the response data storage area of the reference destination for obtaining the response data RD and the identification information ID in step S15. Is high. The identification information ID acquired by the upper communication module 181 in step S15 corresponds to the identification information added to the response data acquired from the storage unit (RAM 18) after the transmission request of the first transmission command is made. The response data RD acquired by the upper communication module 181 in step S15 corresponds to the response data acquired from the storage unit (RAM 18) after making the transmission request for the first transmission command.

ステップS16では、上位通信モジュール181は、応答データRDをアプリケーション160へ送信するための処理を行う。
図8は、ステップS16において上位通信モジュール181が実行する処理を示すフローチャートである。上位通信モジュール181は、ステップS7で取得した識別情報ID(以下、事前取得の識別情報ID)と、ステップS15で取得した識別情報ID(以下、直近取得の識別情報ID)とを比較し、当該比較に基づいて、ステップS15で取得した応答データRDが、ステップS1で発行された送信コマンドSCに対応する応答データRDであるか否かを判定する。具体的には、ステップS161において、事前取得の識別情報IDと直近取得の識別情報IDとが相違するか否か判定し、判定結果に応じて処理を分岐する。
In step S16, the upper communication module 181 performs a process for transmitting the response data RD to the application 160.
FIG. 8 is a flowchart showing the processing executed by the upper communication module 181 in step S16. The upper communication module 181 compares the identification information ID (hereinafter, identification information ID acquired in advance) acquired in step S7 with the identification information ID (hereinafter, identification information ID acquired most recently) acquired in step S15, and Based on the comparison, it is determined whether the response data RD acquired in step S15 is the response data RD corresponding to the transmission command SC issued in step S1. Specifically, in step S161, it is determined whether or not the identification information ID acquired in advance and the identification information ID acquired most recently are different, and the process is branched according to the determination result.

上位通信モジュール181は、事前取得の識別情報IDと直近取得の識別情報IDとが相違する場合は(ステップS161:Yes)、ステップS15で取得した応答データRDが、ステップS1で発行された送信コマンドSCに対応すると判定し、ステップS162へ進む。つまり、直近取得の識別情報IDが事前取得の識別情報IDから変化していれば、送信コマンドSCの送信(ステップS8〜S10)後の応答データRDの取得要求(S11)を契機としたステップS13(ステップS13で実行する図5のフローチャートにおけるステップS53)で、当該送信コマンドSCの種別に対応する応答データRDが更新されたことになるため、ステップS1で発行された送信コマンドSCに対応する応答データRDをステップS15で取得できたと判定することができる。   When the identification information ID obtained in advance and the identification information ID obtained most recently are different (step S161: Yes), the higher-order communication module 181 sends the response data RD obtained in step S15 to the transmission command issued in step S1. It is determined that it corresponds to SC, and the process proceeds to step S162. That is, if the most recently acquired identification information ID has changed from the previously acquired identification information ID, step S13 triggered by the acquisition request (S11) of the response data RD after transmission of the transmission command SC (steps S8 to S10). Since the response data RD corresponding to the type of the transmission command SC is updated in (step S53 in the flowchart of FIG. 5 executed in step S13), the response corresponding to the transmission command SC issued in step S1. It can be determined that the data RD has been acquired in step S15.

ステップS162では、上位通信モジュール181は、ステップS15で取得した応答データRDを、アプリケーション160へ送信する。この結果、アプリケーション160は、ステップS1で発行した送信コマンドSCに対応してプリンター200が生成した応答データRDを得たことになる。   In step S162, the upper communication module 181 transmits the response data RD acquired in step S15 to the application 160. As a result, the application 160 has obtained the response data RD generated by the printer 200 in response to the transmission command SC issued in step S1.

一方、上位通信モジュール181は、事前取得の識別情報IDと直近取得の識別情報IDとが同じである場合は(ステップS161:No)、ステップS15で取得した応答データRDが、ステップS1で発行された送信コマンドSCに対応していない(送信コマンドSCの送信前から記憶されている応答データRDがまだ更新されていない)と判定できるため、ステップS11へ戻る。ステップS11へ戻ることで、上位通信モジュール181は、スプーラー171(受信制御部186)に対して再度、応答データRDの取得要求をすることになる。つまり、ステップS11〜S16が繰り返される。ステップS11〜S16を繰り返すことで、最終的には、アプリケーション160がステップS1で発行した送信コマンドSCに対応する応答データRDを、アプリケーション160へ返すことができる。   On the other hand, when the identification information ID acquired in advance and the identification information ID acquired most recently are the same (step S161: No), the higher-order communication module 181 issues the response data RD acquired in step S15 in step S1. Since it can be determined that it does not correspond to the transmitted command SC (the response data RD stored before the transmission of the transmitted command SC has not been updated), the process returns to step S11. By returning to step S11, the upper communication module 181 again requests the spooler 171 (reception control unit 186) to acquire the response data RD. That is, steps S11 to S16 are repeated. By repeating steps S11 to S16, the response data RD corresponding to the transmission command SC issued by the application 160 in step S1 can be finally returned to the application 160.

なお、ステップS7では、上位通信モジュール181は、ステップS2で記憶した送信コマンドSCの種別に対応する応答データ格納領域から応答データRDおよび識別情報IDを取得しようとしたとき、この応答データ格納領域が空である場合は応答データRDおよび識別情報IDを取得できない。この場合、上位通信モジュール181は、ステップS2で記憶した送信コマンドSCの種別に対応する応答データ格納領域から、応答データ格納領域が空であることを示す空データ(Null値)を得るだけである。上位通信モジュール181は、ステップS7で空データを取得した場合は、ステップS16を実行するための便宜上、当該空データを事前取得の識別情報IDとみなす。このようにすれば、ステップS161(図8)では、事前取得の識別情報IDと直近取得の識別情報IDとが相違する(ステップS161:Yes)と判定することができる。つまり、上位通信モジュール181は、第1の送信コマンドの送信要求を行う前に記憶部(RAM18)から空データを取得した場合には、第1の送信コマンドの送信要求を行った後に記憶部(RAM18)から取得した応答データが第1の送信コマンドに対応する応答データであると判定する。   In step S7, when the upper communication module 181 tries to acquire the response data RD and the identification information ID from the response data storage area corresponding to the type of the transmission command SC stored in step S2, this response data storage area is When it is empty, the response data RD and the identification information ID cannot be acquired. In this case, the upper communication module 181 only obtains empty data (Null value) indicating that the response data storage area is empty from the response data storage area corresponding to the type of the transmission command SC stored in step S2. . When the empty data is acquired in step S7, the higher-order communication module 181 regards the empty data as the identification information ID acquired in advance for the convenience of executing step S16. In this way, in step S161 (FIG. 8), it is possible to determine that the identification information ID acquired in advance and the identification information ID acquired most recently are different (step S161: Yes). That is, when the upper communication module 181 obtains empty data from the storage unit (RAM 18) before making a transmission request for the first transmission command, the storage unit (181) makes a transmission request for the first transmission command. It is determined that the response data acquired from the RAM 18) is the response data corresponding to the first transmission command.

ステップS15においても、実行のタイミング如何では、ステップS7と同様に、ステップS2で記憶した送信コマンドSCの種別に対応する応答データ格納領域から応答データRDおよび識別情報IDを取得しようとしたとき、この応答データ格納領域から空データを取得することが有り得る。上位通信モジュール181は、ステップS15で空データを取得した場合は、ステップS16を実行するための便宜上、当該空データを直近取得の識別情報IDとみなす。この場合、事前取得の識別情報ID、直近取得の識別情報IDのいずれも空データであるため、ステップS161(図8)では、事前取得の識別情報IDと直近取得の識別情報IDとが同じ(ステップS161:No)と判定することになる。ただし、ステップS161において“No”と判定した場合は、ステップS11〜S16が繰り返されるため、最終的には、アプリケーション160がステップS1で発行した送信コマンドSCに対応する応答データRDを、アプリケーション160へ返すことができる。   Also in step S15, depending on the execution timing, similar to step S7, when the response data RD and the identification information ID are to be acquired from the response data storage area corresponding to the type of the transmission command SC stored in step S2, It is possible to obtain empty data from the response data storage area. When the upper communication module 181 acquires the empty data in step S15, the upper communication module 181 regards the empty data as the identification information ID of the latest acquisition for convenience of performing step S16. In this case, since the identification information ID acquired in advance and the identification information ID acquired most recently are null data, the identification information ID acquired in advance and the identification information ID acquired most recently are the same in step S161 (FIG. 8). Step S161: No) will be determined. However, if “No” is determined in step S161, steps S11 to S16 are repeated, so that the application 160 finally sends the response data RD corresponding to the transmission command SC issued in step S1 to the application 160. Can be returned.

4.まとめ:
このように本実施形態によれば、通信制御部(上位通信モジュール181)は、第1の送信コマンド(ステップS1で発行された送信コマンドSC)の送信要求を行う前に記憶部(RAM18)から取得した応答データRDに付加されている識別情報(事前取得の識別情報ID)と、第1の送信コマンドの送信要求を行った後に記憶部から取得した応答データRDに付加されている識別情報(直近取得の識別情報ID)との比較に基づいて、第1の送信コマンドの送信要求を行った後に記憶部から取得した応答データRDが第1の送信コマンドに対応するか否かを判定する。これにより、第1の送信コマンドに対応していない応答データRDを、誤って第1の送信コマンドに対応する応答データRDと判定し第1の送信コマンドに対応する応答データRDとして処理してしまうことを回避できる。具体的には、例えば、第1の送信コマンドよりも過去にアプリケーション160が発行した送信コマンドに対応してプリンター200が生成し端末10へ送信した応答データRDを、第1の送信コマンドの発行後に当該第1の送信コマンドに対応する応答データRDの送信を待っているアプリケーション160へ送信してしまう、といったことを回避できる。
4. Summary:
As described above, according to the present embodiment, the communication control unit (upper communication module 181) causes the storage unit (RAM 18) to send the first transmission command (the transmission command SC issued in step S1) to the transmission request. The identification information added to the acquired response data RD (the identification information ID acquired in advance) and the identification information added to the response data RD acquired from the storage unit after the transmission request for the first transmission command is made ( Based on the comparison with the latest acquisition identification information ID), it is determined whether or not the response data RD acquired from the storage unit after the transmission request of the first transmission command corresponds to the first transmission command. As a result, the response data RD that does not correspond to the first transmission command is erroneously determined as the response data RD that corresponds to the first transmission command and is processed as the response data RD that corresponds to the first transmission command. You can avoid that. Specifically, for example, after issuing the first transmission command, the response data RD generated by the printer 200 and transmitted to the terminal 10 in response to the transmission command issued by the application 160 before the first transmission command is issued. It can be avoided that the response data RD corresponding to the first transmission command is transmitted to the application 160 waiting for transmission.

また本実施形態によれば、受信制御部186は、プリンター200から取得した応答データRDを、当該応答データRDが対応する送信コマンドSCの種別に応じた記憶部(RAM18)の領域(応答データ格納領域)に格納し、通信制御部(上位通信モジュール181)は、第1の送信コマンドの種別に対応する記憶部の領域(応答データ格納領域)から応答データRDを取得する。当該構成によれば、上位通信モジュール181は、第1の送信コマンドと種別が異なる送信コマンドに対応して記憶部に格納されている応答データRDを、第1の送信コマンドに対応する可能性のある応答データRDとして記憶部から取得することを回避できる。また、受信制御部186は、ある送信コマンドの種別に対応して記憶部に記憶されている応答データRDを、他の種別の送信コマンドの送信に応じてプリンター200から返信された応答データRDにより上書きしてしまうことを回避することができる。   Further, according to the present embodiment, the reception control unit 186 stores the response data RD acquired from the printer 200 in the area (response data storage) of the storage unit (RAM 18) corresponding to the type of the transmission command SC corresponding to the response data RD. Then, the communication control unit (upper communication module 181) obtains the response data RD from the region (response data storage region) of the storage unit corresponding to the type of the first transmission command. According to this configuration, the higher-level communication module 181 may handle the response data RD stored in the storage unit in association with a transmission command of a type different from that of the first transmission command from the first transmission command. It is possible to avoid obtaining certain response data RD from the storage unit. Further, the reception control unit 186 uses the response data RD stored in the storage unit corresponding to the type of a certain transmission command as the response data RD returned from the printer 200 in response to the transmission of the transmission command of another type. It is possible to avoid overwriting.

また本実施形態は、取得した応答データRDが第1の送信コマンドに対応する応答データRDであるか否かの判定において、上述したように事前取得の識別情報IDと直近取得の識別情報IDとが相違するか否かという判定基準を用いることで、次のような優位性を有する。   In addition, in the present embodiment, in determining whether the acquired response data RD is the response data RD corresponding to the first transmission command, the identification information ID of the pre-acquisition and the identification information ID of the latest acquisition are used as described above. The following advantages are obtained by using the criterion of whether or not is different.

送信コマンドと応答データとの対応・不対応を判定するために、例えば、送信コマンドの送信要求を行ったときの時刻(送信時刻)と、応答データをプリンターから受信したときの時刻(受信時刻)とを管理し、送信時刻よりも受信時刻の方が後であれば、当該受信時刻に受信した応答データが、当該送信時刻にかかる送信コマンドに対応すると判定する構成が考えられる。ここで、サーバーが管理するプリンターを、当該サーバーが接続するネットワーク(例えばLAN)に参加する複数のクライアント端末が共同使用する構成(印刷制御装置が、クライアント端末とサーバーを含むシステムである場合)を想定する。当該構成では、上述の送信時刻は、送信コマンドを発するクライアント端末が記憶し、上述の受信時刻は、サーバーが記憶することになる。   To determine the correspondence / non-correspondence between the send command and the response data, for example, the time when the send request of the send command is made (sending time) and the time when the reply data is received from the printer (receiving time) It is conceivable that a configuration in which the response data received at the reception time corresponds to the transmission command corresponding to the transmission time if the reception time is later than the transmission time. Here, a configuration in which a printer managed by a server is shared by a plurality of client terminals participating in a network (for example, LAN) to which the server is connected (when the print control apparatus is a system including the client terminal and the server) is described. Suppose. In this configuration, the transmission time is stored in the client terminal that issues the transmission command, and the reception time is stored in the server.

このような場合、クライアント端末が時間を認識する基準(クライアント端末が内蔵する時計)と、サーバーが時間を認識する基準(サーバーが内蔵する時計)とにずれがあると、上述したような送信時刻と受信時刻との前後関係に基づく判定を正確に行えないことがある。例えば、現実の時系列では送信時刻よりも受信時刻の方が後であるにも関わらず、クライアント端末が認識する送信時刻が、サーバーが認識する受信時刻よりも後であるために、応答データは送信コマンドに対応しないという判定結果になることがある。本実施形態は、送信コマンドと応答データとの対応・不対応を、事前取得の識別情報IDと直近取得の識別情報IDとの相違の有無に基づいて行うため、上述したような各処理の時刻の前後関係に基づく判定をする場合に生じ得る誤判定を、避けることができる。   In such a case, if there is a discrepancy between the standard by which the client terminal recognizes time (clock built in the client terminal) and the standard by which the server recognizes time (clock built in the server), the transmission time as described above It may not be possible to accurately perform the determination based on the context of the reception time and For example, in the actual time series, the reception time is later than the transmission time, but the transmission time recognized by the client terminal is later than the reception time recognized by the server. The determination result may not correspond to the transmitted command. In the present embodiment, the correspondence / non-correspondence between the transmission command and the response data is performed based on the presence / absence of the difference between the identification information ID acquired in advance and the identification information ID acquired most recently. It is possible to avoid an erroneous determination that may occur when the determination is made based on the context of.

10…端末、11…ディスプレイ、12…操作キー、13…ビデオカード、15…バス、16…CPU、17…外部記憶装置、18…RAM、18a,18b,18c…応答データ格納領域、19…ROM、20…USBIF、160…アプリケーション、170…OS、171…スプーラー、172…USBポートモニター、180…プリンタードライバー、181…上位通信モジュール、182…グラフィックスモジュール、183…拡張機能部、184…USB Bidi Extender、185…送信制御部、186…受信制御部、200…プリンター、ID…識別情報、SC…送信コマンド、RD…応答データ 10 ... Terminal, 11 ... Display, 12 ... Operation keys, 13 ... Video card, 15 ... Bus, 16 ... CPU, 17 ... External storage device, 18 ... RAM, 18a, 18b, 18c ... Response data storage area, 19 ... ROM , 20 ... USBIF, 160 ... Application, 170 ... OS, 171 ... Spooler, 172 ... USB port monitor, 180 ... Printer driver, 181, ... Upper communication module, 182 ... Graphics module, 183 ... Extended function section, 184 ... USB Bidi Extender, 185 ... Transmission control unit, 186 ... Reception control unit, 200 ... Printer, ID ... Identification information, SC ... Transmission command, RD ... Response data

Claims (8)

プリンターと通信する通信部と、
前記プリンターを送信対象とする送信コマンドの送信要求を行う通信制御部と、
記憶部と、
前記送信要求に応じて、前記送信コマンドを前記通信部を介して前記プリンターに送信する送信制御部と、
答データを前記通信部を介して前記プリンターから取得し、取得した応答データに識別情報を付加し、当該識別情報を付加した応答データを前記記憶部に格納する受信制御部と、を有し、
前記通信制御部は、第1の送信コマンドの送信要求を行う前に前記記憶部から取得した応答データに付加されている識別情報と、前記第1の送信コマンドの送信要求を行った後に前記記憶部から取得した応答データに付加されている識別情報との比較に基づいて、前記第1の送信コマンドの送信要求を行った後に前記記憶部から取得した応答データが前記第1の送信コマンドに対応するか否かを判定する、ことを特徴とする印刷制御装置。
A communication unit that communicates with the printer,
A communication control unit that requests the transmission of a transmission command that targets the printer,
Storage part,
A transmission control unit that transmits the transmission command to the printer via the communication unit in response to the transmission request;
Get the response data from the printer via the communication unit, identification information is added to the obtained response data, and a reception control unit that stores a response data added with the identification information in the storage unit Has,
The communication control unit stores the identification information added to the response data acquired from the storage unit before making a transmission request for the first transmission command and the storage information after making a transmission request for the first transmission command. The response data acquired from the storage unit after the transmission request of the first transmission command is made based on the comparison with the identification information added to the response data obtained from the copy unit corresponds to the first transmission command. A print control apparatus, which determines whether or not to perform.
前記記憶部は、送信コマンドの種別に応じた応答データ格納領域を有し、
前記受信制御部は、前記プリンターから取得した応答データの内容に応じて当該応答データが対応する前記種別を判別し、判別した種別に応じた応答データ格納領域に前記プリンターから取得した応答データを格納し、
前記通信制御部は、前記第1の送信コマンドの種別に対応する応答データ格納領域から応答データを取得することを特徴とする請求項1に記載の印刷制御装置。
The storage unit has a response data storage area according to the type of transmission command,
The reception control unit, the response data to which the response data to determine the corresponding category, acquired from the printer in the response data storage area according to the determined type in accordance with the contents of response data obtained from the printer stores,
Said communication control unit, the printing control apparatus according to claim 1, characterized in that to obtain the response data storage region into a response data corresponding to the type of the first transmission command.
前記通信制御部は、前記第1の送信コマンドの送信要求を行う前に前記第1の送信コマンドの種別に対応する応答データ格納領域から取得した応答データに付加されている識別情報と、前記第1の送信コマンドの送信要求を行った後に前記第1の送信コマンドの種別に対応する応答データ格納領域から取得した応答データに付加されている識別情報とが相違する場合に、前記第1の送信コマンドの送信要求を行った後に前記第1の送信コマンドの種別に対応する応答データ格納領域から取得した応答データが前記第1の送信コマンドに対応する応答データであると判定することを特徴とする請求項に記載の印刷制御装置。 The communication control unit includes identification information added to response data acquired from a response data storage area corresponding to the type of the first transmission command before making a transmission request for the first transmission command; If the identification information added to the response data obtained from the response data storage area corresponding to the type of the first transmission command after the transmission request for the first transmission command is different, the first transmission It is characterized in that the response data obtained from the response data storage area corresponding to the type of the first transmission command after the command transmission request is determined to be the response data corresponding to the first transmission command. The print control apparatus according to claim 2 . 前記通信制御部は、前記第1の送信コマンドの送信要求を行う前に前記第1の送信コマンドの種別に対応する応答データ格納領域から取得した応答データに付加されている識別情報と、前記第1の送信コマンドの送信要求を行った後に前記第1の送信コマンドの種別に対応する応答データ格納領域から取得した応答データに付加されている識別情報とが同じである場合に、前記受信制御部に前記プリンターからの応答データの取得を再度要求することを特徴とする請求項2または請求項3に記載の印刷制御装置。 The communication control unit includes identification information added to response data acquired from a response data storage area corresponding to the type of the first transmission command before making a transmission request for the first transmission command; If the identification information added to the response data acquired from the response data storage area corresponding to the type of the first transmission command after the transmission request of the first transmission command is the same, the reception control unit the print control apparatus according to claim 2 or claim 3, characterized in that requests acquisition of the response data back from the printer. 前記通信制御部は、前記第1の送信コマンドの送信要求を行う前に前記第1の送信コマンドの種別に対応する応答データ格納領域から空データを取得した場合には、前記第1の送信コマンドの送信要求を行った後に前記第1の送信コマンドの種別に対応する応答データ格納領域から取得した応答データが前記第1の送信コマンドに対応する応答データであると判定することを特徴とする請求項〜請求項4のいずれか一項に記載の印刷制御装置。 If the communication control unit obtains empty data from the response data storage area corresponding to the type of the first transmission command before making a transmission request for the first transmission command , the first transmission command Response request acquired from the response data storage area corresponding to the type of the first transmission command after the transmission request is transmitted, is determined to be the response data corresponding to the first transmission command. The print control device according to any one of claims 2 to 4. 前記通信部は、USB規格に対応するインターフェイスであることを特徴とする請求項1〜請求項5のいずれか一項に記載の印刷制御装置。 The communication unit print control apparatus according to any one of claims 1 to 5, characterized in that the interface for the USB standard. 前記通信制御部からの要求に応じて拡張機能を呼び出すスプーラーを有し、
前記送信制御部と前記受信制御部とは前記スプーラーにより読み出されて実行されることを特徴とする請求項1〜請求項6のいずれか一項に記載の印刷制御装置。
It has a spooler that calls an extended function in response to a request from the communication control unit,
The print control apparatus according to any one of claims 1 to 6, wherein the transmission control unit and the receiving control unit, characterized in that it is read and executed by the spooler.
コンピューターにプリンターを制御させる印刷制御プログラムであって、
前記コンピューターに、
前記プリンターを送信対象とする送信コマンドの送信要求を行う通信制御機能と、
前記送信要求に応じて、前記送信コマンドを通信部を介して前記プリンターに送信する送信制御機能と、
答データを前記通信部を介して前記プリンターから取得し、取得した応答データに識別情報を付加し、当該識別情報を付加した応答データを記憶部に格納する受信制御機能と、実現させ、
前記通信制御機能は、第1の送信コマンドの送信要求を行う前に前記記憶部から取得した応答データに付加されている識別情報と、前記第1の送信コマンドの送信要求を行った後に前記記憶部から取得した応答データに付加されている識別情報との比較に基づいて、前記第1の送信コマンドの送信要求を行った後に前記記憶部から取得した応答データが前記第1の送信コマンドに対応するか否かを判定する、ことを特徴とする印刷制御プログラム。
A print control program that causes a computer to control the printer,
On the computer,
A communication control function for making a transmission request of a transmission command to the printer as a transmission target,
A transmission control function for transmitting the transmission command to the printer via a communication unit in response to the transmission request,
Get the response data from the printer via the communication unit, and a reception control function identification information is added to the obtained response data, and stores the response data added with the identification information in the storage unit, Make it happen,
The communication control function stores the identification information added to the response data acquired from the storage unit before making a transmission request for the first transmission command and the storage after making a transmission request for the first transmission command. The response data acquired from the storage unit after the transmission request of the first transmission command is made based on the comparison with the identification information added to the response data obtained from the copy unit corresponds to the first transmission command. A print control program for determining whether or not to perform.
JP2016083231A 2016-04-18 2016-04-18 Print control device and print control program Active JP6680060B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2016083231A JP6680060B2 (en) 2016-04-18 2016-04-18 Print control device and print control program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2016083231A JP6680060B2 (en) 2016-04-18 2016-04-18 Print control device and print control program

Publications (2)

Publication Number Publication Date
JP2017194758A JP2017194758A (en) 2017-10-26
JP6680060B2 true JP6680060B2 (en) 2020-04-15

Family

ID=60156467

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2016083231A Active JP6680060B2 (en) 2016-04-18 2016-04-18 Print control device and print control program

Country Status (1)

Country Link
JP (1) JP6680060B2 (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3199950B2 (en) * 1994-03-31 2001-08-20 キヤノン株式会社 Printer device, printer system, and control method therefor
JP4231241B2 (en) * 2002-05-29 2009-02-25 セイコーエプソン株式会社 Network communication
JP2011039948A (en) * 2009-08-18 2011-02-24 Ricoh Co Ltd Print system, printer driver and printing device

Also Published As

Publication number Publication date
JP2017194758A (en) 2017-10-26

Similar Documents

Publication Publication Date Title
US9442678B2 (en) Information processing apparatus, information processing system and non-transitory computer-readable information recording medium
US9116651B2 (en) Image processing apparatus, control method, and recording medium storing computer program for image processing
EP3471389A2 (en) Program
US20130235422A1 (en) Printing system and method thereof
EP2423812A1 (en) Device and help server
US20100328689A1 (en) Host device and image forming apparatus controlled by host device, and peripheral device control method
KR100748620B1 (en) Method and apparatus for setting print-option
US20140139878A1 (en) Communication Relaying Technology and Communication Relaying Apparatus
US9300824B2 (en) Method and image forming apparatus to generate user interface screen to be displayed to user accessing the image forming apparatus
US9628665B2 (en) Information processing system, information processing apparatus, information processing method, and recording medium
JP2012171269A (en) Image forming apparatus, information processing system, accounting method, program, and recording medium
US9338314B2 (en) User terminal apparatus and method of control thereof
US20150138582A1 (en) Image forming apparatus, method for controlling the same and storage medium
JP2016177608A (en) Printing control device and printing control program
US20140029051A1 (en) Device controlling apparatus, device apparatus, and control program
US8826085B2 (en) Display screen control device with error alert, display screen control method, and computer readable medium
US10592180B2 (en) Information processing device, information processing method, and recording medium
US20170155773A1 (en) Pull Print System
US9781088B2 (en) Information processing apparatus, method of controlling the same, and storage medium
US9367267B2 (en) Relaying device, image processing device, and system comprising image processing device and relaying device and image data conversion process
JP6680060B2 (en) Print control device and print control program
US20180173479A1 (en) Image forming apparatus capable of mounting application and method for controlling the same
US11748173B2 (en) Information processing system, information processing method, and storage medium for controlling virtual server that executes program
US20150116763A1 (en) Method of executing web application in image forming apparatus and image forming apparatus to perform the method
US9836677B2 (en) Print controlling apparatus and computer-readable recording medium storing print control program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20190411

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20191127

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20191203

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20200130

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20200218

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20200302

R150 Certificate of patent or registration of utility model

Ref document number: 6680060

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150