I am using the dragonfly to communicate with a sensor. The serial communication works great with one exception, the serial read function blocks and never times out as per the documentation. I have the dragonfly board in the the development kit and use print statements to see what is happening. If I forget to connect the sensor or I am debugging the sensor code, I notice that the dragonfly stops until data is received. I changed the number of milliseconds to wait, to different values and even after 10 minutes the function has not timed out.
Here are snippets of code:
mts::MTSSerial port;
cout << "Get command reply" << endl;
int bytes = port.read(In_Buffer,3000,100);
cout << "Reply bytes:" << +bytes << endl; //Never times out
Here is the function documentation from MTSBufferedIO.h
/** This method enables bulk reads from the Rx or read buffer. It attempts
* to read the amount specified, but will complete early if the specified imeout
* expires.
*
* @param data the buffer where data read will be added to.
* @param length the amount of data in bytes to be read into the buffer.
* @timeoutMillis amount of time to complete operation.
* @returns the total number of bytes that were read.
*/
int read(char* data, int length, unsigned int timeoutMillis);
-
This topic was modified 8 years, 6 months ago by
Will Blight.
-
This topic was modified 8 years, 6 months ago by
Will Blight.