#include <serial.h>
Public Member Functions | |
bool | connect (const std::string &port, const int &baud=115200, boost::function< void()> cb=0) |
bool | connected () const |
void | disconnect () |
uint64_t | getNumCorruptPackets () const |
uint64_t | getTotalPackets () const |
bool | send (const uint8_t *bytes, const uint32_t numBytes) |
bool | sendOpcode (const Opcode &code) |
Serial (boost::shared_ptr< Data > data) | |
~Serial () | |
Protected Member Functions | |
void | notifyDataReady () |
virtual void | processByte (uint8_t byteRead)=0 |
virtual bool | startSensorStream ()=0 |
Protected Attributes | |
uint64_t | corruptPackets |
boost::shared_ptr< Data > | data |
boost::asio::io_service | io |
boost::asio::serial_port | port |
uint64_t | totalPackets |
Private Member Functions | |
void | onData (const boost::system::error_code &e, const std::size_t &size) |
bool | startReading () |
void | stopReading () |
Private Attributes | |
uint8_t | byteRead |
boost::function< void()> | callback |
bool | dataReady |
boost::condition_variable | dataReadyCond |
boost::mutex | dataReadyMut |
bool | firstRead |
boost::thread | ioThread |
bool | isReading |
create::Serial::Serial | ( | boost::shared_ptr< Data > | data | ) |
Definition at line 8 of file serial.cpp.
Definition at line 17 of file serial.cpp.
bool create::Serial::connect | ( | const std::string & | port, |
const int & | baud = 115200 , |
||
boost::function< void()> | cb = 0 |
||
) |
Definition at line 21 of file serial.cpp.
bool create::Serial::connected | ( | ) | const [inline] |
void create::Serial::disconnect | ( | ) |
Definition at line 40 of file serial.cpp.
uint64_t create::Serial::getNumCorruptPackets | ( | ) | const |
Definition at line 166 of file serial.cpp.
uint64_t create::Serial::getTotalPackets | ( | ) | const |
Definition at line 170 of file serial.cpp.
void create::Serial::notifyDataReady | ( | ) | [protected] |
Definition at line 117 of file serial.cpp.
void create::Serial::onData | ( | const boost::system::error_code & | e, |
const std::size_t & | size | ||
) | [private] |
Definition at line 134 of file serial.cpp.
virtual void create::Serial::processByte | ( | uint8_t | byteRead | ) | [protected, pure virtual] |
Implemented in create::SerialStream, and create::SerialQuery.
bool create::Serial::send | ( | const uint8_t * | bytes, |
const uint32_t | numBytes | ||
) |
Definition at line 151 of file serial.cpp.
bool create::Serial::sendOpcode | ( | const Opcode & | code | ) |
Definition at line 161 of file serial.cpp.
bool create::Serial::startReading | ( | ) | [private] |
Definition at line 54 of file serial.cpp.
virtual bool create::Serial::startSensorStream | ( | ) | [protected, pure virtual] |
Implemented in create::SerialStream, and create::SerialQuery.
void create::Serial::stopReading | ( | ) | [private] |
Definition at line 104 of file serial.cpp.
uint8_t create::Serial::byteRead [private] |
boost::function<void()> create::Serial::callback [private] |
uint64_t create::Serial::corruptPackets [protected] |
boost::shared_ptr<Data> create::Serial::data [protected] |
bool create::Serial::dataReady [private] |
boost::condition_variable create::Serial::dataReadyCond [private] |
boost::mutex create::Serial::dataReadyMut [private] |
bool create::Serial::firstRead [private] |
boost::asio::io_service create::Serial::io [protected] |
boost::thread create::Serial::ioThread [private] |
bool create::Serial::isReading [private] |
boost::asio::serial_port create::Serial::port [protected] |
uint64_t create::Serial::totalPackets [protected] |