clear_serialT_clear_serialClearSerialClearSerialclear_serial清除串行(算子)

名称

clear_serialT_clear_serialClearSerialClearSerialclear_serial — 清除串行连接的缓冲区。

签名

clear_serial( : : SerialHandle, Channel : )

Herror T_clear_serial(const Htuple SerialHandle, const Htuple Channel)

void ClearSerial(const HTuple& SerialHandle, const HTuple& Channel)

void HSerial::ClearSerial(const HString& Channel) const

void HSerial::ClearSerial(const char* Channel) const

void HSerial::ClearSerial(const wchar_t* Channel) const   ( Windows only)

static void HOperatorSet.ClearSerial(HTuple serialHandle, HTuple channel)

void HSerial.ClearSerial(string channel)

def clear_serial(serial_handle: HHandle, channel: str) -> None

描述

clear_serialclear_serialClearSerialClearSerialClearSerialclear_serial 会清除写入 SerialHandleSerialHandleSerialHandleSerialHandleserialHandleserial_handle 所引用的串行设备但未传输的数据(ChannelChannelChannelChannelchannelchannel = 'output'"output""output""output""output""output"),或接收但未读取的数据(ChannelChannelChannelChannelchannelchannel = 'input'"input""input""input""input""input"),或同时执行这两项操作(ChannelChannelChannelChannelchannelchannel = 'in_out'"in_out""in_out""in_out""in_out""in_out")。

执行信息

此算子修改后续输入参数的状态:

在执行此算子时,若该参数值需在多个线程间使用,则必须对其访问进行同步。

参数

SerialHandleSerialHandleSerialHandleSerialHandleserialHandleserial_handle (输入控制,状态被修改)  serial HSerial, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

串行接口句柄。

ChannelChannelChannelChannelchannelchannel (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

待清除缓冲区。

默认值: 'input' "input" "input" "input" "input" "input"

值列表: 'in_out'"in_out""in_out""in_out""in_out""in_out", 'input'"input""input""input""input""input", 'output'"output""output""output""output""output"

结果

如果参数正确且串行设备的缓冲区能够被清除,则算子 clear_serialclear_serialClearSerialClearSerialClearSerialclear_serial 返回值 2 (H_MSG_TRUE)。否则将抛出异常。

可能的前趋

open_serialopen_serialOpenSerialOpenSerialOpenSerialopen_serial

可能的后继

read_serialread_serialReadSerialReadSerialReadSerialread_serial, write_serialwrite_serialWriteSerialWriteSerialWriteSerialwrite_serial

另见

read_serialread_serialReadSerialReadSerialReadSerialread_serial

模块

基础