共用方式為


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 列舉中。

適用於