JP2010097603A - Communication system - Google Patents

Communication system Download PDF

Info

Publication number
JP2010097603A
JP2010097603A JP2009214032A JP2009214032A JP2010097603A JP 2010097603 A JP2010097603 A JP 2010097603A JP 2009214032 A JP2009214032 A JP 2009214032A JP 2009214032 A JP2009214032 A JP 2009214032A JP 2010097603 A JP2010097603 A JP 2010097603A
Authority
JP
Japan
Prior art keywords
communication
application program
communication port
handle
virtual
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.)
Granted
Application number
JP2009214032A
Other languages
Japanese (ja)
Other versions
JP5182261B2 (en
Inventor
Shinji Nagami
真士 永見
Kunio Yasui
邦雄 安井
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.)
Denso Wave Inc
Original Assignee
Denso Wave Inc
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 Denso Wave Inc filed Critical Denso Wave Inc
Priority to JP2009214032A priority Critical patent/JP5182261B2/en
Publication of JP2010097603A publication Critical patent/JP2010097603A/en
Application granted granted Critical
Publication of JP5182261B2 publication Critical patent/JP5182261B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)
  • Computer And Data Communications (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a communication system for switching methods for checking a communication operation between a method by external communication using a communication cable and a virtual method without performing the external communication. <P>SOLUTION: The communication system 1 includes a virtual communication checking means and an external communication checking means, and further has a selecting means for selecting either the virtual communication checking means or the external communication checking means. The virtual communication checking means includes a communication port allocating means and a virtual transmitting and receiving means. When the selecting means selects the virtual communication checking means, the virtual transmitting and receiving means virtually transmits and receives data from one application program to another application program and checks a communication operation of the data on the basis of the transmission and reception results. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、通信システムに関するものである。   The present invention relates to a communication system.

現在、パーソナルコンピュータなどの情報処理装置では、アプリケーションによる情報通信が広く行われている。この種の情報処理装置では、必要なときに情報通信が円滑に行われるようにするため、所望のタイミングで通信動作を確認しうる構成が求められており、従来では、確認対象となる情報処理装置に通信ケーブルを接続し、当該通信ケーブルを介して外部装置(例えば他のパーソナルコンピュータ)との通信を試行することで通信動作を確認する手法がとられていた。なお、本発明に関連する技術としては特許文献1のようなものがある。   Currently, information communication using applications is widely performed in information processing apparatuses such as personal computers. In this type of information processing apparatus, in order to smoothly perform information communication when necessary, a configuration capable of confirming a communication operation at a desired timing is required. Conventionally, information processing to be confirmed is required. A method has been adopted in which a communication cable is connected to the apparatus and communication operation is confirmed by trying communication with an external apparatus (for example, another personal computer) via the communication cable. In addition, there exists a thing like patent document 1 as a technique relevant to this invention.

特開2006−195954JP 2006-195954 A

上記のような従来構成の場合、通信動作の確認を行う場合、通信ケーブルや他のパーソナルコンピュータなどを必須とするため、これら通信ケーブルや他のパーソナルコンピュータを別途用意する必要があった。しかしながら、このような構成(即ち、通信ケーブルや他のパーソナルコンピュータなどの外部機器の準備を必須とする構成)では、通信動作の確認を、迅速に、或いは容易に行いにくいという問題があった。   In the case of the conventional configuration as described above, when a communication operation is confirmed, a communication cable or other personal computer is essential, and it is necessary to prepare these communication cable and other personal computer separately. However, in such a configuration (that is, a configuration in which the preparation of an external device such as a communication cable or another personal computer is essential), there is a problem that it is difficult to confirm the communication operation quickly or easily.

また、従来の情報処理装置では、いずれかのアプリケーションプログラムがある通信ポートを使用した場合、当該通信ポートはこのアプリケーションプログラムの占有状態となり、他のアプリケーションプログラムの使用を排除するような制御が行われていた。従って、複数のアプリケーションプログラムが同一の通信ポートを同時期に使用しながら動作確認やその他の通信を同時進行で行うことができず、動作確認やその他の通信を行う上で非常に制約が大きかった。   Further, in a conventional information processing apparatus, when a communication port with any application program is used, the communication port is occupied by the application program, and control is performed so as to exclude the use of other application programs. It was. Therefore, multiple application programs cannot use the same communication port at the same time to perform operation confirmation and other communications at the same time, which is very restrictive for operation confirmation and other communications. .

本発明は、上述した課題を解決するためになされたものであり、通信動作の確認方法を、通信ケーブルを用いた外部通信によって行う方法と、外部通信を行わずに仮想的に行う方法とで切り替えうる通信システムを提供することを第一の目的とする。
また、複数のアプリケーションプログラムが同一の通信ポートを同時期に使用することができる通信システムを提供することを第二の目的とする。
The present invention has been made in order to solve the above-described problem, and includes a method for performing a communication operation confirmation method by external communication using a communication cable and a method for performing virtual communication without external communication. A first object is to provide a switchable communication system.
A second object is to provide a communication system in which a plurality of application programs can use the same communication port at the same time.

上記目的を達成するため、請求項1の発明は、通信機器を接続可能な複数の通信ポートと、メモリとを備えたコンピュータを有し、前記通信ポートを介して外部装置と通信を行う通信システムであって、前記コンピュータは、複数のアプリケーションプログラムと、前記アプリケーションプログラムにて生成されるデータについての通信動作を確認する通信動作確認手段と、を備え、前記通信動作確認手段は、前記複数のアプリケーションプログラムにおける、一のアプリケーションプログラムと他のアプリケーションプログラムとの通信を仮想的に試行することで前記データの通信動作を確認する仮想通信確認手段と、
前記通信ポートに前記通信機器が接続されている場合に、前記アプリケーションプログラムにて生成された前記データを、前記通信ポートを介して前記コンピュータの外部に送信することで、前記データの通信動作を確認する外部通信確認手段と、前記データの通信動作を確認する手段として、前記仮想通信確認手段及び前記外部通信確認手段のいずれかを選択する選択手段と、を有し、前記仮想通信確認手段は、前記一のアプリケーションプログラムに対し、複数の前記通信ポートにおける第1の通信ポートを割り当てると共に、前記他のアプリケーションプログラムに対して第2の通信ポートを割り当て、それら第1の通信ポート及び第2の通信ポートを特定するポート情報を前記メモリに記憶する通信ポート割当手段と、前記ポート情報に基づいて前記第1の通信ポートと対応する前記第2の通信ポートを特定すると共に、前記一のアプリケーションプログラムから前記第1の通信ポートに送られるべき前記データを、前記第2の通信ポートが受信した前記データとして前記メモリに記憶し、且つ前記他のアプリケージョンプログラムに与える仮想送受信手段と、を備え、前記選択手段により当該仮想通信確認手段が選択された場合、前記仮想送受信手段により、前記一のアプリケーションプログラムから前記他のアプリケーションプログラムに対して前記データの仮想的な送受信を行い、その送受信結果に基づいて前記データの通信動作を確認することを特徴とする。
To achieve the above object, a first aspect of the present invention is a communication system having a computer having a plurality of communication ports to which communication devices can be connected and a memory, and communicating with an external device through the communication ports. The computer includes a plurality of application programs, and a communication operation confirmation unit that confirms a communication operation for data generated by the application program, and the communication operation confirmation unit includes the plurality of applications. Virtual communication confirmation means for confirming the communication operation of the data by virtually trying communication between one application program and another application program in the program;
When the communication device is connected to the communication port, the data generated by the application program is transmitted to the outside of the computer via the communication port, thereby confirming the data communication operation. External communication confirmation means, and as means for confirming the communication operation of the data, selection means for selecting either the virtual communication confirmation means or the external communication confirmation means, the virtual communication confirmation means, A first communication port in the plurality of communication ports is assigned to the one application program, and a second communication port is assigned to the other application program, and the first communication port and the second communication are assigned. Communication port assigning means for storing port information for identifying a port in the memory, and the port information. The second communication port corresponding to the first communication port based on the first communication port, and the second communication port transmits the data to be sent from the one application program to the first communication port. Virtual transmission / reception means for storing in the memory as the received data and giving to the other application program, and when the virtual communication confirmation means is selected by the selection means, the virtual transmission / reception means, The virtual transmission / reception of the data is performed from one application program to the other application program, and the communication operation of the data is confirmed based on the transmission / reception result.

請求項2の発明は、請求項1に記載の通信システムにおいて、前記通信機器が前記通信ポートに接続されているか否かを検出する検出手段を備え、前記選択手段は、前記検出手段により前記通信機器が検出されたことを条件として前記外部通信確認手段を選択することを特徴とする。   According to a second aspect of the present invention, in the communication system according to the first aspect, the communication device includes a detection unit that detects whether or not the communication device is connected to the communication port, and the selection unit uses the detection unit to perform the communication. The external communication confirmation unit is selected on condition that a device is detected.

請求項3の発明は、請求項2に記載の通信システムにおいて、前記検出手段は、前記通信ポートに特定種類の前記通信機器が接続されているか否かを検出し、前記選択手段は、前記検出手段により前記特定種類の前記通信機器が検出された場合にのみ前記外部通信確認手段を選択することを特徴とする。   According to a third aspect of the present invention, in the communication system according to the second aspect, the detection unit detects whether or not a specific type of the communication device is connected to the communication port, and the selection unit includes the detection unit. The external communication confirmation unit is selected only when the communication device of the specific type is detected by the unit.

請求項4の発明は、請求項2又は請求項3に記載の通信システムにおいて、前記検出手段は、前記通信ポート割当手段によって割り当てられた前記第1の通信ポートに前記通信機器が接続されているか否かを検出し、前記選択手段は、前記第1の通信ポートに前記通信機器が接続されている場合に前記外部通信確認手段を選択することを特徴とする。   According to a fourth aspect of the present invention, in the communication system according to the second or third aspect, is the detection unit configured such that the communication device is connected to the first communication port allocated by the communication port allocation unit. The selection means selects the external communication confirmation means when the communication device is connected to the first communication port.

請求項5の発明は、請求項1から請求項4のいずれか一項に記載の通信システムにおいて、前記通信ポート割当手段は、前記仮想通信確認手段に対して命令を与える上位プログラムからの設定変更命令に基づき、前記他のアプリケーションプログラムに割り当てる前記第2の通信ポートを設定変更する設定変更手段を備え、前記仮想送受信手段による前記仮想的な送受信中に前記設定変更命令がなされた場合、当該仮想的な送受信が完了するまで、前記設定変更手段による前記第2の通信ポートの設定変更を中止することを特徴とする。   According to a fifth aspect of the present invention, in the communication system according to any one of the first to fourth aspects, the communication port allocating means changes a setting from a higher-level program that gives a command to the virtual communication confirmation means. A setting change unit configured to change the setting of the second communication port to be assigned to the other application program based on the command, and when the setting change command is made during the virtual transmission / reception by the virtual transmission / reception unit, The setting change of the second communication port by the setting change unit is stopped until a complete transmission / reception is completed.

請求項6の発明は、請求項1から請求項5のいずれか一項に記載の通信システムにおいて、前記通信ポート割当手段は、前記一のアプリケーションプログラムに割り当てる前記第1の通信ポートと、前記他のアプリケーションプログラムに割り当てる前記第2の通信ポートとを互いに異なる前記通信ポートとすることを特徴とする。   According to a sixth aspect of the present invention, in the communication system according to any one of the first to fifth aspects, the communication port allocating means includes the first communication port allocated to the one application program, and the other The second communication port assigned to the application program is different from the communication port.

請求項7の発明は、通信機器を接続可能な通信ポートと、メモリとを備えたコンピュータを有し、前記通信ポートを介して外部装置と通信を行う通信システムであって、
前記コンピュータが、複数のアプリケーションプログラムと、各アプリケーションプログラムによる前記通信ポートの呼び出し回数をカウントすると共に、前記各アプリケーションプログラムによる当該通信ポートを用いた通信処理の終了毎に前記呼び出し回数を減じる呼び出し回数増減手段と、前記アプリケーションプログラムが前記通信ポートを呼び出したときに、前記呼び出し回数増減手段による前記呼び出し回数が所定値以下か否かを判断する判断手段と、前記判断手段によって前記通信ポートの前記呼び出し回数が前記所定値以下と判断された場合に、前記アプリケーションプログラムによって呼び出された当該通信ポートにて通信を行うためのハンドルを保存するハンドル保存手段と、前記各アプリケーションプログラムが前記通信ポートを呼び出したときに、前記各アプリケーションプログラムに対し、前記ハンドル保存手段によって保存された前記ハンドルに対応した仮想ハンドルを設定する仮想ハンドル設定手段と、前記ハンドル保存手段によって保存される前記ハンドルと、前記仮想ハンドル設定手段によって前記各アプリケーションプログラムに設定される各仮想ハンドルとの対応データを保存する対応データ保存手段と、前記各アプリケーションプログラムが前記通信ポートを用いて通信を行う際に、前記対応データ保存手段に保存された前記対応データに従い、前記各アプリケーションプログラムに設定された前記仮想ハンドルと対応付けられた前記ハンドルを使用する通信制御手段と、を備えたことを特徴としている。
The invention of claim 7 is a communication system having a computer having a communication port to which a communication device can be connected and a memory, and communicating with an external device via the communication port,
The computer counts the number of calls of the communication port by each application program and a plurality of application programs, and reduces the number of calls by decreasing the number of calls at the end of communication processing using the communication port by each application program Means, when the application program calls the communication port, a determination means for determining whether the number of calls by the call number increase / decrease means is a predetermined value or less, and the number of calls of the communication port by the determination means Is determined to be less than or equal to the predetermined value, handle storage means for storing a handle for performing communication at the communication port called by the application program, and each application program Virtual handle setting means for setting a virtual handle corresponding to the handle saved by the handle saving means for each application program when the communication port is called, and the handle saved by the handle saving means; A correspondence data storage means for storing correspondence data with each virtual handle set in each application program by the virtual handle setting means, and the correspondence processing when each application program communicates using the communication port. And a communication control unit that uses the handle associated with the virtual handle set in each application program in accordance with the correspondence data stored in the data storage unit.

請求項8の発明は、請求項7に記載の通信システムにおいて、前記通信制御手段が、前記アプリケーションプログラムが特定の通信関連コマンドを実行したときに、前記仮想ハンドルを用いた通信を行うか否かを確認する仮想ハンドル利用確認手段を備え、前記仮想ハンドル利用確認手段によって前記仮想ハンドルを用いた通信であることが確認された場合に、前記アプリケーションプログラムに設定された前記仮想ハンドルと対応付けられた前記ハンドルを使用することを特徴としている。   The invention according to claim 8 is the communication system according to claim 7, wherein the communication control means determines whether to perform communication using the virtual handle when the application program executes a specific communication-related command. Virtual handle use confirmation means for confirming the communication, and when the virtual handle use confirmation means confirms the communication using the virtual handle, the virtual handle use confirmation means is associated with the virtual handle set in the application program. The handle is used.

請求項9の発明は、請求項7又は請求項8に記載の通信システムにおいて、
前記アプリケーションプログラムによる前記通信ポートを使用した通信処理が終了した場合に、前記対応データ保存手段によって保存された前記対応データにおいて、その通信処理が終了した前記アプリケーションプログラムについての前記仮想ハンドルと前記ハンドルとの対応値を破棄する対応値破棄手段を備えたことを特徴としている。
The invention of claim 9 is the communication system according to claim 7 or claim 8, wherein
When the communication process using the communication port by the application program ends, the virtual handle and the handle for the application program for which the communication process has ended in the corresponding data stored by the corresponding data storage unit The correspondence value discarding means for discarding the corresponding value is provided.

請求項10の発明は、請求項7から請求項9のいずれか一項に記載の通信システムにおいて、
前記外部装置が、前記コンピュータとの間でデータの送信又は受信を行う複数のプログラムを備えた携帯端末であり、
前記通信制御手段が、前記コンピュータの複数の前記アプリケーションプログラムのうち、いずれか一のアプリケーションプログラムが前記通信ポートを用いて前記携帯端末の一のプログラムと通信を行う際に、前記対応データ保存手段に保存された前記対応データに従い、前記一のアプリケーションプログラムに設定された前記仮想ハンドルに対応する前記ハンドルを使用し、
前記一のアプリケーションプログラムによる前記通信ポートを用いた通信処理の継続中に、複数の前記アプリケーションプログラムのうちの他のアプリケーションプログラムが当該通信ポートを用いて前記携帯端末の他のプログラムと通信を行う場合、前記他のアプリケーションプログラムに設定された前記仮想ハンドルと前記対応データとに基づき、当該通信ポートに対応する前記ハンドルを使用することを特徴としている。
The invention of claim 10 is the communication system according to any one of claims 7 to 9,
The external device is a mobile terminal provided with a plurality of programs for transmitting or receiving data to and from the computer,
When the communication control unit communicates with one program of the mobile terminal using the communication port, any one of the plurality of application programs of the computer uses the communication data storage unit. According to the stored correspondence data, use the handle corresponding to the virtual handle set in the one application program,
When another application program of the plurality of application programs communicates with another program of the mobile terminal using the communication port while communication processing using the communication port by the one application program is continued The handle corresponding to the communication port is used based on the virtual handle set in the other application program and the corresponding data.

請求項1の発明は、一のアプリケーションプログラムと他のアプリケーションプログラムとの通信を仮想的に試行する仮想通信確認手段と、アプリケーションプログラムにて生成されたデータを、通信ポートを介してコンピュータの外部に送信してデータの通信動作を確認する外部通信確認手段とが設けられているため、状況に応じて仮想通信確認手段と外部通信確認手段とを使い分けることができ、通信動作をより適切な方法で確認できるようになる。例えば、通信ケーブルや外部装置を準備しにくい場合であっても、外部通信確認手段を用いずに仮想通信確認手段によって通信動作を確認でき、通信動作の確認作業やその準備の容易化が効果的に図られる。
また、一のアプリケーションプログラムに対し第1の通信ポートを割り当て、他のアプリケーションプログラムに対し第2の通信ポートを割り当て、それら第1の通信ポート及び第2の通信ポートを特定するポート情報をメモリに記憶しているため、一のアプリケーションプログラムに対応する送信ポートと、他のアプリケーションプログラムに対応する受信ポートとの対応関係を明確にすることができる。
更に、一のアプリケーションプログラムから第1の通信ポートに送られるべきデータを、第2の通信ポートが受信したデータとしてメモリに記憶し、且つ他のアプリケージョンプログラムに与えるように構成されているため、実際に通信ケーブルを通信ポートに接続しなくても、一のアプリケーションプログラムからのデータを第1の通信ポートに与えるという送信状態の確認と、他のアプリケーションプログラムに対するデータを第2の通信ポートにて受信するという受信状態の確認とを仮想的に実現でき、外部通信確認手段を用いない場合であっても通信動作の確認が良好に行われることとなる。
According to the first aspect of the present invention, virtual communication confirmation means for virtually trying communication between one application program and another application program, and data generated by the application program are transmitted outside the computer via a communication port. Since there is an external communication confirmation means that transmits and confirms the data communication operation, the virtual communication confirmation means and the external communication confirmation means can be used properly according to the situation, and the communication operation can be performed in a more appropriate manner. It becomes possible to confirm. For example, even if it is difficult to prepare a communication cable or external device, the communication operation can be confirmed by the virtual communication confirmation means without using the external communication confirmation means. Is envisioned.
Also, a first communication port is assigned to one application program, a second communication port is assigned to another application program, and port information for specifying the first communication port and the second communication port is stored in the memory. Since it is stored, it is possible to clarify the correspondence between the transmission port corresponding to one application program and the reception port corresponding to another application program.
Furthermore, since the data to be sent from the one application program to the first communication port is stored in the memory as the data received by the second communication port and is provided to the other application program, Even if the communication cable is not actually connected to the communication port, confirmation of the transmission state in which data from one application program is given to the first communication port, and data for other application programs are sent to the second communication port. The confirmation of the reception state of reception can be virtually realized, and even if the external communication confirmation means is not used, the communication operation can be confirmed satisfactorily.

請求項2の発明では、通信機器が通信ポートに接続されているか否かを検出する検出手段が設けられており、検出手段により通信機器が検出されたことを条件として外部通信確認手段が選択されるように構成されている。このようにすると、外部通信確認手段による通信動作の確認が可能なときのみ外部通信確認手段が選択されるようになり、より適切な選択が可能となる。   In the second aspect of the invention, there is provided detection means for detecting whether or not the communication device is connected to the communication port, and the external communication confirmation means is selected on condition that the communication device is detected by the detection means. It is comprised so that. In this way, the external communication confirmation unit is selected only when the communication operation can be confirmed by the external communication confirmation unit, and a more appropriate selection is possible.

請求項3の発明は、検出手段により特定種類の通信機器が検出された場合にのみ外部通信確認手段を選択するように構成されている。このようにすると、通信動作確認の対象となる特定種類の通信機器が接続されたとき以外で外部通信確認手段が選択されることがなく、より一層適切な選択が可能となる。   The invention of claim 3 is configured to select the external communication confirmation unit only when a specific type of communication device is detected by the detection unit. In this way, the external communication confirmation unit is not selected except when a specific type of communication device that is a target of communication operation confirmation is connected, and a more appropriate selection is possible.

請求項4の発明は、通信ポート割当手段によって割り当てられた第1の通信ポートに通信機器が接続されているか否かを検出し、第1の通信ポートに通信機器が接続されている場合に外部通信確認手段を選択するように構成されている。このようにすると、一のアプリケーションシステムから外部への通信が可能な状態においては、外部通信確認手段を用いてより精度の高い通信動作確認が可能となる。   The invention according to claim 4 detects whether or not a communication device is connected to the first communication port assigned by the communication port assignment means, and externally when the communication device is connected to the first communication port. The communication confirmation unit is selected. In this way, in a state where communication from one application system to the outside is possible, more accurate communication operation confirmation can be performed using the external communication confirmation unit.

請求項5の発明は、上位プログラムからの設定変更命令に基づき、他のアプリケーションプログラムに割り当てる第2の通信ポートを設定変更する設定変更手段が設けられているため、他のアプリケーションプログラムに割り当てる通信ポートを必要に応じて変更できる。更に、仮想送受信手段による仮想的な送受信中に設定変更命令がなされた場合、当該仮想的な送受信が完了するまで、設定変更手段による第2の通信ポートの設定変更を中止している。このようにすると、第2の通信ポートを必要に応じて設定変更できるようにしつつ、その設定変更によって仮想的な動作確認が強制的に中断されることを効果的に防止できる。   The invention of claim 5 is provided with setting change means for changing the setting of the second communication port to be assigned to another application program based on the setting change command from the higher-level program, so that the communication port to be assigned to the other application program Can be changed as needed. Furthermore, when a setting change command is issued during virtual transmission / reception by the virtual transmission / reception means, the setting change of the second communication port by the setting change means is suspended until the virtual transmission / reception is completed. In this way, it is possible to effectively prevent the virtual operation check from being forcibly interrupted due to the setting change while allowing the second communication port to be changed as necessary.

請求項6の発明は、一のアプリケーションプログラムに割り当てる第1の通信ポートと、他のアプリケーションプログラムに割り当てる第2の通信ポートとが互いに異なる通信ポートとなるように設定している。このようにすると、仮想通信確認手段によって通信動作を確認するときに、第1の通信ポートと第2の通信ポートと区別して適切な動作確認を行うことができる。   According to a sixth aspect of the present invention, the first communication port assigned to one application program and the second communication port assigned to another application program are set to be different communication ports. In this way, when the communication operation is confirmed by the virtual communication confirmation unit, it is possible to distinguish between the first communication port and the second communication port and perform appropriate operation confirmation.

請求項7の発明では、呼び出し回数増減手段によってアプリケーションプログラムによる通信ポートの呼び出し回数を管理しており、アプリケーションプログラムが通信ポートを呼び出したときに、呼び出し回数増減手段によって管理される呼び出し回数が所定値以下か否かを判断している。そして、その通信ポートの呼び出し回数が所定値以下と判断された場合に、アプリケーションプログラムによって呼び出された当該通信ポートにて通信を行うためのハンドルを保存している。
このようにすると、通信ポートに対するアプリケーションプログラムの呼び出しがどの程度重複しているかを確認できる。そして、呼び出し回数が少ないときに、当該通信ポートで通信を行うためにハンドルを予め保存しておくことができる。
更に、各アプリケーションプログラムが通信ポートを呼び出したときに、各アプリケーションプログラムに対し、ハンドル保存手段によって保存されたハンドルに対応した仮想ハンドルを設定し、この設定された仮想ハンドルと、既に保存されているハンドルとの対応データを保存している。そして、各アプリケーションプログラムが通信ポートを用いて通信を行う際に、保存された対応データに従い、各アプリケーションプログラムに設定された仮想ハンドルと対応付けられたハンドルを使用している。
このようにすると、複数のアプリケーションプログラムが同じ通信ポートを呼び出した場合に、各アプリケーションプログラムに仮想ハンドルを割り当てることができ、各アプリケーションプログラムは対応データを拠り所として仮想ハンドルと対応する実際のハンドルを使用し、当該通信ポートでの通信を行うことができるようになる。従って、最初に通信ポートを呼び出したアプリケーションプログラムだけに当該通信ポートを占有させて他のアプリケーションプログラムによる当該通信ポートへのアクセスを排除するといった対応を行う必要がなく、複数のアプリケーションプログラムが同一の通信ポートを同時期に使用することができるようになる。
In the invention of claim 7, the number of calls of the communication port by the application program is managed by the call number increase / decrease means, and when the application program calls the communication port, the number of calls managed by the call number increase / decrease means is a predetermined value. It is determined whether or not: When it is determined that the number of calls of the communication port is equal to or less than a predetermined value, a handle for performing communication at the communication port called by the application program is stored.
In this way, it can be confirmed how much the calling of the application program to the communication port is duplicated. Then, when the number of calls is small, the handle can be stored in advance for communication with the communication port.
Further, when each application program calls the communication port, a virtual handle corresponding to the handle stored by the handle storage unit is set for each application program, and the set virtual handle and the stored virtual handle are already stored. Data corresponding to the handle is saved. When each application program communicates using the communication port, a handle associated with the virtual handle set in each application program is used according to the stored correspondence data.
In this way, when multiple application programs call the same communication port, a virtual handle can be assigned to each application program, and each application program uses the actual handle corresponding to the virtual handle based on the corresponding data. Then, communication can be performed at the communication port. Therefore, there is no need to take measures such as occupying the communication port only to the application program that called the communication port first to eliminate access to the communication port by other application programs, and multiple application programs can share the same communication. The port can be used at the same time.

請求項8の発明では、アプリケーションプログラムが特定の通信関連コマンドを実行したときに、仮想ハンドルを用いた通信を行うか否かを確認する仮想ハンドル利用確認手段を備え、仮想ハンドル利用確認手段によって仮想ハンドルを用いた通信であることが確認された場合に、アプリケーションプログラムに設定された仮想ハンドルと対応付けられたハンドルを使用している。
このようにすると、特定の通信関連コマンドが実行されたことをトリガとして仮想ハンドルを用いた通信を行うことができるようになる。その際、仮想ハンドルを用いた通信を行うか否かの確認を行った上で、通信処理に移行しているため、特定の通信関連コマンドで他の処理を実行する場合(即ち、仮想ハンドルを用いた通信を行わない例外ケース)にも対応しやすくなる。
According to the eighth aspect of the present invention, the virtual handle utilization confirmation means is provided for confirming whether or not to perform communication using the virtual handle when the application program executes a specific communication-related command. When the communication using the handle is confirmed, the handle associated with the virtual handle set in the application program is used.
In this way, it becomes possible to perform communication using the virtual handle triggered by the execution of a specific communication-related command. At this time, after confirming whether or not to perform communication using the virtual handle, since the process has shifted to the communication process, when another process is executed with a specific communication-related command (that is, the virtual handle is Exception cases that do not use communication) can be handled easily.

請求項9の発明は、アプリケーションプログラムによる通信ポートを使用した通信処理が終了した場合に、対応データ保存手段によって保存された対応データにおいて、その通信処理が終了したアプリケーションプログラムについての仮想ハンドルとハンドルとの対応値を破棄する対応値破棄手段を備えている。このようにすると、通信処理が終了して不要になった仮想ハンドルを削除することができ、対応データを常に適切な状態に維持できるようになる。   According to the ninth aspect of the present invention, when the communication process using the communication port by the application program is completed, in the correspondence data saved by the correspondence data saving means, the virtual handle and the handle for the application program for which the communication process is finished Corresponding value discarding means for discarding the corresponding value is provided. In this way, it is possible to delete virtual handles that are no longer needed after the completion of communication processing, and it is possible to always maintain corresponding data in an appropriate state.

請求項10の発明は、外部装置が、コンピュータとの間でデータの送信又は受信を行う複数のプログラムを備えた携帯端末として構成されている。そして、コンピュータの複数のアプリケーションプログラムのうち、いずれか一のアプリケーションプログラムが通信ポートを用いて携帯端末の一のプログラムと通信を行う際に、対応データ保存手段に保存された対応データに従い、一のアプリケーションプログラムに設定された仮想ハンドルに対応するハンドルを使用している。また、一のアプリケーションプログラムによる通信ポートを用いた通信処理の継続中に、複数のアプリケーションプログラムのうちの他のアプリケーションプログラムが当該通信ポートを用いて携帯端末の他のプログラムと通信を行う場合、他のアプリケーションプログラムに設定された仮想ハンドルと対応データとに基づき、当該通信ポートに対応するハンドルを使用している。
このようにすると、コンピュータに記憶されたいずれかのアプリケーションプログラムが通信ポートを介して携帯端末のいずれかのプログラムと通信処理を行っている際に、コンピュータの他のアプリケーションプログラムが同じ通信ポートを用いて携帯端末の他のプログラムと通信処理を行うことができるようになる。従って、通信ポートが制約されやすい携帯端末との通信であっても、複数のアプリケーションプログラムが同一の通信ポートを使用して同時期に通信を行うことができるようになり、ひいては、コンピュータと携帯端末との間で多様な処理が実現可能となる。
According to the invention of claim 10, the external device is configured as a portable terminal provided with a plurality of programs for transmitting and receiving data to and from the computer. Then, when any one of the plurality of application programs of the computer communicates with one program of the mobile terminal using the communication port, according to the corresponding data stored in the corresponding data storage means, A handle corresponding to the virtual handle set in the application program is used. Also, when communication processing using a communication port by one application program is continued, another application program of the plurality of application programs communicates with another program of the mobile terminal using the communication port. The handle corresponding to the communication port is used based on the virtual handle set in the application program and the corresponding data.
In this way, when any application program stored in the computer is communicating with any program of the mobile terminal via the communication port, the other application program of the computer uses the same communication port. Thus, communication processing with other programs of the mobile terminal can be performed. Accordingly, even when communication is performed with a portable terminal whose communication port is likely to be restricted, a plurality of application programs can communicate at the same time using the same communication port, and as a result, the computer and the portable terminal. A variety of processing can be realized.

図1は、第1実施形態に係る通信システムを概略的に説明する説明図である。FIG. 1 is an explanatory diagram schematically illustrating the communication system according to the first embodiment. 図2は、図1の通信システムの電気的構成を例示するブロック図である。FIG. 2 is a block diagram illustrating the electrical configuration of the communication system of FIG. 図3は、ハードウェアが接続されているときのOS内の構成を概略的に説明する説明図である。FIG. 3 is an explanatory diagram schematically illustrating a configuration in the OS when hardware is connected. 図4は、ドライバロード処理の流れを例示するフローチャートである。FIG. 4 is a flowchart illustrating the flow of the driver loading process. 図5は、通信ポートオープン処理の流れを例示するフローチャートである。FIG. 5 is a flowchart illustrating the flow of the communication port open process. 図6は、データ送信処理の流れを例示するフローチャートである。FIG. 6 is a flowchart illustrating the flow of the data transmission process. 図7は、データ受信処理の流れを例示するフローチャートである。FIG. 7 is a flowchart illustrating the flow of data reception processing. 図8は、第2実施形態に係る通信システムを概略的に説明する説明図である。FIG. 8 is an explanatory diagram schematically illustrating a communication system according to the second embodiment. 図9は、アプリケーションプログラムによって実行される通信処理の流れを概略的に例示するフローチャートである。FIG. 9 is a flowchart schematically illustrating the flow of communication processing executed by the application program. 図10は、通信ポートオープン時のAPIフック処理を例示するフローチャートである。FIG. 10 is a flowchart illustrating an API hook process when the communication port is open. 図11(a)は、送信関連APIが呼び出されたときのAPIフック処理を例示するフローチャートである。図11(b)は、受信関連APIが呼び出されたときのAPIフック処理を例示するフローチャートである。FIG. 11A is a flowchart illustrating an API hook process when a transmission-related API is called. FIG. 11B is a flowchart illustrating an API hook process when a reception-related API is called. 図12は、通信ポートクローズ時のAPIフック処理を例示するフローチャートである。FIG. 12 is a flowchart illustrating an API hook process when the communication port is closed. 図13(a)は、各仮想ハンドルと正規のハンドルとの対応データを概念的に説明する説明図であり、図13(b)は、各アプリケーションプログラムに仮想ハンドルが割り当てられた状態を概念的に説明する説明図である。FIG. 13A is an explanatory diagram for conceptually explaining correspondence data between each virtual handle and a regular handle, and FIG. 13B conceptually shows a state in which a virtual handle is assigned to each application program. It is explanatory drawing demonstrated to.

[第1実施形態]
以下、本発明の通信システムを具現化した第1実施形態について、図面を参照して説明する。図1は、第1実施形態に係る通信システムを概略的に説明する説明図である。図2は、図1の通信システムの電気的構成を例示するブロック図である。図3は、通信ポートにハードウェアが接続されているときのOS内の構成を概略的に説明する説明図である。図4は、ドライバロード処理の流れを例示するフローチャートである。図5は、通信ポートオープン処理の流れを例示するフローチャートである。図6は、データ送信処理の流れを例示するフローチャートである。図7は、データ受信処理の流れを例示するフローチャートである。
[First embodiment]
Hereinafter, a first embodiment of a communication system according to the present invention will be described with reference to the drawings. FIG. 1 is an explanatory diagram schematically illustrating the communication system according to the first embodiment. FIG. 2 is a block diagram illustrating the electrical configuration of the communication system of FIG. FIG. 3 is an explanatory diagram schematically illustrating a configuration in the OS when hardware is connected to the communication port. FIG. 4 is a flowchart illustrating the flow of the driver loading process. FIG. 5 is a flowchart illustrating the flow of the communication port open process. FIG. 6 is a flowchart illustrating the flow of the data transmission process. FIG. 7 is a flowchart illustrating the flow of data reception processing.

(第1実施形態の通信システムの概要)
図1に示すように、本実施形態に係る通信システム1は、コンピュータ2によって構成されており、このコンピュータ2の内部に、アプリケーションプログラム(以下、アプリケーションとも称する)やオペレーティングシステム(以下、OSとも称する)20が格納された構成をなしている。コンピュータ2は、OS20の制御の下、これらアプリケーションプログラムを実行することで、各種処理を行うように構成されている。なお、図1では、コンピュータ2で用いられる一部のアプリケーションプログラムA、B(図1では、アプリケーションA、Bと略称)を例示しており、これら以外のアプリケーションプログラムについては図示を省略している。
(Outline of the communication system of the first embodiment)
As shown in FIG. 1, a communication system 1 according to the present embodiment is configured by a computer 2, and an application program (hereinafter also referred to as an application) and an operating system (hereinafter also referred to as an OS) are provided inside the computer 2. ) 20 is stored. The computer 2 is configured to perform various processes by executing these application programs under the control of the OS 20. 1 illustrates some application programs A and B (abbreviated as applications A and B in FIG. 1) used in the computer 2, and illustration of other application programs is omitted. .

