VEX V5 C++ API
Public Member Functions | List of all members
vex::brain::serial Class Reference

Public Member Functions

 serial ()
 
 ~serial ()
 
int32_t write (uint8_t *buffer, int32_t length)
 Write data to the serial port. More...
 
int32_t read (uint8_t *buffer, int32_t length)
 Read data present on the serial port. More...
 
bool hasData (void)
 Check if there is data to be read. Call read to get the data. More...
 

Constructor & Destructor Documentation

◆ serial()

vex::brain::serial::serial ( )

◆ ~serial()

vex::brain::serial::~serial ( )

Member Function Documentation

◆ write()

int32_t vex::brain::serial::write ( uint8_t *  buffer,
int32_t  length 
)

Write data to the serial port.

Parameters
bufferdata to write
lengthof the data to be written
Returns
number of bytes written, -1 on error

◆ read()

int32_t vex::brain::serial::read ( uint8_t *  buffer,
int32_t  length 
)

Read data present on the serial port.

Parameters
bufferfor the read data
lengthmaximum length of the data to be read
Returns
number of bytes actually read, <= length, -1 on error

◆ hasData()

bool vex::brain::serial::hasData ( void  )

Check if there is data to be read. Call read to get the data.

Returns
true if any data has arrived, false if there is no data