![]() |
VectorNav .NET Library
|
Provides access to a serial port. More...
Public Member Functions | |
| void | Open () |
| Opens the simple port. More... | |
| void | Close () |
| Closes the simple port. More... | |
| void | Write (byte[] buffer, int index, int length) |
| Writes out data to the simple port. More... | |
| int | Read (byte[] buffer, int index, int numOfBytesToRead) |
| Allows reading data from the simple port. More... | |
| void | Dispose () |
| SerialPort (string portName, UInt32 baudrate) | |
| Creates a new SerialPort with the provided connection parameters. More... | |
| void | Open (bool checkAndToggleIsOpenFlag) |
| void | ChangeBaudRate (uint br) |
| Changes the connected baud rate of the port. More... | |
Static Public Member Functions | |
| static string[] | GetPortNames () |
| Gets the list of all available serial ports on the computer. More... | |
Properties | |
| EventHandler | DataReceived |
| bool | IsOpen [get] |
| int | BytesToRead [get] |
| Returns the number of bytes available to read in the received buffer. More... | |
Properties inherited from VectorNav.Communication.ISimplePort | |
| bool | IsOpen [get] |
| Indicates if the simple port is open. More... | |
| int | BytesToRead [get] |
| Returns the number of bytes available to read in the received buffer. More... | |
Additional Inherited Members | |
Events inherited from VectorNav.Communication.ISimplePort | |
| EventHandler | DataReceived |
| Raised whenever the simple port receives new data. More... | |
Provides access to a serial port.
When the SerialPort is first created and the connection opened, the user will normally have to poll the method Read to see if any new data is available on the serial port. However, if the user code registers a handler with the event DataReceived, the SerialPort object will start an internal thread that monitors the serial port for new data, and when new data is available, it will alert the user code through the registered event handler. Then the user can call Read to retrieve the data.
| VectorNav.Communication.SerialPort.SerialPort | ( | string | portName, |
| UInt32 | baudrate | ||
| ) |
Creates a new SerialPort with the provided connection parameters.
| portName | The name of the serial port. |
| baudrate | The baudrate to open the serial port at. |
| void VectorNav.Communication.SerialPort.ChangeBaudRate | ( | uint | br | ) |
Changes the connected baud rate of the port.
| br | The baud rate to change the port to. |
| void VectorNav.Communication.SerialPort.Close | ( | ) |
Closes the simple port.
Implements VectorNav.Communication.ISimplePort.
|
static |
Gets the list of all available serial ports on the computer.
| void VectorNav.Communication.SerialPort.Open | ( | ) |
Opens the simple port.
Implements VectorNav.Communication.ISimplePort.
| int VectorNav.Communication.SerialPort.Read | ( | byte[] | buffer, |
| int | index, | ||
| int | numOfBytesToRead | ||
| ) |
Allows reading data from the simple port.
| buffer | The buffer to place any read bytes. |
| index | The index to start placing any read bytes. |
| numOfBytesToRead | The maximum number of bytes to read. |
Implements VectorNav.Communication.ISimplePort.
| void VectorNav.Communication.SerialPort.Write | ( | byte[] | buffer, |
| int | index, | ||
| int | length | ||
| ) |
Writes out data to the simple port.
| buffer | The buffer containing the data to write out. |
| index | The index in the buffer to start writing data out. |
| length | The number of bytes to write out. |
Implements VectorNav.Communication.ISimplePort.
|
get |
Returns the number of bytes available to read in the received buffer.
1.8.10