コンピュータ2は、例えばパーソナルコンピュータとして構成されており、図2に示すように、CPU3、ROM4、RAM5、ハードディスクドライブ(以下HDDとも称する)6を備えている。また、CPU3には、バス11を介して、出力部7、入力部8、通信部9が接続されている。なお、図示はしていないが、バス11に接続された各回路とCPU3との間の入出力制御を行う入出力コントローラなども設けられている。   The computer 2 is configured as a personal computer, for example, and includes a CPU 3, a ROM 4, a RAM 5, and a hard disk drive (hereinafter also referred to as HDD) 6 as shown in FIG. Further, an output unit 7, an input unit 8, and a communication unit 9 are connected to the CPU 3 via the bus 11. Although not shown, an input / output controller that performs input / output control between each circuit connected to the bus 11 and the CPU 3 is also provided.

出力部7は、表示装置やスピーカなどによって構成されており、CPU3からの指令に基づいて各種画像や音声を出力する。また、入力部8は、キーボードやマウスなどによって構成されており、ユーザの操作に応じて各種信号を入力する。   The output unit 7 includes a display device, a speaker, and the like, and outputs various images and sounds based on commands from the CPU 3. The input unit 8 includes a keyboard, a mouse, and the like, and inputs various signals according to user operations.

通信部9は、アプリケーションプログラムなどによって生成されたデータを外部に送信したり、或いは外部装置からのデータを受信するように機能するものであり、通信インターフェース13と、複数の通信ポート14a〜14cとを備えた構成をなしている。各通信ポート14a〜14cは、シリアルコネクタやパラレルコネクタとして構成されており、RS232CケーブルやUSBケーブルなどの通信ケーブルを介して各種通信機器(例えば、他のコンピュータ、外部記憶装置、その他の情報処理装置等)が接続される構成をなしている。また、通信インターフェース13は、各通信ポート14a〜14cを介したデータの入出力制御を行うように構成されている。   The communication unit 9 functions to transmit data generated by an application program or the like to the outside, or to receive data from an external device, and includes a communication interface 13 and a plurality of communication ports 14a to 14c. It has a configuration with. Each of the communication ports 14a to 14c is configured as a serial connector or a parallel connector, and various communication devices (for example, other computers, external storage devices, and other information processing devices) via a communication cable such as an RS232C cable or a USB cable. Etc.) are connected. The communication interface 13 is configured to perform data input / output control via the communication ports 14a to 14c.

