Go to the documentation of this file.
18 #ifndef HAND_BRIDGE_SERIAL_PORT_H_
19 #define HAND_BRIDGE_SERIAL_PORT_H_
23 #include <boost/lexical_cast.hpp>
24 #include <boost/chrono.hpp>
25 #include <boost/thread.hpp>
35 unsigned int baud = 57600;
36 if(
char * delim = strchr(
param,
'@')){
38 baud = boost::lexical_cast<unsigned int>(delim + 1);
45 template<
typename Duration>
int waitData(
const Duration& duration){
46 boost::chrono::steady_clock::time_point deadline = boost::chrono::steady_clock::now() + duration;
49 boost::this_thread::sleep_for(boost::chrono::milliseconds(1));
56 int read(
char *buf,
unsigned count){
59 bool write(uint8_t* data,
int length)
63 bool write(
const std::string &line){
64 return serWrite(
ser_port,
const_cast<char *
>(line.c_str()), line.size()) == 0;
76 #endif // HAND_BRIDGE_SERIAL_PORT_H_
int serReadByte(unsigned handle)
bool write(const std::string &line)
int serOpen(char *tty, unsigned serBaud, unsigned serFlags)
int serWrite(unsigned handle, char *buf, unsigned count)
bool write(uint8_t *data, int length)
int serDataAvailable(unsigned handle)
int serRead(unsigned handle, char *buf, unsigned count)
int read(char *buf, unsigned count)
T param(const std::string ¶m_name, const T &default_val)
int waitData(const Duration &duration)
int serClose(unsigned handle)
cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Fri Aug 2 2024 09:40:57