Printable versions
This Page
All Pages
PDF

Index

Class
Port

Properties
List
Enabled
BaudRate
ComPort

Methods
Read
Write
Purge
Dispose

ByteArrayToString
StringToByteArray

Events
OnRead
OnWritten
OnDSR
OnCTS
OnRI
OnDCD
OnForceClose

More Properties
Parity
StopBits
ByteSize
StartTrigger
EndTrigger
BufferSize
Timeout

DSR
CTS
RI
DCD

Handshake
RTS
DTR
Break
InfraRed

MultiThreading
Parent
NoEvents

Port.Read SerialTools v1.10 and later

Reads data from the serialport. Cannot be used if an event handler is assigned to Port.OnRead (.NET) or Port.NoEvents is set to true (ActiveX).

Read has two versions. The first takes a BufferSize and TimeOut as arguments. Setting BufferSize to 0 will return all data in serial buffer. But if the serial buffer is empty it will wait until something has arrived. TimeOut determines how long to wait (in miliseconds). Set TimeOut to 0 to disable time out.

The second version takes StartTrigger, EndTrigger and TimeOut as arguments. Read will parse the serial buffer and return data according to the rules specified for Port.OnRead. If no matching data is found in the serial buffer TimeOut determines how long to wait before returning null / Nothing.

On time out Read() always returns null / Nothing.

If a Bluetooth connection is interrupted during Read, an exception is thrown and the port is closed. See the .NET Compact Framework samples for details. A Bluetooth connection is typically interrupted if the Bluetooth device is turned of or if it gets out of reach. See also Port.OnForceClose for more info on how to handle Bluetooth interruption.

Syntax 1
Value = object.Read ( BufferSize, Timeout )

Part Type Description
object SerialNET.Port An object that evaluates to an SerialNET.Port object.
Value string Data received from serial port. Nothing/null if no data received.
BufferSize int See OnRead for details.
Timeout int See OnRead for details.

Syntax 2
Value = object.Read ( StartTrigger, EndTrigger, Timeout )

Part Type Description
object SerialNET.Port An object that evaluates to an SerialNET.Port object.
Value string Data received from serial port. Nothing/null if no data received.
StartTrigger string See OnRead for details.
EndTrigger string See OnRead for details.
Timeout int See OnRead for details.



100% managed code
© 2016 Franson Technology AB, All rights reserved, Contact | | Affiliate | Login