CPU3は、必要に応じ、上記入力部8にて入力された情報の取得、出力部7に対する出力制御、ROM4、RAM5、HDD6に対する読み取り或いは書き込みの制御、或いは、通信部9の制御を行う。また、CPU3は、HDD6に格納されているプログラムやHDD6にインストールされたプログラム等をRAM5にロードして実行する機能を有している。   The CPU 3 acquires information input from the input unit 8, performs output control on the output unit 7, controls reading or writing on the ROM 4, RAM 5, and HDD 6, or controls the communication unit 9 as necessary. Further, the CPU 3 has a function of loading a program stored in the HDD 6, a program installed in the HDD 6, and the like into the RAM 5 and executing the program.

また、コンピュータ2で用いられるOS20は、図1のような構成をなしている。なお、図1では、後述する仮想ドライバがロードされた状態を示している。OS20としては、例えば、Unix(登録商標)や、Linux、さらには、マイクロソフト社のWindows(登録商標)、その他の任意のOSを採用することができる。図1では、その一例として、Windows(登録商標)のNT系のOSが採用されたときの構成例を示している。   The OS 20 used in the computer 2 has a configuration as shown in FIG. FIG. 1 shows a state in which a virtual driver described later is loaded. As the OS 20, for example, Unix (registered trademark), Linux, Windows (registered trademark) of Microsoft Corporation, or any other OS can be employed. As an example, FIG. 1 shows a configuration example when a Windows (registered trademark) NT-based OS is employed.

Windows(登録商標)のNT系のOSであるOS20は、マイクロカーネル技術とオブジェクト指向技術をベースとし、各サービスを、サブシステムによって実装している。Win32サブシステム21は、サブシステムの1つで、アプリケーションプログラムA、Bに対して、各種のAPI(Application Programming Interface)(関数)を提供し、例えば、メモリ管理、プロセス管理、グラフィックス描画などを行う。Win32サブシステム21は、アプリケーションプログラムA、Bから、例えば、入出力関係のAPI関数が呼び出されると、そのAPI関数に応じた入出力要求を、IOマネージャ22に出力する。   An OS 20 that is an NT-based OS of Windows (registered trademark) is based on a microkernel technology and an object-oriented technology, and each service is implemented by a subsystem. The Win32 subsystem 21 is one of the subsystems, and provides various APIs (functions) to the application programs A and B. For example, memory management, process management, graphics drawing, etc. Do. For example, when an input / output related API function is called from the application programs A and B, the Win32 subsystem 21 outputs an input / output request corresponding to the API function to the IO manager 22.

また、OS20には、デバイスドライバが組み込まれるようになっており、図1では、後述する仮想ドライバがロードされたときの階層構成を示している。また、図3では、ハードウェアが接続され、このハードウェアのデバイスドライバがロードされているときの階層構成を示している。   Further, a device driver is incorporated in the OS 20, and FIG. 1 shows a hierarchical structure when a virtual driver described later is loaded. FIG. 3 shows a hierarchical structure when hardware is connected and a device driver for the hardware is loaded.

(第1実施形態の特徴的構成)
次に、本実施形態の特徴的構成について説明する。
本実施形態に係る通信システム1は、アプリケーションプログラムにて生成されるデータについての通信動作を確認する「通信動作確認手段」を備えている。以下では、この通信動作確認処理について具体的に説明する。
(Characteristic configuration of the first embodiment)
Next, a characteristic configuration of the present embodiment will be described.
The communication system 1 according to the present embodiment includes “communication operation confirmation means” for confirming the communication operation for data generated by an application program. Hereinafter, the communication operation confirmation process will be specifically described.

まず、図4を参照してドライバロード処理の流れを説明する。このドライバロード処理は、通信動作の確認処理を行うためのドライバをRAM5にロードする処理であり、例えば、ユーザによる所定操作時、或いはコンピュータ2の起動時などに実行される。当該処理が開始されると、まず、設定値の取得処理が行われる(S1)。この設定値の取得処理では、通信が行われるアプリケーションプログラム毎に使用する通信ポートが割り当てられる。例えば、図1のようにシリアル通信を行うアプリケーションとしてアプリケーションA、Bが存在する場合、一方のアプリケーションプログラムAに対していずれかの一の通信ポートが割り当てられ、他方のアプリケーションプログラムBに対して、アプリケーションプログラムAに割り当てられた通信ポートと異なる通信ポートが割り当てられる。   First, the flow of the driver loading process will be described with reference to FIG. This driver loading process is a process of loading a driver for performing a communication operation confirmation process into the RAM 5, and is executed, for example, when a predetermined operation is performed by the user or when the computer 2 is activated. When the process is started, first, a setting value acquisition process is performed (S1). In this setting value acquisition process, a communication port to be used is assigned to each application program with which communication is performed. For example, when applications A and B exist as applications for serial communication as shown in FIG. 1, one of the communication ports is assigned to one application program A, and the other application program B is A communication port different from the communication port assigned to the application program A is assigned.

以下では、アプリケーションプログラムAに対して通信ポート14aが割り当てられ、アプリケーションプログラムBに対して通信ポート14bが割り当てられた例を挙げて説明する。なお、アプリケーションプログラムAに割り当てられる通信ポート14aは、「第1の通信ポート」に相当し、アプリケーションプログラムBに割り当てられる通信ポート14bは、「第2の通信ポート」に相当するものであり、以下、通信ポート14aを、第1の通信ポートとも称し、通信ポート14bを第2の通信ポートとも称することとする。   Hereinafter, an example in which the communication port 14a is assigned to the application program A and the communication port 14b is assigned to the application program B will be described. Note that the communication port 14a assigned to the application program A corresponds to the “first communication port”, and the communication port 14b assigned to the application program B corresponds to the “second communication port”. The communication port 14a is also referred to as a first communication port, and the communication port 14b is also referred to as a second communication port.

S1では、通信相手のポート番号を設定する処理も行われる。この処理は、仮想的に通信動作確認を行うときの通信相手のポート番号を設定する処理であり、例えばアプリケーションプログラムAからアプリケーションプログラムBに対してデータを送信し仮想的な通信動作確認を行う場合、アプリケーションプログラムAの通信相手のポート番号として、アプリケーションプログラムBに割り当てられた通信ポート14bのポート番号を設定する。なお、どのアプリケーションプログラムにどの通信ポートを割り当てるか、或いはどの通信ポートとどの通信ポートで仮想的な通信を行うかはユーザによって任意に選択できるようにすることができる。   In S1, processing for setting the port number of the communication partner is also performed. This process is a process of setting a port number of a communication partner when performing a virtual communication operation check. For example, when data is transmitted from the application program A to the application program B to perform a virtual communication operation check Then, the port number of the communication port 14b assigned to the application program B is set as the port number of the communication partner of the application program A. Note that it is possible to arbitrarily select which communication port is assigned to which application program, or which communication port and which communication port perform virtual communication.

S1の処理においてアプリケーションプログラムAに割り当てられた通信ポート14aのポート番号(第1の通信ポートのポート番号)及びアプリケーションプログラムBに割り当てられた通信ポート14bのポート番号(第2の通信ポートのポート番号)はレジストリに記憶され、更に、通信ポート14aの通信相手として通信ポート14bを指定する対応情報もレジストリに記憶される。   The port number of the communication port 14a assigned to the application program A in the processing of S1 (port number of the first communication port) and the port number of the communication port 14b assigned to the application program B (the port number of the second communication port) ) Is stored in the registry, and correspondence information for designating the communication port 14b as the communication partner of the communication port 14a is also stored in the registry.

なお、CPU3は、「通信ポート割当手段」の一例に相当し、アプリケーションプログラムA(一のアプリケーションプログラム)に対し、通信ポート14a(第1の通信ポート)を割り当てると共に、アプリケーションプログラムB(他のアプリケーションプログラム)に対して通信ポート14b(第2の通信ポート)を割り当て、それら第1の通信ポート及び第2の通信ポートを特定するポート情報をメモリに記憶するように機能する。また、アプリケーションプログラムA(一のアプリケーションプログラム)に割り当てる第1の通信ポートと、アプリケーションプログラムB(他のアプリケーションプログラム)に割り当てる第2の通信ポートとを互いに異なる通信ポートとするように機能している。   The CPU 3 corresponds to an example of “communication port assignment means”, and assigns the communication port 14a (first communication port) to the application program A (one application program) and also applies the application program B (other application program). The communication port 14b (second communication port) is assigned to the program), and port information for specifying the first communication port and the second communication port is stored in the memory. Further, the first communication port assigned to the application program A (one application program) and the second communication port assigned to the application program B (other application program) function to be different communication ports. .

その後、ハードウェアの接続状況を確認する(S2)。このS2の処理は、通信動作確認を行おうとするアプリケーションプログラムに割り当てられた通信ポートにハードウェア(通信機器)が接続されているか否かを確認する処理であり、上述のようにアプリケーションプログラムAに対して通信ポート14aが割り当てられている場合、この通信ポート14aにコンピュータ2と通信を行い得る通信機器が接続されているか否かを確認する。   Thereafter, the hardware connection status is confirmed (S2). The process of S2 is a process of confirming whether or not hardware (communication device) is connected to the communication port assigned to the application program for which the communication operation confirmation is to be performed. On the other hand, when the communication port 14a is assigned, it is confirmed whether or not a communication device capable of communicating with the computer 2 is connected to the communication port 14a.

アプリケーションプログラムAに割り当てられた通信ポート14aにハードウェア(通信機器)が接続されていない場合には、S3にてNoに進み、仮想ドライバをロードする(S4)。この仮想ドライバは、通信動作の確認を仮想的に行うためのドライバであり、予めHDD6等の記憶手段に記憶され、CPU3によって読み出され実行されるものである。   If the hardware (communication device) is not connected to the communication port 14a assigned to the application program A, the process proceeds to No in S3 and loads the virtual driver (S4). The virtual driver is a driver for virtually confirming the communication operation, and is stored in advance in a storage unit such as the HDD 6 and read and executed by the CPU 3.

仮想ドライバがロードされたときには、OS内部の構成は図1のようになる。この構成では、アプリケーションプログラムAにて生成された送信データが、Win32サブシステム21、IOマネージャ22を介してデバイスドライバ上位23に渡されるようになっており、仮想ドライバは、デバイスドライバ下位25として構成され、デバイスドライバ23から上記送信データを取得するように機能する。   When the virtual driver is loaded, the internal configuration of the OS is as shown in FIG. In this configuration, transmission data generated by the application program A is passed to the device driver upper 23 through the Win32 subsystem 21 and the IO manager 22, and the virtual driver is configured as the device driver lower 25. And functions to acquire the transmission data from the device driver 23.

なお、CPU3は、「仮想通信確認手段」の一例に相当し、コンピュータ2に格納される一のアプリケーションプログラムと他のアプリケーションプログラムとの通信を仮想的に試行することでデータの通信動作を確認するように機能する。   The CPU 3 corresponds to an example of “virtual communication confirmation unit”, and confirms the data communication operation by virtually trying communication between one application program stored in the computer 2 and another application program. To function.

一方、アプリケーションプログラムAに割り当てられた通信ポート14aにハードウェア(通信機器)が接続されている場合にはS3にてYesに進み、接続されているハードウェアのドライバをロードする(S5)。   On the other hand, if hardware (communication device) is connected to the communication port 14a assigned to the application program A, the process proceeds to Yes in S3, and the driver of the connected hardware is loaded (S5).

ハードウェアのドライバがロードされたときには、OS内部の構成は例えば図3のようになり、アプリケーションプログラムAにて生成された送信データは、Win32サブシステム21、IOマネージャ22を介してデバイスドライバ上位23に渡され、デバイスドライバ下位25として構成されるハードウェアのドライバがこの送信データを取得する。そして、このデバイスドライバ下位26によってハードウェア27(通信機器)に対する通信制御がなされる。   When the hardware driver is loaded, the internal configuration of the OS is, for example, as shown in FIG. 3, and the transmission data generated by the application program A is sent to the upper device driver 23 via the Win32 subsystem 21 and the IO manager 22. The hardware driver configured as the device driver lower 25 obtains this transmission data. Then, communication control for the hardware 27 (communication device) is performed by the device driver lower 26.

なお、ハードウェアのドライバを実行するCPU3は、「外部通信確認手段」の一例に相当し、通信ポート14aに通信機器が接続されている場合に、アプリケーションプログラムAにて生成されたデータを、通信ポート14aを介してコンピュータ2の外部に送信することで、データの通信動作を確認するように機能する(例えば、アプリケーションプログラムAにて生成されたデータを、通信ポート14aを介して他のパーソナルコンピュータ、携帯情報端末等の外部通信装置に送信し、データの通信動作を確認するように機能する)。なお、ハードウェアのドライバをロードしてハードウェアと通信を行う構成、或いはその通信動作についてのデバック等を行う構成については公知であるので詳細は省略する。   The CPU 3 that executes the hardware driver corresponds to an example of the “external communication confirmation unit”. When a communication device is connected to the communication port 14a, the data generated by the application program A is communicated. By transmitting to the outside of the computer 2 via the port 14a, it functions to confirm the data communication operation (for example, the data generated by the application program A is transferred to another personal computer via the communication port 14a). , Function to send data to an external communication device such as a portable information terminal and check the data communication operation). Note that a configuration for loading a hardware driver to communicate with the hardware, or a configuration for performing debugging or the like for the communication operation is well known, and details thereof are omitted.

本実施形態では、CPU3が「検出手段」の一例に相当し、通信機器が通信ポート14aに接続されているか否かを検出するように機能する。更に、S5の処理を実行するCPU3は、「選択手段」の一例に相当し、通信ポート14aにおいて通信機器の接続が検出されたことを条件として「外部通信確認手段」を選択するように機能する。   In the present embodiment, the CPU 3 corresponds to an example of “detection means” and functions to detect whether or not a communication device is connected to the communication port 14a. Further, the CPU 3 that executes the process of S5 corresponds to an example of “selection means”, and functions to select “external communication confirmation means” on condition that the connection of the communication device is detected in the communication port 14a. .

次に、図5を参照して通信ポートオープン処理について説明する。通信ポートオープン処理は、アプリケーションプログラムAに割り当てられた通信ポート14aとアプリケーションプログラムBに割り当てられた通信ポート14bとをオープンする処理であり、上述の仮想ドライバに基づいて行われる。   Next, the communication port open process will be described with reference to FIG. The communication port open process is a process of opening the communication port 14a assigned to the application program A and the communication port 14b assigned to the application program B, and is performed based on the above virtual driver.

