mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 19:54:57 +08:00
Merge branch 'boostless' of github.com:wjwwood/serial into boostless
This commit is contained in:
commit
6983d1145f
@ -240,7 +240,7 @@ public:
|
||||
* \return A std::string containing the line.
|
||||
*/
|
||||
std::string
|
||||
readline(size_t size = std::numeric_limits<std::size_t>::max(),
|
||||
readline(size_t size = std::numeric_limits<std::size_t>::max(),
|
||||
std::string eol = "\n");
|
||||
|
||||
/*! Reads in multiple lines until the serail port times out.
|
||||
|
||||
@ -2,22 +2,22 @@
|
||||
* with a loop back device attached.
|
||||
*
|
||||
* Alternatively you could use an Arduino:
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
while (Serial.available() > 0) {
|
||||
Serial.write(Serial.read());
|
||||
}
|
||||
}
|
||||
|
||||
*
|
||||
* void setup()
|
||||
* {
|
||||
* Serial.begin(115200);
|
||||
* }
|
||||
*
|
||||
* void loop()
|
||||
* {
|
||||
* while (Serial.available() > 0) {
|
||||
* Serial.write(Serial.read());
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
#define SERIAL_PORT_NAME "/dev/tty.usbserial-A900cfJA"
|
||||
#define SERIAL_PORT_NAME "/dev/tty.usbserial"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@ -50,7 +50,7 @@ protected:
|
||||
port1 = new Serial(SERIAL_PORT_NAME, 115200, 250);
|
||||
|
||||
// Need to wait a bit for the Arduino to come up
|
||||
my_sleep(1000);
|
||||
// my_sleep(1000);
|
||||
|
||||
listener.setDefaultHandler(default_handler);
|
||||
listener.startListening((*port1));
|
||||
@ -71,10 +71,10 @@ TEST_F(SerialListenerTests, handlesPartialMessage) {
|
||||
global_count = 0;
|
||||
std::string input_str = "?$1E\r$1E=Robo";
|
||||
|
||||
port1->write(input_str);
|
||||
ASSERT_EQ(input_str.length(), port1->write(input_str));
|
||||
|
||||
// give some time for the callback thread to finish
|
||||
my_sleep(1000);
|
||||
my_sleep(2000);
|
||||
|
||||
ASSERT_EQ(1, global_count);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user