|
VPort
|
SerialTools v2.00 and later
|
The VPort class contains the core functionallity to create and use virtual serial ports.
To access and use a normal serial port you do not use this class. Rather this class
creates a new "virtual" serial port on your computer. This new "virtual" serial port can a 3rd party
application connect to as it was a normal serial port connected to your computer.
In this way you can send and receive data from a 3rd party application and emulate hardware, null modems,
GPS receivers, scales, yes anything normally connected to a serial port.
A good way to view and understand a virtual serial port is to think of it as "the other side" of a serial
port.
Set port number using
VPort.ComPort. VPort.Created creates the specified serial port.
Data is read from the port with the VPort.OnDataFromPort event or the
VPort.DataFromPort method and you write data
using VPort.DataToPort.
By using VPort.StartTrigger and VPort.EndTrigger SerialTools
can help you with simple parsing of the data.
VPort.Timeout can be used for timeout handling.
If you want to read and write binary data take a closer look at
Port.ByteArrayToString and Port.StringToByteArray.
It can be of interest to know if an application has opened a virtual port or not.
If it is not opened there is no reason to send data to it for example. There are two events
handling this VPort.OnOpened and VPort.OnClosed
You can only send and receive data using the VPort class, you cannot set or read the control signals.
Note! On Windows Mobile / Pocket PC, if you want to connect several applications to the same VPort
you can use GpsGate API instead. SerialTools does not support
the scenario of multiple applications connecting to one virtual port.

100% managed code
|
|