この処理では、まず、設定値の取得処理が行われる(S10)。S10の処理では、通信動作確認を行おうとするアプリケーションプログラム(アプリケーションプログラムA)に割り当てられた通信ポート14aのポート番号をレジストリから読み出すと共に、その通信ポート14aの通信相手として設定されている通信ポート14bのポート番号をレジストリから読み出す。そして、それら通信ポート番号とバッファとを関連付ける処理を行う(S11)。S11では、受信側で使用されるバッファ(受信バッファ)のメモリアドレスを取得し、通信ポート14bと対応付けてRAM5に記憶する。更に、上記受信バッファと送信バッファ(送信側の通信ポート14aと対応付けられたバッファ(なお、送信バッファは省略可))とをクリアし(S12)、内部状態をオープンに設定する(S13)。なお、S13の処理は、例えば通信ポート14a及び通信ポート14bがオープン状態であることを示すフラグを設定する。   In this process, first, a setting value acquisition process is performed (S10). In the processing of S10, the port number of the communication port 14a assigned to the application program (application program A) to be checked for communication operation is read from the registry, and the communication port 14b set as the communication partner of the communication port 14a is read. Read the port number from the registry. Then, a process of associating these communication port numbers with the buffer is performed (S11). In S11, the memory address of the buffer (reception buffer) used on the receiving side is acquired and stored in the RAM 5 in association with the communication port 14b. Further, the reception buffer and the transmission buffer (the buffer associated with the communication port 14a on the transmission side (the transmission buffer can be omitted)) are cleared (S12), and the internal state is set to open (S13). In the process of S13, for example, a flag indicating that the communication port 14a and the communication port 14b are in an open state is set.

次に、仮想ドライバによって行われるデータ送信処理について説明する。図6の処理は、アプリケーションプログラムAの実行中にデータ送信の指示がなされることに基づいて開始される処理であり、まず、アプリケーションプログラムAに割り当てられた通信ポート14aがオープン状態であるか否かを確認する(S20)。通信ポート14aがオープン状態である場合には、Win32サブシステム21、IOマネージャ22、デバイスドライバ23を介し、デバイスドライバ下位25(仮想ドライバ)に対してアプリケーションプログラムAからの送信データが渡される(S21)。仮想ドライバは、その取得した送信データを、アプリケーションプログラムAの通信相手となるアプリケーションプログラムBの受信バッファ(即ち、通信ポート14aの通信相手として設定された通信ポート14bに対応付けられた受信バッファ)に書き込み(S22)、通信相手の通信ポート14bに対して受信通知を行う(S23)。   Next, data transmission processing performed by the virtual driver will be described. The process in FIG. 6 is a process that is started based on an instruction to transmit data during execution of the application program A. First, whether or not the communication port 14a assigned to the application program A is in an open state. (S20). When the communication port 14a is in the open state, the transmission data from the application program A is passed to the device driver lower 25 (virtual driver) via the Win32 subsystem 21, the IO manager 22, and the device driver 23 (S21). ). The virtual driver transfers the acquired transmission data to the reception buffer of the application program B that is the communication partner of the application program A (that is, the reception buffer associated with the communication port 14b set as the communication partner of the communication port 14a). Write (S22), a reception notification is sent to the communication port 14b of the communication partner (S23).

一方、アプリケーションプログラムB側では図7のようなデータ受信処理が行われる。このデータ受信処理では、アプリケーションプログラムBに割り当てられた通信ポート14bがオープン状態であるか否かの確認がなされ(S30)、オープン状態のときにはS30にてYesに進み、受信通知の確認を行う(S31)。S31では、アプリケーションプログラムBに割り当てられた通信ポート14bに対して受信通知がなされたか否かの確認が行われ、S23(図6)の受信通知がなされている場合にはS31にてYesに進み、その受信イベントが上位に通知され、その通知に応じてアプリケーションプログラムBが受信バッファに書き込まれたデータ(アプリケーションプログラムAからの送信データ)を取得する(S32)。アプリケーションプログラムBが受信バッファに蓄積された送信データを取得した後には、受信バッファ内のデータは削除される。   On the other hand, data reception processing as shown in FIG. 7 is performed on the application program B side. In this data reception process, it is confirmed whether or not the communication port 14b assigned to the application program B is in an open state (S30). When the communication port 14b is in an open state, the process proceeds to Yes in S30 to confirm reception notification ( S31). In S31, it is confirmed whether or not a reception notification has been made to the communication port 14b assigned to the application program B. If the reception notification in S23 (FIG. 6) has been made, the process proceeds to Yes in S31. The reception event is notified to the host, and the application program B acquires data (transmission data from the application program A) written in the reception buffer in response to the notification (S32). After the application program B acquires the transmission data stored in the reception buffer, the data in the reception buffer is deleted.

なお、図5の処理によって設定された通信ポートのオープン状態は、ユーザによる所定操作、或いはコンピュータの起動終了時においてクローズ状態とされる。   The open state of the communication port set by the processing of FIG. 5 is a closed state at a predetermined operation by the user or at the end of the computer startup.

このように、仮想ドライバがロードされる場合(即ち、仮想通信確認手段が選択される場合)、アプリケーションプログラムA(一のアプリケーションプログラム)からアプリケーションプログラムB(他のアプリケーションプログラム)に対してデータの仮想的な送受信が行われ、その送受信結果に基づいてデータの通信動作の確認がなされる。通信動作の確認は、アプリケーションプログラムAのデータがアプリケーションプログラムBによって良好に取得されたか否か等、公知のデバック処理で用いられる様々な確認を行うことができる。   As described above, when the virtual driver is loaded (that is, when the virtual communication confirmation unit is selected), virtual data is transferred from the application program A (one application program) to the application program B (other application program). The data communication operation is confirmed based on the transmission / reception result. The confirmation of the communication operation can be performed in various confirmations used in a known debugging process, such as whether or not the data of the application program A has been successfully acquired by the application program B.

なお、CPU3は、「仮想送受信手段」の一例に相当し、ポート情報に基づいて第1の通信ポートと対応する第2の通信ポートを特定すると共に、一のアプリケーションプログラムから第1の通信ポートに送られるべきデータを、第2の通信ポートが受信したデータとしてメモリに記憶し、且つ他のアプリケージョンプログラムに与えるように機能する。   The CPU 3 corresponds to an example of “virtual transmission / reception means”, specifies the second communication port corresponding to the first communication port based on the port information, and changes from the one application program to the first communication port. The data to be sent is stored in memory as data received by the second communication port and serves to provide to other application programs.

(第1実施形態の主な効果)
本実施形態の構成によれば例えば以下のような効果を奏する。
上記実施形態では、アプリケーションプログラムAとアプリケーションプログラムBとの通信を仮想的に試行する「仮想通信確認手段」と、アプリケーションプログラムにて生成されたデータを、通信ポートを介してコンピュータの外部に送信してデータの通信動作を確認する「外部通信確認手段」とが設けられているため、状況に応じて仮想通信確認手段と外部通信確認手段とを使い分けることができ、通信動作をより適切な方法で確認できるようになる。例えば、通信ケーブルや外部装置を準備しにくい場合であっても、外部通信確認手段を用いずに仮想通信確認手段によって通信動作を確認でき、通信動作の確認作業やその準備の容易化が効果的に図られる。
(Main effects of the first embodiment)
According to the configuration of the present embodiment, for example, the following effects can be obtained.
In the above embodiment, the “virtual communication confirmation unit” that virtually attempts to communicate between the application program A and the application program B, and the data generated by the application program are transmitted to the outside of the computer via the communication port. Since there is an `` external communication confirmation means '' that confirms the data communication operation, the virtual communication confirmation means and the external communication confirmation means can be used properly according to the situation, and the communication operation can be performed in a more appropriate way. It becomes possible to confirm. For example, even if it is difficult to prepare a communication cable or external device, the communication operation can be confirmed by the virtual communication confirmation means without using the external communication confirmation means. Is envisioned.

また、アプリケーションプログラムAに対し第1の通信ポートを割り当て、アプリケーションプログラムBに対し第2の通信ポートを割り当て、それら第1の通信ポート及び第2の通信ポートを特定するポート情報をメモリに記憶しているため、アプリケーションプログラムAに対応する送信ポートと、アプリケーションプログラムBに対応する受信ポートとの対応関係を明確にすることができる。   In addition, a first communication port is assigned to the application program A, a second communication port is assigned to the application program B, and port information for specifying the first communication port and the second communication port is stored in the memory. Therefore, the correspondence relationship between the transmission port corresponding to the application program A and the reception port corresponding to the application program B can be clarified.

更に、アプリケーションプログラムAから第1の通信ポートに送られるべきデータが、第2の通信ポートが受信したデータとしてメモリに記憶され、更に、他のアプリケージョンプログラムに与えられるように構成されているため、実際に通信ケーブルを通信ポートに接続しなくても、アプリケーションプログラムAからのデータを第1の通信ポートを介して送信するという送信状態の確認と、アプリケーションプログラムBに対するデータを第2の通信ポートを介して受信するという受信状態の確認とを仮想的に実現でき、外部通信確認手段を用いない場合であっても通信動作の確認が良好に行われる。   Furthermore, data to be sent from the application program A to the first communication port is stored in the memory as data received by the second communication port, and is further provided to other application programs. Even if the communication cable is not actually connected to the communication port, confirmation of the transmission state in which data from the application program A is transmitted via the first communication port and data for the application program B are transmitted to the second communication port. It is possible to virtually confirm the reception state of reception via the network, and even if the external communication confirmation unit is not used, the communication operation can be confirmed satisfactorily.

また、通信機器が通信ポートに接続されているか否かを検出する「検出手段」が設けられており、「検出手段」により通信機器が検出されたことを条件として「外部通信確認手段」が選択されるように構成されている。このようにすると、「外部通信確認手段」による通信動作の確認が可能なときのみ「外部通信確認手段」が選択されるようになり、より適切な選択が可能となる。   In addition, a “detection unit” that detects whether or not a communication device is connected to a communication port is provided, and “external communication confirmation unit” is selected on the condition that the communication device is detected by the “detection unit”. It is configured to be. In this way, the “external communication confirmation unit” is selected only when the communication operation can be confirmed by the “external communication confirmation unit”, and a more appropriate selection is possible.

また、「通信ポート割当手段」によって割り当てられた第1の通信ポートに通信機器が接続されているか否かを検出し、第1の通信ポートに通信機器が接続されている場合に「外部通信確認手段」を選択するように構成されている。このようにすると、一のアプリケーションシステムから外部への通信が可能な状態においては、「外部通信確認手段」を用いてより精度の高い通信動作確認が可能となる。   Further, it is detected whether or not a communication device is connected to the first communication port assigned by the “communication port assigning means”, and when the communication device is connected to the first communication port, “external communication confirmation” is performed. The “means” is selected. In this way, in a state where communication from one application system to the outside is possible, it is possible to check communication operation with higher accuracy using the “external communication confirmation unit”.

また、アプリケーションプログラムAに割り当てる第1の通信ポートと、アプリケーションプログラムBに割り当てる第2の通信ポートとが互いに異なる通信ポートとなるように設定している。このようにすると、「仮想通信確認手段」によって通信動作を確認するときに、第1の通信ポートと第2の通信ポートと区別して適切な動作確認を行うことができる。   In addition, the first communication port assigned to the application program A and the second communication port assigned to the application program B are set to be different communication ports. In this way, when the communication operation is confirmed by the “virtual communication confirmation unit”, it is possible to distinguish between the first communication port and the second communication port and perform an appropriate operation confirmation.

[第2実施形態]
次に、本発明の通信システムの第2実施形態について図8〜図13を参照して説明する。
図8は、第2実施形態に係る通信システムを概略的に説明する説明図である。図9は、アプリケーションプログラムによって実行される通信処理の流れを概略的に例示するフローチャートである。図10は、通信ポートオープン時のAPIフック処理を例示するフローチャートである。図11(a)は、送信関連APIが呼び出されたときのAPIフック処理を例示するフローチャートであり、図11(b)は、受信関連APIが呼び出されたときのAPIフック処理を例示するフローチャートである。図12は、通信ポートクローズ時のAPIフック処理を例示するフローチャートである。図13(a)は、各仮想ハンドルと正規のハンドルとの対応データを概念的に説明する説明図であり、図13(b)は、コンピュータ内の各アプリケーションプログラムに仮想ハンドルが割り当てられた状態を概念的に説明する説明図である。なお、図13では、通信ポート14a(図2)の正規ハンドルとしてハンドルZが用いられ、通信ポート14aの仮想ハンドルとして、アプリケーションAに仮想ハンドルZ−1が割り当てられ、アプリケーションBに仮想ハンドルZ−2が割り当てられた例を示している。
[Second Embodiment]
Next, a second embodiment of the communication system of the present invention will be described with reference to FIGS.
FIG. 8 is an explanatory diagram schematically illustrating a communication system according to the second embodiment. FIG. 9 is a flowchart schematically illustrating the flow of communication processing executed by the application program. FIG. 10 is a flowchart illustrating an API hook process when the communication port is open. FIG. 11A is a flowchart illustrating an API hook process when a transmission-related API is called, and FIG. 11B is a flowchart illustrating an API hook process when a reception-related API is called. is there. FIG. 12 is a flowchart illustrating an API hook process when the communication port is closed. FIG. 13A is an explanatory diagram for conceptually explaining correspondence data between each virtual handle and a regular handle. FIG. 13B shows a state in which a virtual handle is assigned to each application program in the computer. It is explanatory drawing which illustrates this conceptually. In FIG. 13, the handle Z is used as the regular handle of the communication port 14a (FIG. 2), the virtual handle Z-1 is assigned to the application A as the virtual handle of the communication port 14a, and the virtual handle Z− is assigned to the application B. An example in which 2 is assigned is shown.

なお、第2実施形態に係る通信システム200で用いられるコンピュータ202は、ハードウェア構成については、第1実施形態で用いられるコンピュータ2と同一である。よって、コンピュータ202のハードウェア(CPU3、ROM4、RAM5、ハードディスクドライブ6、出力部7、入力部8、通信部9、バス11、通信インターフェース13、通信ポート14a〜14c等)については適宜図2を参照することとし、詳細な説明は省略する。   The computer 202 used in the communication system 200 according to the second embodiment has the same hardware configuration as the computer 2 used in the first embodiment. Therefore, the hardware of the computer 202 (CPU 3, ROM 4, RAM 5, hard disk drive 6, output unit 7, input unit 8, communication unit 9, bus 11, communication interface 13, communication ports 14a to 14c, etc.) is appropriately shown in FIG. The detailed description will be omitted.

(第2実施形態の通信システムの概要)
図8に示すように、本実施形態に係る通信システム200は、通信機器を接続可能な通信ポートと、メモリ(RAM等)とを備えたコンピュータ202によって構成されている。本実施形態でも、第1実施形態と同様の通信部9(図2)が設けられ、通信インターフェース13と、複数の通信ポート14a〜14cとを備えている。このコンピュータ202でも、各通信ポート14a〜14c(図2)が、シリアルコネクタやパラレルコネクタとして構成されており、RS232CケーブルやUSBケーブルなどの通信ケーブルを介して各種通信機器(例えば、他のコンピュータ、外部記憶装置、その他の情報処理装置等)が接続可能とされている。そして、各通信ポート14a〜14c(図2)を介してこれらの通信機器(外部装置)と通信を行うことができるようになっている。なお、図8では、外部装置の例として携帯端末300が示されている。
(Outline of Communication System of Second Embodiment)
As shown in FIG. 8, the communication system 200 according to the present embodiment includes a computer 202 that includes a communication port to which a communication device can be connected and a memory (RAM or the like). Also in this embodiment, the communication part 9 (FIG. 2) similar to 1st Embodiment is provided, and the communication interface 13 and several communication ports 14a-14c are provided. Also in this computer 202, each communication port 14a-14c (FIG. 2) is comprised as a serial connector or a parallel connector, and various communication apparatuses (for example, other computers, etc.) via communication cables, such as RS232C cable and USB cable, are comprised. An external storage device, other information processing device, etc.) can be connected. And it can communicate with these communication apparatuses (external device) via each communication port 14a-14c (FIG. 2). In FIG. 8, a portable terminal 300 is shown as an example of an external device.

図8に示すように、コンピュータ202の内部には、複数のアプリケーションプログラム(以下、アプリケーションとも称する)やオペレーティングシステム(以下、OSとも称する)220が格納されており、コンピュータ202は、OS220の制御の下、これらアプリケーションプログラムを実行することで、各種処理を行っている。なお、図8では、コンピュータ202で用いられる一部のアプリケーションプログラムA、B(図8では、アプリケーションA、Bと略称)を例示しており、これら以外のアプリケーションプログラムについては図示を省略している。   As shown in FIG. 8, a plurality of application programs (hereinafter also referred to as applications) and an operating system (hereinafter also referred to as OS) 220 are stored inside the computer 202, and the computer 202 controls the OS 220. Below, various processes are performed by executing these application programs. FIG. 8 illustrates some application programs A and B (abbreviated as applications A and B in FIG. 8) used in the computer 202, and illustration of other application programs is omitted. .

コンピュータ202で用いられるOS220としては、例えば、Unix(登録商標)、Linux、マイクロソフト社のWindows(登録商標)、その他の任意のOSなどが挙げられる。なお、以下では、Windows(登録商標)のNT系のOSが採用され、マイクロカーネル技術とオブジェクト指向技術をベースとし、各サービスを、サブシステムによって実装した構成を代表例として説明する。   Examples of the OS 220 used in the computer 202 include Unix (registered trademark), Linux, Windows (registered trademark) of Microsoft Corporation, and any other OS. In the following, a configuration in which a Windows (registered trademark) NT-based OS is employed, and each service is implemented by a subsystem based on a microkernel technology and an object-oriented technology will be described as a representative example.

OS220では、サブシステムが各アプリケーションプログラムA、B等に対して、各種のAPI(関数)を提供し、例えば、メモリ管理、プロセス管理、グラフィックス描画などを行うようになっている。このサブシステムでは、アプリケーションプログラムA、Bから、例えば、入出力関係のAPI関数が呼び出されると、そのAPI関数に応じた入出力要求を、IOマネージャ(図示略)に出力する。また、OS220には、各種デバイスドライバが組み込まれるようになっており、図8では、ハードウェア(携帯端末に接続された通信ケーブル)が接続され、このハードウェアのデバイスドライバがロードされたときの構成を概念的に示している。   In the OS 220, the subsystem provides various APIs (functions) to the application programs A and B, and performs, for example, memory management, process management, graphics drawing, and the like. In this subsystem, when an API function related to input / output is called from the application programs A and B, for example, an input / output request corresponding to the API function is output to an IO manager (not shown). Various device drivers are incorporated in the OS 220. In FIG. 8, when hardware (communication cable connected to a portable terminal) is connected and the device driver of this hardware is loaded. The structure is shown conceptually.

