受信待機 (アスキーモード用)

Namespace: FVIL.Ports
Assembly: FVILforms (in FVILforms.dll) Version: 3.1.0.0 (3.1.0.9)

Syntax

C#
public static string WaitForAsciiData(
	SerialPort src,
	string ack,
	int timeout
)
Visual Basic
Public Shared Function WaitForAsciiData ( 
	src As SerialPort,
	ack As String,
	timeout As Integer
) As String

Parameters

src
Type: System.IO.Ports..::..SerialPort
シリアルポートオブジェクト
ack
Type: System..::..String
カメラからの応答の識別子 (末尾に含まれる文字列のみ指定してください。)
timeout
Type: System..::..Int32
タイムアウト(ms) [範囲:0~]

Return Value

Type: String
カメラから受信した文字列を返します。
引数 timeout に指定した時間が過ぎた場合は受信したところまでを返します。 引数 src の ReadTimeout に指定されたタイムアウト時間は使用しません。

Examples

C# Copy imageCopy
System.IO.Ports.SerialPort port = new System.IO.Ports.SerialPort();
// port の初期化.

// 送信.
port.WriteLine("set 7");

// 受信.
string res = FVIL.Ports.SerialPortTool.WaitForAsciiData(port, "OK>", 1000);
if (res.Contains("OK>"))
    Console.WriteLine("success");
else
    Console.WriteLine("failure");
Console.WriteLine("res = {0}", res);

See Also