VisionBox .NET Library  1.7.10.0 (2024-04-16)
VIB_NET::RS232 Class Reference
+ Inheritance diagram for VIB_NET::RS232:

Detailed Description

This class represents the RS232 which allows sending and receiving data over a RS232 port.

Public Member Functions

void ConfigureBaudRate (const UInt32 BaudRate)
 Configures the baud rate. More...
 
void ReadNByte (const UInt32 BytesToRead, UInt32 % BytesIn, array< Byte >^ pData, const UInt32 msTimeout)
 Reads the specified number of characters. More...
 
 RS232 ()
 Default constructor for the device object More...
 
void WriteNByte (const UInt32 BytesToWrite, array< Byte >^ pData)
 Sends the given number of bytes. More...
 
- Public Member Functions inherited from VIB_NET::iDevice
void Close ()
 Closes a device More...
 
bool isOpen ()
 Returns the open state of a device object More...
 
void Open ()
 Opens a device More...
 
void Open (unsigned int Index)
 Opens a device More...
 

Properties

UInt32 NumberOfBytesAvailable [get]
 Contains the number of valid characters within the receive buffer. More...
 
virtual VIB_NET::eDEVICE_TYPE Type [get]
 Returns the device type for the current instance, see eDEVICE_TYPE More...
 
- Properties inherited from VIB_NET::iDevice
virtual VIB_NET::eDEVICE_TYPE Type [get]
 Returns the device type for the current instance, see eDEVICE_TYPE More...
 

Constructor & Destructor Documentation

◆ RS232()

VIB_NET::RS232::RS232 ( )

Default constructor for the device object

The device must be opened with Open() before it can be used.

Member Function Documentation

◆ ConfigureBaudRate()

void VIB_NET::RS232::ConfigureBaudRate ( const UInt32  BaudRate)

Configures the baud rate.

Must be called before the user can send or receive data.

Parameters
BaudRatethe desired speed, from 9600 to 921600

◆ ReadNByte()

void VIB_NET::RS232::ReadNByte ( const UInt32  BytesToRead,
UInt32 %  BytesIn,
array< Byte >^  pData,
const UInt32  msTimeout 
)

Reads the specified number of characters.

The function waits until all the desired bytes are received, or until the specified timeout expires. The function returns successfully, if at least one byte was received.

Parameters
BytesToReadNumber of bytes to copy to pData buffer
BytesInNumber of valid bytes returned
pDataBuffer for storing the received bytes
msTimeoutTimeOut in milliseconds, 0 ... INFINITE

◆ WriteNByte()

void VIB_NET::RS232::WriteNByte ( const UInt32  BytesToWrite,
array< Byte >^  pData 
)

Sends the given number of bytes.

The functions doesn't wait not for completion of the transmit operation.

Parameters
BytesToWriteNumber of Bytes to send
pDataPointer to the data

Property Documentation

◆ NumberOfBytesAvailable

VIB_NET::RS232::NumberOfBytesAvailable
get

Contains the number of valid characters within the receive buffer.

It contains the number of bytes that can be read with ReadNByte() without blocking

◆ Type

VIB_NET::RS232::Type
get

Returns the device type for the current instance, see eDEVICE_TYPE