(第2実施形態の特徴的構成)
次に、本実施形態に係る通信システム200の特徴的構成について説明する。
まず、アプリケーションプログラムによる通信処理について説明する。各アプリケーションプログラムは、所定の通信開始条件の成立(例えば、ユーザによる所定操作等)に応じて図9のような通信処理を実行するようになっており、この通信処理では、まず、通信ポートのオープン処理が行われる(S1)。このS1では、アプリケーションプログラムが通信ポートをオープンするためのAPI関数を呼び出す処理が行われる。例えば、Windows(登録商標)で用いられるAPI関数では、「CreateFile」関数が使用されており、S1では、この、「CreateFile」関数が、通信に使用する通信ポート対応付けられて呼び出される。
(Characteristic configuration of the second embodiment)
Next, a characteristic configuration of the communication system 200 according to the present embodiment will be described.
First, communication processing by an application program will be described. Each application program executes a communication process as shown in FIG. 9 in response to the establishment of a predetermined communication start condition (for example, a predetermined operation by the user). In this communication process, first, the communication port Open processing is performed (S1). In S1, processing for calling an API function for the application program to open the communication port is performed. For example, an API function used in Windows (registered trademark) uses a “CreateFile” function. In S1, this “CreateFile” function is called in association with a communication port used for communication.

本実施形態では、アプリケーションプログラムから通信ポートをオープンするAPI関数(例えば、「CreateFile」関数)が呼び出されたとき、このAPI関数をそのままサブシステムによって実行するのではなく、図10のように、API関数をフックする処理を行っている。図10の処理は、アプリケーションプログラムによって通信ポートをオープンするAPI関数が呼び出されたときに開始される処理であり、まず、S11にて、通信処理で用いようとする通信ポートの呼び出しが初回であるか否かを判断している。   In the present embodiment, when an API function (for example, “CreateFile” function) for opening a communication port is called from an application program, the API function is not executed by the subsystem as it is, but as shown in FIG. Processing to hook the function is performed. The process of FIG. 10 is a process started when an API function for opening a communication port is called by an application program. First, in S11, the communication port to be used in the communication process is called for the first time. Judgment whether or not.

本実施形態では、各通信ポート毎に、アプリケーションプログラムによる「呼び出し回数」をカウントしている。この「呼び出し回数」は、各通信ポートにおける通信処理継続中(通信ポートのオープン継続中)のアプリケーション数を示す値であり、例えば、通信ポート14a(COM1)を例に挙げると、各アプリケーションプログラムが当該通信ポート14aのオープンを要求する毎に(即ち、通信ポート14aについて図10の処理が行われる毎に)当該通信ポート14aの「呼び出し回数」がインクリメントされるようになっている。また、各アプリケーションプログラムが当該通信ポート14aのクローズを要求する毎に(即ち、通信ポート14aについて図12の処理が行われる毎に)、当該通信ポート14aの「呼び出し回数」がデクリメントされるようになっている。   In the present embodiment, the “number of calls” by the application program is counted for each communication port. This “number of calls” is a value indicating the number of applications that are continuing communication processing (communication port is being opened) at each communication port. For example, when communication port 14a (COM1) is taken as an example, each application program Each time the opening of the communication port 14a is requested (that is, every time the processing of FIG. 10 is performed for the communication port 14a), the “number of calls” of the communication port 14a is incremented. Each time each application program requests the communication port 14a to be closed (that is, every time the processing of FIG. 12 is performed for the communication port 14a), the “number of calls” of the communication port 14a is decremented. It has become.

このように各通信ポートごとに呼び出し回数がカウントされることを前提とし、S11では、S1の処理によって指定された通信ポートの現在(S11の処理実行時)の呼び出し回数が「0」であるか否かを判断している。例えば、図9のS1の処理で、通信ポート14a(以下、COM1ともいう)を指定して、当該通信ポート14a(COM1)をオープンするAPI関数が呼び出された場合、このS1の処理に応じて実行されるS11の処理では、当該通信ポート14a(COM1)の「呼び出し回数」が現在「0」であるか否かを判断する。   Assuming that the number of calls is counted for each communication port in this way, in S11, is the current number of calls (when executing the process of S11) of the communication port designated by the process of S1 “0”? Judging whether or not. For example, when the API function for opening the communication port 14a (COM1) is called by specifying the communication port 14a (hereinafter, also referred to as COM1) in the process of S1 in FIG. In the process of S11 to be executed, it is determined whether or not the “number of calls” of the communication port 14a (COM1) is currently “0”.

S1で指定された通信ポートについての「呼び出し回数」がS11の処理時において「0」であり、今回の呼び出しが、当該通信ポートについての1回目の呼び出しとなるときには、S11でYesに進み、S1で呼び出されたAPI関数(例えば、「CreateFile」関数)をOS220にて実行し、S1で指定された通信ポートをオープンする(S12)。このオープン処理では、S1で指定された通信ポートのハンドル(正規ハンドル)が公知の方法で取得され、その取得されたハンドル(正規ハンドル)がRAM等のメモリに保存される(S13)。   When the “number of calls” for the communication port specified in S1 is “0” in the processing of S11, and this call is the first call for the communication port, the process proceeds to Yes in S11, and S1 The API function (for example, the “CreateFile” function) called in (2) is executed by the OS 220, and the communication port specified in S1 is opened (S12). In this open process, the handle (regular handle) of the communication port designated in S1 is acquired by a known method, and the acquired handle (regular handle) is stored in a memory such as a RAM (S13).

なお、この「正規ハンドル」は、API関数によって通信ポートを介して通信を行う際に実際に当該通信ポートでの通信に用いる公知のハンドルであり、当該通信ポートのオープン中は当該通信ポートに対して1つのみ設定されるようになっている。一方、後述する「仮想ハンドル」は、当該通信ポートについて各アプリケーションプログラム毎に設定される仮想的なハンドルであり、アプリケーションプログラムが当該通信ポートについて「仮想ハンドル」を取得したとしても、最終的にはこの「仮想ハンドル」を対応する「正規ハンドル」に変換し、「正規ハンドル」を用いて当該通信ポートでの通信を行うようになっている。なお、通信の詳細については後述する。   The “regular handle” is a known handle that is actually used for communication at the communication port when communication is performed via the communication port by an API function. Only one is set. On the other hand, a “virtual handle” described later is a virtual handle that is set for each application program for the communication port. Even if the application program acquires a “virtual handle” for the communication port, the virtual handle This “virtual handle” is converted into a corresponding “regular handle”, and communication is performed at the communication port using the “regular handle”. Details of communication will be described later.

本実施形態では、図10の処理や、後述する図12の処理を実行するCPU3(図2)が、「呼び出し回数増減手段」の一例に相当し、各アプリケーションプログラムによる通信ポートの呼び出し回数をカウントすると共に、各アプリケーションプログラムによる当該通信ポートを用いた通信処理の終了毎に呼び出し回数を減じるように機能する。
また、S11(図10)の処理を実行するCPU3は、「判断手段」の一例に相当し、アプリケーションプログラムが通信ポートを呼び出したときに、上記「呼び出し回数増減手段」による呼び出し回数が所定値以下か否かを判断するように機能する。
更に、CPU3、メモリ(RAM5等)が、「ハンドル保存手段」の一例に相当し、上記「判断手段」によって通信ポートの呼び出し回数が所定値以下と判断された場合に、アプリケーションプログラムによって呼び出された当該通信ポートにて通信を行うためのハンドルを保存するように機能する。
In the present embodiment, the CPU 3 (FIG. 2) that executes the processing of FIG. 10 and the processing of FIG. 12 to be described later corresponds to an example of “calling number increasing / decreasing means”, and counts the number of calls of the communication port by each application program. At the same time, each application program functions to reduce the number of calls each time communication processing using the communication port is completed.
The CPU 3 executing the processing of S11 (FIG. 10) corresponds to an example of “determination means”, and when the application program calls the communication port, the number of calls by the “call number increase / decrease means” is equal to or less than a predetermined value. It functions to determine whether or not.
Further, the CPU 3 and the memory (RAM 5 or the like) correspond to an example of “handle storing means”, and are called by the application program when the above-mentioned “determining means” determines that the number of calls of the communication port is equal to or less than a predetermined value. It functions to store a handle for performing communication at the communication port.

一方、S11の判断処理において、S1で指定された通信ポートの最初の呼び出しでないと判断された場合(即ち、S1の処理によって指定された通信ポートの現在(S11の処理実行時)の呼び出し回数が「1」以上である場合)、S11にてNoに進み、そのアプリケーションプログラムに割り当てるべき仮想ハンドルを生成する処理を行う(S14)。   On the other hand, in the determination process of S11, when it is determined that it is not the first call of the communication port specified in S1 (that is, the current call count of the communication port specified in the process of S1 (when the process of S11 is executed) If it is “1” or more), the process proceeds to No in S11, and a process of generating a virtual handle to be allocated to the application program is performed (S14).

従来では、通信ポートが既に先のアプリケーションプログラムによって呼び出されてオープンされている場合、後からアクセスする他のアプリケーションプログラムによる当該通信ポートの使用が禁止され、他のアプリケーションプログラムは当該通信ポートのハンドルを使用できないという問題があった。しかし、本実施形態では、既に先のアプリケーションプログラムによって通信ポートがオープンされている場合であっても、他のアプリケーションプログラムによる当該通信ポートのオープン処理を排除せず、他のアプリケーションプログラムに対して仮想的なハンドルを割り当てることができるようになっている。   Conventionally, when a communication port has already been called and opened by a previous application program, use of the communication port by other application programs accessed later is prohibited, and the other application program handles the handle of the communication port. There was a problem that it could not be used. However, in the present embodiment, even when the communication port is already opened by the previous application program, the open processing of the communication port by another application program is not excluded, and the virtual port is not applied to the other application program. A special handle can be assigned.

また、S11でYesに進む場合も同様であり、S13でハンドル(正規ハンドル)を保存した後、S1の処理を行ったアプリケーションプログラム(この場合、通信ポートの最初の呼び出しを行ったアプリケーションプログラム)に割り当てるべき仮想ハンドルを生成する処理を行う(S14)。   The same applies to the case where the process proceeds to Yes in S11. After the handle (regular handle) is stored in S13, the application program that performed the process of S1 (in this case, the application program that made the first call to the communication port) is stored. A process of generating a virtual handle to be allocated is performed (S14).

このように、本実施形態では、通信ポートを最初に呼び出したアプリケーションプログラムにも、その後に通信ポートを呼び出したアプリケーションプログラムにも仮想ハンドルが設定されることとなる。
なお、本実施形態では、S14(図10)の処理を実行するCPU3が「仮想ハンドル設定手段」の一例に相当し、各アプリケーションプログラムが通信ポートを呼び出したときに、各アプリケーションプログラムに対し、上記「ハンドル保存手段」によって保存されたハンドル(正規ハンドル)に対応した仮想ハンドルを設定するように機能する。
As described above, in this embodiment, the virtual handle is set in both the application program that first calls the communication port and the application program that calls the communication port after that.
In the present embodiment, the CPU 3 that executes the process of S14 (FIG. 10) corresponds to an example of a “virtual handle setting unit”. When each application program calls a communication port, It functions to set a virtual handle corresponding to the handle (regular handle) stored by the “handle storing means”.

そして、S14で生成された仮想ハンドルと、S13で保存されたハンドル(正規ハンドル)との対応関係を示すデータ(対応データ)を保存する(S15)。図13(a)では、S15で生成、保存される対応データの一例を示しており、例えば、通信ポート14a(COM1)の最初の呼び出しの際にS13にてハンドルZ(正規ハンドル)が生成、保存され、この通信ポート14a(COM1)の最初の呼び出しを行ったアプリケーションプログラムに対してS14にて仮想ハンドルZ−1が生成された場合、図13(a)のように、仮想ハンドルZ−1と正規のハンドルZとを対応付けたデータを生成、保存する。このようにすることで、最初の呼び出しを行ったアプリケーションプログラムに対して仮想ハンドルZ−1を割り当てることができ、且つ、この仮想ハンドルZ−1に対応する正規ハンドル(ハンドルZ)を特定できるようになる。   Then, data (corresponding data) indicating the correspondence between the virtual handle generated in S14 and the handle (regular handle) stored in S13 is stored (S15). FIG. 13A shows an example of correspondence data generated and stored in S15. For example, a handle Z (regular handle) is generated in S13 when the communication port 14a (COM1) is first called. When the virtual handle Z-1 is generated in S14 for the application program that has been saved and made the first call to the communication port 14a (COM1), as shown in FIG. 13A, the virtual handle Z-1 Is generated and saved. By doing so, the virtual handle Z-1 can be assigned to the application program that has made the first call, and the regular handle (handle Z) corresponding to the virtual handle Z-1 can be specified. become.

二回目以降の呼び出しでも同様であり、上記先のアプリケーションプログラムによる通信ポート14aのオープン中に、この通信ポート14a(COM1)に対して他のアプリケーションプログラムが呼び出し(二回目の呼び出し)を行った場合、S15の処理では、S11でNoに進んでS14で生成される仮想ハンドルZ−2(図13(a))と、当該通信ポート14aについて先のS13の処理で既に生成されている正規のハンドルZとを対応付けたデータを生成、保存する。このようにすることで、二回目の呼び出しを行ったアプリケーションプログラムに仮想ハンドルZ−2を割り当てることができ、この仮想ハンドルZ−2に対応する正規ハンドル(ハンドルZ)を特定できるようになる。   The same applies to the second and subsequent calls. When the communication port 14a is opened by the previous application program, another application program calls (second call) the communication port 14a (COM1). In the process of S15, the process proceeds to No in S11 and the virtual handle Z-2 (FIG. 13A) generated in S14 and the regular handle already generated in the process of S13 for the communication port 14a. Data associated with Z is generated and stored. By doing so, the virtual handle Z-2 can be assigned to the application program that has made the second call, and the regular handle (handle Z) corresponding to the virtual handle Z-2 can be specified.

なお、本実施形態では、S15の処理を実行するCPU3及びメモリ(RAM5等)が「対応データ保存手段」の一例に相当し、上記「ハンドル保存手段」によって保存されるハンドルと、「仮想ハンドル設定手段」によって各アプリケーションプログラムに設定される各仮想ハンドルとの対応データを保存するように機能する。   In the present embodiment, the CPU 3 and the memory (such as the RAM 5) that execute the processing of S15 correspond to an example of “corresponding data storage unit”. The handle stored by the “handle storage unit” and the “virtual handle setting” It functions to store data corresponding to each virtual handle set in each application program by means.

S15の処理の後には、呼び出し回数を更新する処理を行う(S16)。この処理では、当該APIフック処理で着目している通信ポート(即ち、S1で指定された通信ポート)についてのそれまでの「呼び出し回数」に「1」を加え、その値を当該通信ポートの新たな「呼び出し回数」として記憶する。例えば、通信ポート14a(COM1)のオープンを要求するAPI関数に基づいて図10のAPIフック処理を行っており、当該APIフック処理の開始時点で通信ポート14aの「呼び出し回数」が「0」の場合には、S16の処理では、新たな「呼び出し回数」としてカウントアップされた「1」が記憶される。   After the process of S15, a process of updating the number of calls is performed (S16). In this processing, “1” is added to the “number of calls” for the communication port focused on in the API hook processing (that is, the communication port specified in S1), and the value is added to the new communication port. This is stored as the “number of calls”. For example, the API hook processing of FIG. 10 is performed based on an API function that requests opening of the communication port 14a (COM1), and the “number of calls” of the communication port 14a is “0” at the start of the API hook processing. In this case, “1” counted up as a new “number of calls” is stored in the processing of S16.

S16の後には、S1でオープン要求を行ったアプリケーションプログラムに対してS14で得られた仮想ハンドルを返す処理を行う(S17)。このような処理を行うことで、S1で通信ポートのオープン要求を行ったアプリケーションプログラムが、S1で指定された当該通信ポート用の仮想ハンドルを取得することができ、このアプリケーションプログラムが当該通信ポートで通信する際の固有の仮想ハンドルとしてメモリに記憶しておくことができる。   After S16, a process of returning the virtual handle obtained in S14 is performed for the application program that made the open request in S1 (S17). By performing such processing, the application program that made the communication port open request in S1 can acquire the virtual handle for the communication port specified in S1, and this application program is connected to the communication port. It can be stored in memory as a unique virtual handle for communication.

なお、図13(b)では、上記のようなオープン要求に対するAPIフック処理が、アプリケーションA,Bそれぞれに対して実行された場合を例示している。図13(b)の例では、アプリケーションAが先に図9の処理を行ってS1にて通信ポート14a(COM1)をオープンするAPI要求を行い、図10のAPIフック処理によってこのアプリケーションAに対し仮想ハンドルZ−1が割り当てられている。そして、そのアプリケーションAによるオープン中に、アプリケーションBが図9の処理を行ってS1にて通信ポート14a(COM1)をオープンするAPI要求を行い、図10のAPIフック処理によってこのアプリケーションBに対して仮想ハンドルZ−1が割り当てられている。このように、通信ポート14aを同時期にオープンしているアプリケーションA,Bのいずれもが、自身に割り当てられている仮想ハンドルを把握できるようになっており、更に、APIフックプログラム側では、図13(a)の対応データに基づいて各仮想ハンドルに対応する正規ハンドルを特定できるようになっている。   FIG. 13B illustrates a case where the API hook processing for the open request as described above is executed for each of the applications A and B. In the example of FIG. 13B, the application A first performs the processing of FIG. 9 and makes an API request for opening the communication port 14a (COM1) in S1, and the API A hook processing of FIG. A virtual handle Z-1 is assigned. Then, while the application A is open, the application B performs the process of FIG. 9 and makes an API request for opening the communication port 14a (COM1) in S1, and the API hook process of FIG. A virtual handle Z-1 is assigned. In this way, both applications A and B that open the communication port 14a at the same time can grasp the virtual handle assigned to them, and the API hook program side further A regular handle corresponding to each virtual handle can be specified based on the correspondence data of 13 (a).

