Родитель
32990886e6
Коммит
8e5078c65f
|
@ -133,7 +133,7 @@ private void DataReceivedNormalEvent(object sender, SerialDataReceivedEventArgs
|
|||
#### WatchChar
|
||||
|
||||
|
||||
.NET nanoFramework has a specific API to watch for a specific character if present at the end of the transmission.
|
||||
.NET nanoFramework has a custom API event to watch for a specific character if present during the transmission.
|
||||
|
||||
```csharp
|
||||
port.WatchChar = '\r';
|
||||
|
@ -144,7 +144,7 @@ private void DataReceivedNormalEvent(object sender, SerialDataReceivedEventArgs
|
|||
{
|
||||
if (e.EventType == SerialData.WatchChar)
|
||||
{
|
||||
// We have our special character at the end of the transmission
|
||||
// The specified character was detected when reading from the serialport.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
@ -8,6 +8,11 @@ namespace System.IO.Ports
|
|||
/// <summary>
|
||||
/// Specifies the type of character that was received on the serial port of the <see cref="SerialPort"/> object.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This enumeration is used with the <see cref="SerialPort.DataReceived"/> event.
|
||||
/// You examine the type of character that was received by retrieving the value of the <see cref="SerialDataReceivedEventArgs.EventType"/> property.
|
||||
/// The EventType property contains one of the values from the `SerialData` enumeration.
|
||||
/// </remarks>
|
||||
public enum SerialData
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -16,8 +21,11 @@ namespace System.IO.Ports
|
|||
Chars = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The end of file character was received and placed in the input buffer.
|
||||
/// The `watch` character was received and placed in the input buffer.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is only supported on .Net nanoFramework.
|
||||
/// </remarks>
|
||||
WatchChar = 2
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче