Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
create::Serial Class Referenceabstract

#include <serial.h>

Inheritance diagram for create::Serial:
Inheritance graph
[legend]

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< Datadata
 
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
 

Detailed Description

Definition at line 49 of file serial.h.

Constructor & Destructor Documentation

create::Serial::Serial ( boost::shared_ptr< Data data)

Definition at line 8 of file serial.cpp.

create::Serial::~Serial ( )

Definition at line 17 of file serial.cpp.

Member Function Documentation

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

Definition at line 90 of file serial.h.

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)
protectedpure virtual
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 ( )
protectedpure virtual
void create::Serial::stopReading ( )
private

Definition at line 104 of file serial.cpp.

Member Data Documentation

uint8_t create::Serial::byteRead
private

Definition at line 62 of file serial.h.

boost::function<void()> create::Serial::callback
private

Definition at line 68 of file serial.h.

uint64_t create::Serial::corruptPackets
protected

Definition at line 76 of file serial.h.

boost::shared_ptr<Data> create::Serial::data
protected

Definition at line 74 of file serial.h.

bool create::Serial::dataReady
private

Definition at line 59 of file serial.h.

boost::condition_variable create::Serial::dataReadyCond
private

Definition at line 57 of file serial.h.

boost::mutex create::Serial::dataReadyMut
private

Definition at line 58 of file serial.h.

bool create::Serial::firstRead
private

Definition at line 61 of file serial.h.

boost::asio::io_service create::Serial::io
protected

Definition at line 52 of file serial.h.

boost::thread create::Serial::ioThread
private

Definition at line 56 of file serial.h.

bool create::Serial::isReading
private

Definition at line 60 of file serial.h.

boost::asio::serial_port create::Serial::port
protected

Definition at line 53 of file serial.h.

uint64_t create::Serial::totalPackets
protected

Definition at line 77 of file serial.h.


The documentation for this class was generated from the following files:


libcreate
Author(s): Jacob Perron
autogenerated on Sat Jun 8 2019 17:58:17