次に、図9のS2の通信処理について説明する。
上述したように、S1での通信ポートのオープン要求に応じ、図10のAPIフックプログラムによって当該通信ポートに対応する仮想ハンドルが割り当てられた後には、図9の処理を実行するアプリケーションプログラムによって当該通信ポートを使用した通信処理が行われる(S2)。この通信処理では、図9の処理を実行するアプリケーションプログラムによって通信関連のAPI関数を呼び出す処理が行われる。例えば、Windows(登録商標)で用いられるAPI関数では、通信ポートからデータを送信するAPI関数として、「WriteFile」関数を用いており、S1でオープンした通信ポートからデータ送信を行うときには、S2ではこの「WriteFile」関数が呼び出される。また、この「WriteFile」関数の呼び出しの際には、S1でオープン要求された通信ポートと対応付けられた仮想ハンドル(S1のオープン要求に対してS17で返された仮想ハンドル)が指定される。例えば、図13(b)のようなアプリケーションAが上述の通信ポート14a(COM1)を使用してデータ送信を行う場合、通信ポート14a用に設定されたアプリケーションA固有の仮想ハンドルZ−1と、アプリケーションAが送信しようとするデータ(送信データ)などを対応付けて「WriteFile」関数を呼び出す。
Next, the communication process of S2 in FIG. 9 will be described.
As described above, after the virtual handle corresponding to the communication port is allocated by the API hook program of FIG. 10 in response to the communication port open request in S1, the communication is performed by the application program that executes the processing of FIG. Communication processing using the port is performed (S2). In this communication process, a process of calling a communication-related API function is performed by an application program that executes the process of FIG. For example, in the API function used in Windows (registered trademark), the “WriteFile” function is used as the API function for transmitting data from the communication port. When data is transmitted from the communication port opened in S1, this is performed in S2. The “WriteFile” function is called. When the “WriteFile” function is called, the virtual handle associated with the communication port requested to open in S1 (the virtual handle returned in S17 in response to the S1 open request) is specified. For example, when the application A as shown in FIG. 13B performs data transmission using the communication port 14a (COM1) described above, the virtual handle Z-1 unique to the application A set for the communication port 14a, The application A calls the “WriteFile” function in association with data (transmission data) to be transmitted.

本実施形態では、S2にて通信ポートでの送信に関連する所定のAPI関数(上記例では、「WriteFile」関数)が呼び出されたときに、図11(a)のようなAPIフック処理が行われるようになっている。この処理では、呼び出された送信関連API関数(例えば、「WriteFile」関数)の具体的内容を確認し(S21)、仮想ハンドルを利用した送信が指示されているか否かを判断する(S22)。具体的には、S2で呼び出された送信関連API関数(例えば「WriteFile」関数)と対応付けられて仮想ハンドルが指定されているか否かをS21にて確認し、仮想ハンドルが指定されていない場合には、S22にてNoに進み、API関数で指示された他の処理(例えば、ファイルへの書き込みなど)を行う(S23)。   In this embodiment, when a predetermined API function related to transmission at the communication port is called in S2 (in the above example, the “WriteFile” function), an API hook process as shown in FIG. It has come to be. In this process, the specific contents of the called transmission-related API function (for example, “WriteFile” function) are confirmed (S21), and it is determined whether or not transmission using a virtual handle is instructed (S22). Specifically, in S21, it is confirmed whether or not a virtual handle is specified in association with the transmission-related API function (for example, “WriteFile” function) called in S2, and the virtual handle is not specified. In step S22, the process proceeds to No, and other processing (for example, writing to a file) designated by the API function is performed (S23).

一方、S2で呼び出された送信関連API関数に対応して仮想ハンドルが指定されている場合には、S22にてYesに進み、その指定された仮想ハンドルに対応する正規ハンドルを用いて送信処理を行う。この送信処理では、まず、当該送信処理に先立ってS15(図10)で保存されている対応データ(例えば図13(a))を参照し、S2で指定された仮想ハンドルに対応する正規ハンドルを読み出している。そして、読み出された正規ハンドルをS2で指定された仮想ハンドルに代えて用い、S2(図9)で呼び出された送信関連API関数を実行する。これにより、S2の処理を実行するアプリケーションプログラムが、正規ハンドルを用いて送信関連API関数(例えば「WriteFile」関数)を実行できるようになり、S1で指定された通信ポートから外部装置(携帯端末300等)にデータ送信を行うことができる。   On the other hand, if a virtual handle is specified corresponding to the transmission-related API function called in S2, the process proceeds to Yes in S22, and transmission processing is performed using a regular handle corresponding to the specified virtual handle. Do. In this transmission process, first, with reference to the corresponding data (eg, FIG. 13A) stored in S15 (FIG. 10) prior to the transmission process, a normal handle corresponding to the virtual handle specified in S2 is obtained. Reading out. Then, the read normal handle is used in place of the virtual handle specified in S2, and the transmission related API function called in S2 (FIG. 9) is executed. As a result, the application program that executes the process of S2 can execute the transmission-related API function (for example, “WriteFile” function) using the regular handle, and the external device (the portable terminal 300) from the communication port specified in S1. Etc.) can be transmitted.

この構成では、例えば、携帯端末300(外部装置)が、二次元コード等の情報コードを読み取り可能な携帯型のコードリーダとして構成される場合、或いは、携帯端末300が、RFIDタグなどを読み取り可能な無線タグリーダとして構成される場合などにおいて、当該携帯端末300の複数のプログラムとコンピュータ2とが同一の通信ポートを使用して同時期に通信を行うことができるようになる。   In this configuration, for example, when the portable terminal 300 (external device) is configured as a portable code reader capable of reading an information code such as a two-dimensional code, or the portable terminal 300 can read an RFID tag or the like. When configured as a simple wireless tag reader, a plurality of programs of the portable terminal 300 and the computer 2 can communicate at the same time using the same communication port.

例えば、図8のように、コンピュータ2のアプリケーションA(一のアプリケーションプログラム)が通信ポート14a(COM1)を用いて携帯端末300のアプリケーションプログラム(一のプログラム)と通信を行う際に、図13(a)のような対応データに従い、図13(b)のようにアプリケーションAに設定された仮想ハンドルZ−1に対応するハンドルZ(正規ハンドル)を使用してAPI通信を行うことができる。また、このようにアプリケーションA(一のアプリケーションプログラム)による通信ポート14a(COM1)を用いた通信処理の継続中(アプリケーションAによる通信ポート14aのオープン中)に、アプリケーションB(他のアプリケーションプログラム)が当該通信ポート14a(COM1)を用いて携帯端末300のサービスプログラム(他のプログラム)と通信を行う場合、アプリケーションBに設定された仮想ハンドルZ−2と対応データ(図13(a))とに基づき、当該通信ポート14aに対応するハンドルZ(正規ハンドル)を使用して通信を行うことができる。   For example, as shown in FIG. 8, when the application A (one application program) of the computer 2 communicates with the application program (one program) of the mobile terminal 300 using the communication port 14a (COM1), as shown in FIG. According to the correspondence data as in a), API communication can be performed using the handle Z (regular handle) corresponding to the virtual handle Z-1 set in the application A as shown in FIG. 13B. In addition, while the communication process using the communication port 14a (COM1) by the application A (one application program) is being continued (the communication port 14a is being opened by the application A), the application B (another application program) is When communicating with the service program (other program) of the portable terminal 300 using the communication port 14a (COM1), the virtual handle Z-2 set in the application B and the corresponding data (FIG. 13 (a)) Based on this, communication can be performed using the handle Z (regular handle) corresponding to the communication port 14a.

なお、このような構成において、アプリケーションAから携帯端末300の所定のアプリケーションプログラムに対し、図9、図11(a)のような送信処理を行う場合、図9のS2で呼び出される送信関連API関数(例えば、「WriteFile」関数)と対応付けられた送信データ内に、例えば、携帯端末300の所定のアプリケーションプログラムを特定する宛先データを含ませておけばよい。同様に、アプリケーションBから携帯端末300の所定のサービスプログラムに対し、図9、図11(a)のような送信処理を行う場合、図9のS2で呼び出される送信関連API関数(例えば、「WriteFile」関数)と対応付けられた送信データ内に、例えば、携帯端末300の所定のサービスプログラムを特定する宛先データを含ませておけばよい。そして、携帯端末300のドライバが、このような送信データから宛先データを読み取り、送信データを宛先データに応じたプログラムに振り分けるようにすればよい。   In such a configuration, when the transmission process as shown in FIGS. 9 and 11A is performed from the application A to the predetermined application program of the mobile terminal 300, the transmission related API function called in S2 of FIG. For example, destination data for specifying a predetermined application program of the mobile terminal 300 may be included in the transmission data associated with (for example, the “WriteFile” function). Similarly, when the transmission process as shown in FIGS. 9 and 11A is performed from the application B to the predetermined service program of the portable terminal 300, the transmission related API function (for example, “WriteFile” is called in S2 of FIG. For example, destination data for specifying a predetermined service program of the mobile terminal 300 may be included in the transmission data associated with the “function”. Then, the driver of the mobile terminal 300 may read the destination data from such transmission data and distribute the transmission data to a program corresponding to the destination data.

上記説明では、S2においてデータ送信が行われる例を示したが、S1でオープンされた通信ポートを利用したデータ受信も同様に行われる。以下、S2でデータ受信処理を行う場合について説明する。   In the above description, an example in which data transmission is performed in S2 is shown, but data reception using the communication port opened in S1 is performed in the same manner. Hereinafter, a case where the data reception process is performed in S2 will be described.

S2にてデータ受信処理を行う場合でも、アプリケーションプログラムによって通信関連のAPI関数を呼び出す処理が行われる。例えば、Windows(登録商標)で用いられるAPI関数では、通信ポートからデータを受信するAPI関数として、「ReadFile」関数を用いており、S1でオープンした通信ポートからデータ受信を行うときには、この、「ReadFile」関数が呼び出される。また、この、「ReadFile」関数を呼び出す際には、S1でオープンされた通信ポートと対応付けられた仮想ハンドル(S1のオープン要求に応じてS17で返された仮想ハンドル)が指定される。例えば、図13(b)のようなアプリケーションAが上述の通信ポート14a(COM1)を使用してデータ受信を行う場合、通信ポート14a用に設定されたアプリケーションA固有の仮想ハンドルZ−1と対応付けて「ReadFile」関数を呼び出す。   Even when data reception processing is performed in S2, processing for calling a communication-related API function is performed by the application program. For example, an API function used in Windows (registered trademark) uses a “ReadFile” function as an API function for receiving data from a communication port. When receiving data from a communication port opened in S1, this “ The “ReadFile” function is called. When calling the “ReadFile” function, the virtual handle associated with the communication port opened in S1 (the virtual handle returned in S17 in response to the open request in S1) is specified. For example, when the application A as shown in FIG. 13B receives data using the communication port 14a (COM1) described above, it corresponds to the virtual handle Z-1 unique to the application A set for the communication port 14a. Then call the “ReadFile” function.

本実施形態では、上記のように、通信ポートでの受信に関連する所定のAPI関数(例えば、ReadFile)関数)が呼び出されたときに、図11(b)のようなAPIフック処理が行われるようになっている。この処理では、呼び出された受信関連API関数(例えば、「ReadFile」関数)の具体的内容を確認し(S31)、仮想ハンドルを利用した受信が指示されているか否かを判断する(S32)。具体的には、S2で呼び出された受信関連API関数(例えば「ReadFile」関数)と対応付けられて仮想ハンドルが指定されているか否かをS31にて確認し、仮想ハンドルが指定されていない場合には、S32にてNoに進み、API関数で指示された他の処理(例えば、ファイルの読み取りなど)を行う。   In the present embodiment, as described above, when a predetermined API function related to reception at the communication port (for example, ReadFile) function is called, API hook processing as shown in FIG. 11B is performed. It is like that. In this process, the specific content of the called reception-related API function (for example, “ReadFile” function) is confirmed (S31), and it is determined whether or not reception using a virtual handle is instructed (S32). Specifically, in S31, it is confirmed whether or not a virtual handle is specified in association with the reception-related API function (for example, “ReadFile” function) called in S2, and the virtual handle is not specified. In step S32, the process proceeds to No and performs other processing (for example, reading of a file) designated by the API function.

一方、仮想ハンドルが指定されている場合には、S32にてYesに進み、仮想ハンドルに対応する正規ハンドルを用いて受信処理を行う(S34)。この処理では、まず、当該受信処理に先立ってS15(図10)で保存されている対応データ(図13(a))に基づき、S2(図9)で呼び出された受信関連API関数で指定される仮想ハンドルに対応する正規ハンドルを読み出している。そして、その読み出された正規ハンドルをS2で指定されていた仮想ハンドルに代えて用い、S2(図9)で呼び出された受信関連API関数を実行する。これにより、S2の処理を実行するアプリケーションプログラムが、正規ハンドルを用いて受信関連API関数(例えば「ReadFile」関数)を実行できるようになり、S1で指定された通信ポートを介して外部装置(携帯端末300等)からデータ受信を行うことができる。   On the other hand, if the virtual handle is designated, the process proceeds to Yes in S32, and the reception process is performed using the regular handle corresponding to the virtual handle (S34). In this process, first, it is designated by the reception related API function called in S2 (FIG. 9) based on the correspondence data (FIG. 13A) stored in S15 (FIG. 10) prior to the reception process. The regular handle corresponding to the virtual handle is read. Then, the read normal API function called in S2 (FIG. 9) is executed using the read regular handle in place of the virtual handle specified in S2. As a result, the application program that executes the process of S2 can execute the reception-related API function (for example, the “ReadFile” function) using the regular handle, and the external device (mobile phone) via the communication port specified in S1. Data can be received from the terminal 300 or the like.

なお、この場合、外部装置(例えば携帯端末300等)の各プログラムがコンピュータ2の各アプリケーションに送信する送信データ内に、当該送信データの送信先となるアプリケーションプログラムを示す宛先データを含ませるようにすればよい。そして、コンピュータ2側では、上記受信処理(S2:図9)によって受信を行おうとするアプリケーションプログラムが、当該アプリケーションプログラムを指定する宛先データを含んだデータのみを有効なものとして読み込むようにすれば、同一の通信ポートから受信する各アプリケーソンプログラム宛の各受信データを、各アプリケーションプログラムに適切に振り分けることができるようになる。   In this case, destination data indicating an application program that is a transmission destination of the transmission data is included in transmission data transmitted from each program of the external device (for example, the mobile terminal 300) to each application of the computer 2. do it. Then, on the computer 2 side, if the application program to be received by the reception process (S2: FIG. 9) reads only data including destination data specifying the application program as valid, Each reception data addressed to each application program received from the same communication port can be appropriately distributed to each application program.

なお、本実施形態では、S22或いはS32の処理を実行するCPU3(図3)が「仮想ハンドル利用確認手段」の一例に相当し、アプリケーションプログラムが特定の通信関連コマンドを実行したときに、仮想ハンドルを用いた通信を行うか否かを確認するように機能する。
また、S24、S34の処理を実行するCPU3は、「通信制御手段」の一例に相当し、各アプリケーションプログラムが通信ポートを用いて通信を行う際に、「対応データ保存手段」に保存された対応データに従い、各アプリケーションプログラムに設定された仮想ハンドルと対応付けられたハンドル(正規ハンドル)を使用するように機能すると共に、上記「仮想ハンドル利用確認手段」によって仮想ハンドルを用いた通信であることが確認された場合に、アプリケーションプログラムに設定された仮想ハンドルと対応付けられたハンドル(正規ハンドル)を使用するように機能している。
In this embodiment, the CPU 3 (FIG. 3) that executes the processing of S22 or S32 corresponds to an example of “virtual handle use confirmation unit”, and the virtual handle is executed when the application program executes a specific communication-related command. It functions to confirm whether or not to perform communication using.
The CPU 3 that executes the processes of S24 and S34 corresponds to an example of a “communication control unit”. When each application program communicates using a communication port, the correspondence stored in the “corresponding data storage unit”. According to the data, it functions to use a handle (regular handle) associated with a virtual handle set in each application program, and communication using a virtual handle is performed by the “virtual handle use confirmation unit”. When it is confirmed, it functions to use a handle (regular handle) associated with a virtual handle set in the application program.

次に、図9のS3の通信ポートクローズ処理について説明する。
図9の処理を実行するアプリケーションプログラムは、S2の通信処理が終了した後に、S1でオープンした通信ポートをクローズする処理を行っている(S3)。このS3では、アプリケーションプログラムが通信ポートをクローズするためのAPI関数を呼び出す処理が行われる。例えば、Windows(登録商標)で用いられるAPI関数では、「CloseHandle」関数が使用されており、S3では、この、「CloseHandle」関数が、クローズしようとする通信ポート(S1でオープンされた通信ポート)の仮想ハンドル(S1のオープン要求に応じてS17で返された仮想ハンドル)と対応付けて呼び出される。
Next, the communication port closing process in S3 of FIG. 9 will be described.
The application program that executes the process of FIG. 9 performs a process of closing the communication port opened in S1 after the communication process of S2 is completed (S3). In S3, processing for calling an API function for the application program to close the communication port is performed. For example, in the API function used in Windows (registered trademark), the “CloseHandle” function is used. In S3, the “CloseHandle” function is the communication port to be closed (the communication port opened in S1). And the virtual handle (virtual handle returned in S17 in response to the open request in S1).

