SerialDevice.ErrorReceived 事件

定义

在串行端口上发生错误时调用的事件处理程序。

// Register
event_token ErrorReceived(TypedEventHandler<SerialDevice, ErrorReceivedEventArgs const&> const& handler) const;

// Revoke with event_token
void ErrorReceived(event_token const* cookie) const;

// Revoke with event_revoker
SerialDevice::ErrorReceived_revoker ErrorReceived(auto_revoke_t, TypedEventHandler<SerialDevice, ErrorReceivedEventArgs const&> const& handler) const;
public event TypedEventHandler<SerialDevice,ErrorReceivedEventArgs> ErrorReceived;
function onErrorReceived(eventArgs) { /* Your code */ }
serialDevice.addEventListener("errorreceived", onErrorReceived);
serialDevice.removeEventListener("errorreceived", onErrorReceived);
- or -
serialDevice.onerrorreceived = onErrorReceived;
Public Custom Event ErrorReceived As TypedEventHandler(Of SerialDevice, ErrorReceivedEventArgs) 

事件类型

注解

此事件用于检测和响应通过串行端口通信数据时出现的错误。 发生错误条件时,将调用 ErrorReceived 事件处理程序,并在 ErrorReceivedEventArgs 对象中接收错误信息。 通过检索 ErrorReceivedEventArgs 类的 Error 属性来确定错误的类型。 这些属性值在 SerialError 枚举中定义。

适用于