This class allows sending and receiving data over a serial port.
This device is currently only implemented for serial communication on the Camera Link interface.
Public Member Functions | |
bool | ConfigureBaudRate (const unsigned int BaudRate) |
Configures the baud rate. More... | |
bool | GetNumberOfBytesAvailable (unsigned int &NumberOfBytesAvailable) |
Returns the number of valid characters within the receive buffer. More... | |
bool | ReadNByte (const unsigned int BytesToRead, unsigned int &BytesIn, unsigned char *pData, const unsigned int msTimeout) |
Reads the specified number of characters. More... | |
Rs232 () | |
Default constructor for the device object More... | |
bool | WriteNByte (const unsigned int BytesToWrite, const unsigned char *pData) |
Sends the given number of bytes. More... | |
Public Member Functions inherited from VIB::iDevice | |
bool | Close () |
Closes a device More... | |
iDevice (const iDevice &device) | |
The copy constructor makes a copy of the existing device object More... | |
bool | isOpen (bool &state) |
Returns the open state of a device object More... | |
bool | Open (unsigned int Index=0) |
Opens a device More... | |
iDevice & | operator= (const iDevice &device) |
The assignment operator makes a copy of the existing device object More... | |
virtual | ~iDevice () |
Deletes the device object More... | |
VIB::Rs232::Rs232 | ( | ) |
Default constructor for the device object
The device must be opened with Open() before it can be used.
bool VIB::Rs232::ConfigureBaudRate | ( | const unsigned int | BaudRate | ) |
Configures the baud rate.
Must be called before the user can send or receive data.
BaudRate | the desired speed, from 9600 to 921600 |
true
for success, use VIBSystem::GetLastErrorString() for an error descriptionbool VIB::Rs232::GetNumberOfBytesAvailable | ( | unsigned int & | NumberOfBytesAvailable | ) |
Returns the number of valid characters within the receive buffer.
NumberOfBytesAvailable | Number of bytes that can be read with ReadNByte() without blocking |
true
for success, use VIBSystem::GetLastErrorString() for an error descriptionbool VIB::Rs232::ReadNByte | ( | const unsigned int | BytesToRead, |
unsigned int & | BytesIn, | ||
unsigned char * | pData, | ||
const unsigned int | 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.
BytesToRead | Number of bytes to copy to pData buffer |
BytesIn | Number of valid bytes returned |
pData | Valid pointer to buffer for storing the received bytes |
msTimeout | TimeOut in milliseconds, 0 ... INFINITE |
true
for success, use VIBSystem::GetLastErrorString() for an error descriptionbool VIB::Rs232::WriteNByte | ( | const unsigned int | BytesToWrite, |
const unsigned char * | pData | ||
) |
Sends the given number of bytes.
The functions doesn't wait not for completion of the transmit operation.
BytesToWrite | Number of bytes to send |
pData | Pointer to the data |
true
for success, use VIBSystem::GetLastErrorString() for an error description