本実施形態では、アプリケーションプログラムから通信ポートをオープンするAPI関数(例えば、「CloseHandle」関数)が呼び出されたとき、図12のように、API関数をフックする処理を行っている。図12の処理は、アプリケーションプログラムによって通信ポートをクローズするAPI関数(例えば、「CloseHandle」関数)が呼び出されたときに開始される処理であり、まず、S3でのクローズ要求で指定された仮想ハンドルと正規ハンドルとの対応データを破棄している(S41)。この処理では、図13(a)のような対応データの中から、S3で指定された仮想ハンドルについてのデータを削除しており、例えば、図13(b)に示すアプリケーションAがS3(図9)において仮想ハンドルZ−1を指定してクローズ要求(クローズ関連API関数の呼び出し)をしているような場合には、図13(a)の対応データの中からこの仮想ハンドルZ−1と正規ハンドルZとを対応付けたデータを削除する。   In the present embodiment, when an API function (for example, “CloseHandle” function) for opening a communication port is called from an application program, processing for hooking the API function is performed as shown in FIG. The process of FIG. 12 is a process started when an API function (for example, “CloseHandle” function) that closes the communication port is called by the application program. First, the virtual handle specified by the close request in S3 And the correspondence data between the regular handle and the regular handle are discarded (S41). In this process, the data about the virtual handle specified in S3 is deleted from the corresponding data as shown in FIG. 13A. For example, application A shown in FIG. ) Designates the virtual handle Z-1 and makes a close request (calls a close-related API function), the virtual handle Z-1 and the normal handle are selected from the corresponding data in FIG. Data associated with the handle Z is deleted.

S41の処理の後には、着目している通信ポート(即ち、S3でクローズ要求がなさている通信ポート)の「呼び出し回数」をデクリメントする。例えば、アプリケーションAによる通信ポート14aのクローズ要求に応じて図12の処理がなされており、当該図12のAPIフック処理開始時点で通信ポート14aの「呼び出し回数」が「3」である場合、S42ではこの値をデクリメントして「呼び出し回数」を「2」に変更する。   After the process of S41, the “number of calls” of the communication port of interest (that is, the communication port for which a close request is made in S3) is decremented. For example, when the processing of FIG. 12 is performed in response to the request for closing the communication port 14a by the application A, and the “number of calls” of the communication port 14a is “3” at the time of starting the API hook processing of FIG. Then, this value is decremented and the “number of calls” is changed to “2”.

そして、S41で対応値を削除した仮想ポートが着目している通信ポート(即ち、S3でクローズ要求がなさている通信ポート)の最後の仮想ハンドルであるか否かを判断する(S43)。具体的には、S42の処理後において当該通信ポートの「呼び出し回数」が「0」となっているか否かを判断し、「0」でない場合、着目している当該通信ポートの呼び出しを行っているアプリケーションプログラムがまだ存在することを意味し、S41で対応値を削除した仮想ポートが当該通信ポートの最後の仮想ハンドルではないため、S43にてNoに進み、当該処理を終了する。   Then, it is determined whether or not the virtual port from which the corresponding value has been deleted in S41 is the last virtual handle of the focused communication port (that is, the communication port for which the close request is made in S3) (S43). Specifically, after the process of S42, it is determined whether or not the “number of calls” of the communication port is “0”. If it is not “0”, the communication port of interest is called. This means that there is still an application program, and since the virtual port from which the corresponding value is deleted in S41 is not the last virtual handle of the communication port, the process proceeds to No in S43, and the process ends.

一方、S42の処理後において当該通信ポートの「呼び出し回数」が「0」である場合、着目している当該通信ポートの呼び出しを行っているアプリケーションプログラムが存在せず、S41で対応値を削除した仮想ポートが当該通信ポートの最後の仮想ハンドルであるため、S43にてYesに進む。S43にてYesに進む場合には、当該通信ポートの正規ハンドルを指定してクローズ関連API(例えば、「CloseHandle」関数)を実行し、当該通信ポートの正規ハンドルを削除する(S44)。   On the other hand, when the “number of calls” of the communication port is “0” after the processing of S42, there is no application program calling the communication port of interest, and the corresponding value is deleted in S41. Since the virtual port is the last virtual handle of the communication port, the process proceeds to Yes in S43. When the process proceeds to Yes in S43, the normal handle of the communication port is designated and a close-related API (for example, “CloseHandle” function) is executed, and the normal handle of the communication port is deleted (S44).

本実施形態では、S41の処理を実行するCPU3が「対応値破棄手段」の一例に相当し、アプリケーションプログラムによる通信ポートを使用した通信処理が終了した場合に、上記「対応データ保存手段」によって保存された対応データにおいて、その通信処理が終了したアプリケーションプログラムについての仮想ハンドルとハンドル(正規ハンドル)との対応値を破棄するように機能する。   In the present embodiment, the CPU 3 that executes the process of S41 corresponds to an example of “corresponding value discarding means”, and when the communication process using the communication port by the application program ends, the above “corresponding data saving means” saves it. In the corresponding data, the function of destroying the correspondence value between the virtual handle and the handle (regular handle) for the application program for which the communication process has been completed.

(第2実施形態の主な効果)
第2実施形態に係る通信システム200では、「呼び出し回数増減手段」によってアプリケーションプログラムによる通信ポートの呼び出し回数を管理しており、アプリケーションプログラムが通信ポートを呼び出したときに、「呼び出し回数増減手段」によって管理される呼び出し回数が所定値以下か否かを判断している。そして、その通信ポートの呼び出し回数が所定値以下と判断された場合に、アプリケーションプログラムによって呼び出された当該通信ポートにて通信を行うためのハンドル(正規ハンドル)を保存している。
このようにすると、通信ポートに対するアプリケーションプログラムの呼び出しがどの程度重複しているかを確認できる。また、呼び出し回数が少ないときに、当該通信ポートで通信を行うためにハンドル(正規ハンドル)を予め保存しておくことができる。
更に、各アプリケーションプログラムが通信ポートを呼び出したときに、各アプリケーションプログラムに対し、上記「ハンドル保存手段」によって保存されたハンドルに対応した仮想ハンドルを設定し、この設定された仮想ハンドルと、既に保存されているハンドル(正規ハンドル)との対応データを保存している。そして、各アプリケーションプログラムが通信ポートを用いて通信を行う際に、保存された対応データに従い、各アプリケーションプログラムに設定された仮想ハンドルと対応付けられたハンドル(正規ハンドル)を使用している。
このようにすると、複数のアプリケーションプログラムが同じ通信ポートを呼び出した場合に、各アプリケーションプログラムに仮想ハンドルを割り当てることができ、各アプリケーションプログラムは対応データを拠り所として仮想ハンドルと対応する実際のハンドルを使用し、当該通信ポートでの通信を行うことができるようになる。従って、最初に通信ポートを呼び出したアプリケーションプログラムだけに当該通信ポートを占有させて他のアプリケーションプログラムによる当該通信ポートへのアクセスを排除するといった対応を行う必要がなく、複数のアプリケーションプログラムが同一の通信ポートを同時期に使用することができるようになる。
(Main effects of the second embodiment)
In the communication system 200 according to the second embodiment, the number of calls of the communication port by the application program is managed by the “calling number increasing / decreasing unit”, and when the application program calls the communication port, the “calling number increasing / decreasing unit” is used. It is determined whether the number of managed calls is equal to or less than a predetermined value. When it is determined that the number of calls of the communication port is equal to or less than a predetermined value, a handle (regular handle) for performing communication at the communication port called by the application program is stored.
In this way, it can be confirmed how much the calling of the application program to the communication port is duplicated. Further, when the number of calls is small, a handle (regular handle) can be stored in advance to perform communication at the communication port.
Further, when each application program calls the communication port, a virtual handle corresponding to the handle stored by the “handle storing means” is set for each application program, and the set virtual handle and the already stored virtual handle are stored. Data corresponding to the handle (regular handle) is stored. When each application program communicates using the communication port, a handle (regular handle) associated with the virtual handle set in each application program is used according to the stored correspondence data.
In this way, when multiple application programs call the same communication port, a virtual handle can be assigned to each application program, and each application program uses the actual handle corresponding to the virtual handle based on the corresponding data. Then, communication can be performed at the communication port. Therefore, there is no need to take measures such as occupying the communication port only to the application program that called the communication port first to eliminate access to the communication port by other application programs, and multiple application programs can share the same communication. The port can be used at the same time.

また、第2実施形態の通信システム200では、アプリケーションプログラムが特定の通信関連コマンドを実行したときに、仮想ハンドルを用いた通信を行うか否かを確認する「仮想ハンドル利用確認手段」を備え、この「仮想ハンドル利用確認手段」によって仮想ハンドルを用いた通信であることが確認された場合に、アプリケーションプログラムに設定された仮想ハンドルと対応付けられたハンドル(正規ハンドル)を使用している。
このようにすると、特定の通信関連コマンドが実行されたことをトリガとして仮想ハンドルを用いた通信を行うことができるようになる。その際、仮想ハンドルを用いた通信を行うか否かの確認を行った上で、通信処理に移行しているため、特定の通信関連コマンドで他の処理を実行する場合(即ち、仮想ハンドルを用いた通信を行わない例外ケース)にも対応しやすくなる。
The communication system 200 according to the second embodiment includes a “virtual handle use confirmation unit” that confirms whether or not to perform communication using a virtual handle when an application program executes a specific communication-related command. When it is confirmed by the “virtual handle use confirmation means” that the communication using the virtual handle is confirmed, the handle (regular handle) associated with the virtual handle set in the application program is used.
In this way, it becomes possible to perform communication using the virtual handle triggered by the execution of a specific communication-related command. At this time, after confirming whether or not to perform communication using the virtual handle, since the process has shifted to the communication process, when another process is executed with a specific communication-related command (that is, the virtual handle is Exception cases that do not use communication) can be handled easily.

また、第2実施形態の通信システム200では、アプリケーションプログラムによる通信ポートを使用した通信処理が終了した場合に、上記「対応データ保存手段」によって保存された対応データにおいて、その通信処理が終了したアプリケーションプログラムについての仮想ハンドルとハンドル(正規ハンドル)との対応値を破棄する「対応値破棄手段」を備えている。このようにすると、通信処理が終了して不要になった仮想ハンドルを削除することができ、対応データを常に適切な状態に維持できるようになる。   In the communication system 200 according to the second embodiment, when the communication process using the communication port by the application program is completed, the application whose communication process has been completed in the corresponding data stored by the “corresponding data storage unit”. A “corresponding value discarding unit” that discards the corresponding value between the virtual handle and the handle (regular handle) for the program is provided. In this way, it is possible to delete virtual handles that are no longer needed after the completion of communication processing, and it is possible to always maintain corresponding data in an appropriate state.

更に、第2実施形態の通信システム200では、外部装置が、コンピュータ2との間でデータの送信又は受信を行う複数のプログラムを備えた携帯端末300として構成されている。そして、コンピュータ2の複数のアプリケーションプログラムのうち、アプリケーションA(一のアプリケーションプログラム)が通信ポートを用いて携帯端末300のアプリケーションプログラム(一のプログラム)と通信を行う際に、上記「対応データ保存手段」に保存された対応データに従い、アプリケーションA(一のアプリケーションプログラム)に設定された仮想ハンドルZ−1に対応するハンドルZを使用している。また、アプリケーションA(一のアプリケーションプログラム)による通信ポートを用いた通信処理の継続中(アプリケーションAによる当該通信ポートのオープン中)に、アプリケーションB(他のアプリケーションプログラム)が当該通信ポートを用いて携帯端末300のサービスプログラム(他のプログラム)と通信を行う場合、アプリケーションB(他のアプリケーションプログラム)に設定された仮想ハンドルZ−2と対応データとに基づき、当該通信ポートに対応するハンドルZを使用している。
このようにすると、コンピュータ2に記憶されたいずれかのアプリケーションプログラムが通信ポートを介して携帯端末300のいずれかのプログラムと通信処理を行っている際に、コンピュータ2の他のアプリケーションプログラムが同じ通信ポートを用いて携帯端末300の他のプログラムと通信処理を行うことができるようになる。従って、通信ポートが制約されやすい携帯端末300との通信であっても、複数のアプリケーションプログラムが同一の通信ポートを使用して同時期に通信を行うことができるようになり、ひいては、コンピュータ2と携帯端末300との間で多様な処理が実現可能となる。
Furthermore, in the communication system 200 according to the second embodiment, the external device is configured as a mobile terminal 300 including a plurality of programs that transmit or receive data to and from the computer 2. When the application A (one application program) among the plurality of application programs of the computer 2 communicates with the application program (one program) of the portable terminal 300 using the communication port, the “corresponding data storage unit” The handle Z corresponding to the virtual handle Z-1 set in the application A (one application program) is used in accordance with the correspondence data stored in "." Further, while communication processing using the communication port by application A (one application program) is continuing (when the communication port is being opened by application A), application B (another application program) is carried by using the communication port. When communicating with the service program (other program) of the terminal 300, the handle Z corresponding to the communication port is used based on the virtual handle Z-2 set in the application B (other application program) and the corresponding data. is doing.
In this way, when any application program stored in the computer 2 performs communication processing with any program of the portable terminal 300 via the communication port, the other application programs of the computer 2 communicate with each other. Communication processing with other programs of the portable terminal 300 can be performed using the port. Accordingly, even with communication with the portable terminal 300 whose communication port is likely to be restricted, a plurality of application programs can communicate at the same time using the same communication port. Various processes can be realized with the mobile terminal 300.

[他の実施形態]
本発明は上記記述及び図面によって説明した実施形態に限定されるものではなく、例えば次のような実施形態も本発明の技術的範囲に含まれる。
[Other Embodiments]
The present invention is not limited to the embodiments described with reference to the above description and drawings. For example, the following embodiments are also included in the technical scope of the present invention.

第1実施形態では、アプリケーションプログラムAに割り当てられた通信ポート14a(第1の通信ポート)に何らかの通信機器が接続されている場合に「外部通信確認手段」を選択する構成としているが、通信ポート14aに特定種類の通信機器が接続されているか否かを検出し、特定種類の通信機器が検出された場合にのみ「外部通信確認手段」を選択する構成としてもよい。例えば、通信ポート14aにパーソナルコンピュータが接続されている場合のみ、或いは通信ポート14aに特定種類の携帯情報端末が接続されている場合のみ、S3(図4)にてYesに進みS5の処理を行うようにしてもよい。このようにすると、通信動作確認の対象となる特定種類の通信機器が接続されたとき以外で外部通信確認手段が選択されることがなく、より一層適切な選択が可能となる。   In the first embodiment, the “external communication confirmation unit” is selected when any communication device is connected to the communication port 14a (first communication port) assigned to the application program A. A configuration may be adopted in which it is detected whether or not a specific type of communication device is connected to 14a, and “external communication confirmation means” is selected only when a specific type of communication device is detected. For example, only when a personal computer is connected to the communication port 14a or only when a specific type of portable information terminal is connected to the communication port 14a, the process proceeds to Yes in S3 (FIG. 4) and performs the process of S5. You may do it. In this way, the external communication confirmation unit is not selected except when a specific type of communication device that is a target of communication operation confirmation is connected, and a more appropriate selection is possible.

第1実施形態の構成において、「仮想通信確認手段」に対して命令を与える上位プログラムからの設定変更命令に基づき、アプリケーションプログラムBに割り当てる第2の通信ポートを設定変更する「設定変更手段」を付加してもよい。例えば、S1(図4)でアプリケーションプログラムBに割り当てられた通信ポート14bを、上位プログラム(仮想ドライバの上位にあるいずれかのプログラム)からの設定変更命令に基づいて設定変更できるようにしてもよい。
このようにすると、アプリケーションプログラムBに割り当てる通信ポートを必要に応じて変更できる。なお、「設定変更命令」としては、ユーザによる指示に基づいてS1のような設定値取得処理を再度行わせる命令などが挙げられる。
また、このような構成において、「仮想送受信手段」による仮想的な送受信中(例えば、図6、図7の処理が行われている時)に上位プログラムから上記設定変更命令がなされた場合、当該仮想的な送受信が完了するまで、「設定変更手段」による第2の通信ポートの設定変更を中止するように構成できる。このようにすると、第2の通信ポートを必要に応じて設定変更できるようにしつつ、その設定変更によって仮想的な動作確認が強制的に中断されることを効果的に防止できる。
In the configuration of the first embodiment, a “setting change unit” that changes the setting of the second communication port to be assigned to the application program B based on a setting change command from a higher-level program that gives a command to the “virtual communication confirmation unit”. It may be added. For example, the communication port 14b assigned to the application program B in S1 (FIG. 4) may be configured to be changed based on a setting change command from a higher-level program (any program above the virtual driver). .
If it does in this way, the communication port allocated to the application program B can be changed as needed. Note that examples of the “setting change command” include a command that causes the setting value acquisition process like S1 to be performed again based on an instruction from the user.
Further, in such a configuration, when the above-described setting change instruction is issued from a higher-level program during virtual transmission / reception by the “virtual transmission / reception means” (for example, when the processing in FIGS. 6 and 7 is performed) Until the virtual transmission / reception is completed, the setting change of the second communication port by the “setting changing unit” can be stopped. In this way, it is possible to effectively prevent the virtual operation check from being forcibly interrupted due to the setting change while allowing the second communication port to be changed as necessary.

第1実施形態では、通信動作確認を行おうとするアプリケーションプログラムに割り当てられた通信ポートにハードウェアが接続されている場合に強制的にハードウェアのドライバをロードしていたが、このような場合、ユーザに対し、いずれを採用するか(即ち、ハードウェアを用いずに仮想的な通信動作確認を行うか、それともハードウェアを用いた外部通信動作確認を行うか)を確認し、ユーザの指示に応じた通信動作確認方法を用いるようにしてもよい。   In the first embodiment, the hardware driver is forcibly loaded when the hardware is connected to the communication port assigned to the application program to be checked for communication operation. In such a case, Confirm to the user which one to use (that is, whether to perform virtual communication operation confirmation without using hardware, or to perform external communication operation confirmation using hardware). A corresponding communication operation confirmation method may be used.

