35 #ifndef CREATE_SERIAL_H 36 #define CREATE_SERIAL_H 38 #include <boost/asio.hpp> 39 #include <boost/thread.hpp> 40 #include <boost/thread/condition_variable.hpp> 41 #include <boost/function.hpp> 42 #include <boost/shared_ptr.hpp> 52 boost::asio::io_service
io;
53 boost::asio::serial_port
port;
66 void onData(
const boost::system::error_code& e,
const std::size_t& size);
74 boost::shared_ptr<Data>
data;
86 Serial(boost::shared_ptr<Data> data);
88 bool connect(
const std::string& port,
const int& baud = 115200, boost::function<
void()> cb = 0);
90 inline bool connected()
const {
return port.is_open(); };
91 bool send(
const uint8_t* bytes,
const uint32_t numBytes);
98 #endif // CREATE_SERIAL_H
boost::mutex dataReadyMut
uint64_t getTotalPackets() const
boost::asio::serial_port port
virtual void processByte(uint8_t byteRead)=0
bool sendOpcode(const Opcode &code)
boost::shared_ptr< Data > data
Serial(boost::shared_ptr< Data > data)
bool connect(const std::string &port, const int &baud=115200, boost::function< void()> cb=0)
bool send(const uint8_t *bytes, const uint32_t numBytes)
virtual bool startSensorStream()=0
boost::function< void()> callback
boost::condition_variable dataReadyCond
void onData(const boost::system::error_code &e, const std::size_t &size)
boost::asio::io_service io
uint64_t getNumCorruptPackets() const