第1実施形態では、アプリケーションプログラムAからアプリケーションプログラムBに対しデータを送信して仮想的な動作確認を行う例を説明したが、データだけでなく制御信号を送信してもよい。例えば、アプリケーションプログラムAからの各制御信号をアプリケーションプログラムBの受信バッファにそれぞれ記憶するように構成し、その制御信号の変更状態をアプリケーションプログラムB側で検出できるようにしてもよい。   In the first embodiment, an example in which data is transmitted from the application program A to the application program B to perform virtual operation confirmation has been described. However, not only data but also a control signal may be transmitted. For example, each control signal from the application program A may be stored in the reception buffer of the application program B so that the change state of the control signal can be detected on the application program B side.

1…通信システム
2…コンピュータ
3…CPU(通信動作確認手段,仮想通信確認手段,外部通信確認手段,選択手段,通信ポート割当手段,仮想送受信手段,検出手段、設定変更手段、呼び出し回数増減手段、判断手段、ハンドル保存手段、仮想ハンドル設定手段、通信制御手段、仮想ハンドル利用確認手段、対応値破棄手段)
5…RAM(メモリ、ハンドル保存手段、対応データ保存手段)
14a,14b,14c…通信ポート
300…携帯端末(外部装置、通信機器)
DESCRIPTION OF SYMBOLS 1 ... Communication system 2 ... Computer 3 ... CPU (Communication operation confirmation means, virtual communication confirmation means, external communication confirmation means, selection means, communication port allocation means, virtual transmission / reception means, detection means, setting change means, call frequency increase / decrease means, Determination means, handle storage means, virtual handle setting means, communication control means, virtual handle use confirmation means, corresponding value discard means)
5 ... RAM (memory, handle storage means, corresponding data storage means)
14a, 14b, 14c ... communication port 300 ... portable terminal (external device, communication device)

Claims (10)

通信機器を接続可能な複数の通信ポートと、メモリとを備えたコンピュータを有し、
前記通信ポートを介して外部装置と通信を行う通信システムであって、
前記コンピュータは、
複数のアプリケーションプログラムと、
前記アプリケーションプログラムにて生成されるデータについての通信動作を確認する通信動作確認手段と、
を備え、
前記通信動作確認手段は、
前記複数のアプリケーションプログラムにおける、一のアプリケーションプログラムと他のアプリケーションプログラムとの通信を仮想的に試行することで前記データの通信動作を確認する仮想通信確認手段と、
前記通信ポートに前記通信機器が接続されている場合に、前記アプリケーションプログラムにて生成された前記データを、前記通信ポートを介して前記コンピュータの外部に送信することで、前記データの通信動作を確認する外部通信確認手段と、
前記データの通信動作を確認する手段として、前記仮想通信確認手段及び前記外部通信確認手段のいずれかを選択する選択手段と、
を有し、
前記仮想通信確認手段は、
前記一のアプリケーションプログラムに対し、複数の前記通信ポートにおける第1の通信ポートを割り当てると共に、前記他のアプリケーションプログラムに対して第2の通信ポートを割り当て、それら第1の通信ポート及び第2の通信ポートを特定するポート情報を前記メモリに記憶する通信ポート割当手段と、
前記ポート情報に基づいて前記第1の通信ポートと対応する前記第2の通信ポートを特定すると共に、前記一のアプリケーションプログラムから前記第1の通信ポートに送られるべき前記データを、前記第2の通信ポートが受信した前記データとして前記メモリに記憶し、且つ前記他のアプリケージョンプログラムに与える仮想送受信手段と、
を備え、
前記選択手段により当該仮想通信確認手段が選択された場合、前記仮想送受信手段により、前記一のアプリケーションプログラムから前記他のアプリケーションプログラムに対して前記データの仮想的な送受信を行い、その送受信結果に基づいて前記データの通信動作を確認することを特徴とする通信システム。
A computer having a plurality of communication ports to which communication devices can be connected and a memory;
A communication system for communicating with an external device via the communication port,
The computer
Multiple application programs,
Communication operation confirmation means for confirming communication operation for data generated by the application program;
With
The communication operation confirmation means includes
Virtual communication confirmation means for confirming the communication operation of the data by virtually trying communication between one application program and another application program in the plurality of application programs;
When the communication device is connected to the communication port, the data generated by the application program is transmitted to the outside of the computer via the communication port, thereby confirming the data communication operation. External communication confirmation means,
As means for confirming the data communication operation, selection means for selecting one of the virtual communication confirmation means and the external communication confirmation means,
Have
The virtual communication confirmation means
A first communication port in the plurality of communication ports is assigned to the one application program, and a second communication port is assigned to the other application program, and the first communication port and the second communication are assigned. Communication port assigning means for storing port information for specifying a port in the memory;
The second communication port corresponding to the first communication port is specified based on the port information, and the data to be sent from the one application program to the first communication port is the second communication port. Virtual transmission / reception means for storing in the memory as the data received by the communication port and giving to the other application program;
With
When the virtual communication confirmation unit is selected by the selection unit, the virtual transmission / reception unit performs virtual transmission / reception of the data from the one application program to the other application program, and based on the transmission / reception result. And confirming the communication operation of the data.
前記通信機器が前記通信ポートに接続されているか否かを検出する検出手段を備え、
前記選択手段は、前記検出手段により前記通信機器が検出されたことを条件として前記外部通信確認手段を選択することを特徴とする請求項1に記載の通信システム。
Detecting means for detecting whether or not the communication device is connected to the communication port;
The communication system according to claim 1, wherein the selection unit selects the external communication confirmation unit on condition that the communication device is detected by the detection unit.
前記検出手段は、前記通信ポートに特定種類の前記通信機器が接続されているか否かを検出し、
前記選択手段は、前記検出手段により前記特定種類の前記通信機器が検出された場合にのみ前記外部通信確認手段を選択することを特徴とする請求項2に記載の通信システム。
The detecting means detects whether or not the communication device of a specific type is connected to the communication port;
The communication system according to claim 2, wherein the selection unit selects the external communication confirmation unit only when the communication device of the specific type is detected by the detection unit.
前記検出手段は、前記通信ポート割当手段によって割り当てられた前記第1の通信ポートに前記通信機器が接続されているか否かを検出し、
前記選択手段は、前記第1の通信ポートに前記通信機器が接続されている場合に前記外部通信確認手段を選択することを特徴とする請求項2又は請求項3に記載の通信システム。
The detecting means detects whether or not the communication device is connected to the first communication port assigned by the communication port assigning means;
4. The communication system according to claim 2, wherein the selection unit selects the external communication confirmation unit when the communication device is connected to the first communication port.
前記通信ポート割当手段は、
前記仮想通信確認手段に対して命令を与える上位プログラムからの設定変更命令に基づき、前記他のアプリケーションプログラムに割り当てる前記第2の通信ポートを設定変更する設定変更手段を備え、
前記仮想送受信手段による前記仮想的な送受信中に前記設定変更命令がなされた場合、当該仮想的な送受信が完了するまで、前記設定変更手段による前記第2の通信ポートの設定変更を中止することを特徴とする請求項1から請求項4のいずれか一項に記載の通信システム。
The communication port assigning means includes
Setting changing means for changing the setting of the second communication port to be assigned to the other application program based on a setting changing instruction from a higher-level program that gives an instruction to the virtual communication confirmation means;
If the setting change instruction is made during the virtual transmission / reception by the virtual transmission / reception means, the setting change of the second communication port by the setting change means is stopped until the virtual transmission / reception is completed. The communication system according to any one of claims 1 to 4, wherein the communication system is characterized.
前記通信ポート割当手段は、前記一のアプリケーションプログラムに割り当てる前記第1の通信ポートと、前記他のアプリケーションプログラムに割り当てる前記第2の通信ポートとを互いに異なる前記通信ポートとすることを特徴とする請求項1から請求項5のいずれか一項に記載の通信システム。   The communication port allocating means sets the first communication port allocated to the one application program and the second communication port allocated to the other application program as the different communication ports. The communication system according to any one of claims 1 to 5. 通信機器を接続可能な通信ポートと、メモリとを備えたコンピュータを有し、
前記通信ポートを介して外部装置と通信を行う通信システムであって、
前記コンピュータは、
複数のアプリケーションプログラムと、
各アプリケーションプログラムによる前記通信ポートの呼び出し回数をカウントすると共に、前記各アプリケーションプログラムによる当該通信ポートを用いた通信処理の終了毎に前記呼び出し回数を減じる呼び出し回数増減手段と、
前記アプリケーションプログラムが前記通信ポートを呼び出したときに、前記呼び出し回数増減手段による前記呼び出し回数が所定値以下か否かを判断する判断手段と、
前記判断手段によって前記通信ポートの前記呼び出し回数が前記所定値以下と判断された場合に、前記アプリケーションプログラムによって呼び出された当該通信ポートにて通信を行うためのハンドルを保存するハンドル保存手段と、
前記各アプリケーションプログラムが前記通信ポートを呼び出したときに、前記各アプリケーションプログラムに対し、前記ハンドル保存手段によって保存された前記ハンドルに対応した仮想ハンドルを設定する仮想ハンドル設定手段と、
前記ハンドル保存手段によって保存される前記ハンドルと、前記仮想ハンドル設定手段によって前記各アプリケーションプログラムに設定される各仮想ハンドルとの対応データを保存する対応データ保存手段と、
前記各アプリケーションプログラムが前記通信ポートを用いて通信を行う際に、前記対応データ保存手段に保存された前記対応データに従い、前記各アプリケーションプログラムに設定された前記仮想ハンドルと対応付けられた前記ハンドルを使用する通信制御手段と、
を備えたことを特徴とする通信システム。
A computer having a communication port to which a communication device can be connected and a memory;
A communication system for communicating with an external device via the communication port,
The computer
Multiple application programs,
The number of calls of the communication port by each application program is counted, and the number-of-calls increase / decrease means for reducing the number of calls each time communication processing using the communication port by each application program is completed,
Determining means for determining whether the number of calls by the number-of-calls increase / decrease means is equal to or less than a predetermined value when the application program calls the communication port;
A handle storing unit that stores a handle for performing communication in the communication port called by the application program when the number of calls of the communication port is determined to be equal to or less than the predetermined value by the determining unit;
Virtual handle setting means for setting a virtual handle corresponding to the handle stored by the handle storage means for each application program when each application program calls the communication port;
Corresponding data storage means for storing correspondence data between the handle stored by the handle storage means and each virtual handle set in each application program by the virtual handle setting means;
When each application program communicates using the communication port, the handle associated with the virtual handle set in each application program is set according to the correspondence data stored in the corresponding data storage unit. Communication control means to be used;
A communication system comprising:
前記通信制御手段は、
前記アプリケーションプログラムが特定の通信関連コマンドを実行したときに、前記仮想ハンドルを用いた通信を行うか否かを確認する仮想ハンドル利用確認手段を備え、
前記仮想ハンドル利用確認手段によって前記仮想ハンドルを用いた通信であることが確認された場合に、前記アプリケーションプログラムに設定された前記仮想ハンドルと対応付けられた前記ハンドルを使用することを特徴とする請求項7に記載の通信システム。
The communication control means includes
When the application program executes a specific communication related command, virtual handle use confirmation means for confirming whether to perform communication using the virtual handle,
The use of the handle associated with the virtual handle set in the application program when the virtual handle use confirmation unit confirms that the communication is using the virtual handle. Item 8. The communication system according to Item 7.
前記アプリケーションプログラムによる前記通信ポートを使用した通信処理が終了した場合に、前記対応データ保存手段によって保存された前記対応データにおいて、その通信処理が終了した前記アプリケーションプログラムについての前記仮想ハンドルと前記ハンドルとの対応値を破棄する対応値破棄手段を備えたことを特徴とする請求項7又は請求項8に記載の通信システム。   When the communication process using the communication port by the application program ends, the virtual handle and the handle for the application program for which the communication process has ended in the corresponding data stored by the corresponding data storage unit 9. The communication system according to claim 7, further comprising correspondence value discarding means for discarding the corresponding value. 前記外部装置は、前記コンピュータとの間でデータの送信又は受信を行う複数のプログラムを備えた携帯端末であり、
前記通信制御手段は、
前記コンピュータの複数の前記アプリケーションプログラムのうち、いずれか一のアプリケーションプログラムが前記通信ポートを用いて前記携帯端末の一のプログラムと通信を行う際に、前記対応データ保存手段に保存された前記対応データに従い、前記一のアプリケーションプログラムに設定された前記仮想ハンドルに対応する前記ハンドルを使用し、
前記一のアプリケーションプログラムによる前記通信ポートを用いた通信処理の継続中に、複数の前記アプリケーションプログラムのうちの他のアプリケーションプログラムが当該通信ポートを用いて前記携帯端末の他のプログラムと通信を行う場合、前記他のアプリケーションプログラムに設定された前記仮想ハンドルと前記対応データとに基づき、当該通信ポートに対応する前記ハンドルを使用することを特徴とする請求項7から請求項9のいずれか一項に記載の通信システム。
The external device is a portable terminal provided with a plurality of programs for transmitting or receiving data with the computer,
The communication control means includes
The correspondence data stored in the correspondence data storage means when any one of the plurality of application programs of the computer communicates with one program of the portable terminal using the communication port. And using the handle corresponding to the virtual handle set in the one application program,
When another application program of the plurality of application programs communicates with another program of the mobile terminal using the communication port while communication processing using the communication port by the one application program is continued The handle corresponding to the communication port is used based on the virtual handle set in the other application program and the corresponding data. The communication system described.
JP2009214032A 2008-09-18 2009-09-16 Communications system Expired - Fee Related JP5182261B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009214032A JP5182261B2 (en) 2008-09-18 2009-09-16 Communications system

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP2008239287 2008-09-18
JP2008239287 2008-09-18
JP2009214032A JP5182261B2 (en) 2008-09-18 2009-09-16 Communications system

Publications (2)

Publication Number Publication Date
JP2010097603A true JP2010097603A (en) 2010-04-30
JP5182261B2 JP5182261B2 (en) 2013-04-17

Family

ID=42259193

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009214032A Expired - Fee Related JP5182261B2 (en) 2008-09-18 2009-09-16 Communications system

Country Status (1)

Country Link
JP (1) JP5182261B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104750588A (en) * 2015-03-04 2015-07-01 广东好帮手电子科技股份有限公司 Serial port communication based pressure testing method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02123858A (en) * 1988-11-01 1990-05-11 Fujitsu Ltd Test system for communication program
JPH08161006A (en) * 1994-12-07 1996-06-21 Olympus Optical Co Ltd Program control unit
JP2005038044A (en) * 2003-07-16 2005-02-10 Ics:Kk Communication testing device with virtualized input/output communication port and its method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02123858A (en) * 1988-11-01 1990-05-11 Fujitsu Ltd Test system for communication program
JPH08161006A (en) * 1994-12-07 1996-06-21 Olympus Optical Co Ltd Program control unit
JP2005038044A (en) * 2003-07-16 2005-02-10 Ics:Kk Communication testing device with virtualized input/output communication port and its method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JPN6012052785; 小林弘伸 外2名: 'ユビキタスネットワーク社会を実現する近距離ワイヤレス技術' 東芝レビュー 第58巻,第4号, 20030401, p.7-10, 株式会社東芝 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104750588A (en) * 2015-03-04 2015-07-01 广东好帮手电子科技股份有限公司 Serial port communication based pressure testing method
CN104750588B (en) * 2015-03-04 2018-08-31 广东好帮手电子科技股份有限公司 A kind of method for testing pressure based on serial communication

Also Published As

Publication number Publication date
JP5182261B2 (en) 2013-04-17

Similar Documents

Publication Publication Date Title
US7945955B2 (en) Virus detection in mobile devices having insufficient resources to execute virus detection software
US8220004B2 (en) Method, apparatus and computer program product for sharing resources via an interprocess communication
EP2234011B1 (en) Information processing apparatus and program
JP4971202B2 (en) Information processing apparatus and program
JP2003271429A (en) Storage device resource managing method, storage resource managing program, recording medium recording the program, and storage resource managing device
US8677508B2 (en) Confidential information leakage prevention system, confidential information leakage prevention method and confidential information leakage prevention program
CN111078410B (en) Memory allocation method and device, storage medium and electronic equipment
WO2018000300A1 (en) Data operation method for electronic device, and electronic device
CN105512033A (en) Automated testing method and device of mobile terminal and mobile terminal
US20170286681A1 (en) Restricting reprogramming of a redirected usb device
US8136126B2 (en) Overriding potential competing optimization algorithms within layers of device drivers
CN109558187B (en) User interface rendering method and device
US20140351833A1 (en) Multi-computing environment operating on a single native operating system
CN114816748A (en) Thread scheduling method and device, electronic equipment and storage medium
CN112363980B (en) Data processing method and device of distributed system
CN109639827A (en) Client side upgrading method and device
JP5182261B2 (en) Communications system
JP4277952B2 (en) Competitive mediation device, competitive mediation method, and competitive mediation program
EP2241993B1 (en) Keeping file systems or partitions private in a memory device
WO2014087654A1 (en) Data transmission device, data transmission method, and storage medium
CN112470443B (en) Isolating a reset-directed biometric device to a remote session
CN113138845A (en) Fingerprint identification method, fingerprint identification device, terminal and storage medium
CA2700012C (en) Keeping file systems or partitions private in a memory device
CN111026542A (en) Display method and device of overlay icon of application program
CN114675892B (en) Display parameter setting method, device, equipment and storage medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110324

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20120912

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20121009

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20121128

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: 20121218

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20121231

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 5182261

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20160125

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20160125

Year of fee payment: 3

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees