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, std::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 (std::shared_ptr< Data > data, bool install_signal_handler)
 
 ~Serial ()
 

Protected Member Functions

void notifyDataReady ()
 
virtual void processByte (uint8_t byteRead)=0
 
void signalHandler (const boost::system::error_code &error, int signal_number)
 
virtual bool startSensorStream ()=0
 

Protected Attributes

uint64_t corruptPackets
 
std::shared_ptr< Datadata
 
boost::asio::io_service io
 
boost::asio::serial_port port
 
boost::asio::signal_set signals
 
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
 
std::function< void()> callback
 
bool dataReady
 
std::condition_variable dataReadyCond
 
std::mutex dataReadyMut
 
bool firstRead
 
std::thread ioThread
 
bool isReading
 

Detailed Description

Definition at line 51 of file serial.h.

Constructor & Destructor Documentation

create::Serial::Serial ( std::shared_ptr< Data data,
bool  install_signal_handler 
)

Definition at line 10 of file serial.cpp.

create::Serial::~Serial ( )

Definition at line 25 of file serial.cpp.

Member Function Documentation

bool create::Serial::connect ( const std::string &  port,
const int &  baud = 115200,
std::function< void()>  cb = 0 
)

Definition at line 41 of file serial.cpp.

bool create::Serial::connected ( ) const
inline

Definition at line 93 of file serial.h.

void create::Serial::disconnect ( )

Definition at line 65 of file serial.cpp.

uint64_t create::Serial::getNumCorruptPackets ( ) const

Definition at line 199 of file serial.cpp.

uint64_t create::Serial::getTotalPackets ( ) const

Definition at line 203 of file serial.cpp.

void create::Serial::notifyDataReady ( )
protected

Definition at line 147 of file serial.cpp.

void create::Serial::onData ( const boost::system::error_code &  e,
const std::size_t &  size 
)
private

Definition at line 164 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 184 of file serial.cpp.

bool create::Serial::sendOpcode ( const Opcode code)

Definition at line 194 of file serial.cpp.

void create::Serial::signalHandler ( const boost::system::error_code &  error,
int  signal_number 
)
protected

Definition at line 29 of file serial.cpp.

bool create::Serial::startReading ( )
private

Definition at line 79 of file serial.cpp.

virtual bool create::Serial::startSensorStream ( )
protectedpure virtual
void create::Serial::stopReading ( )
private

Definition at line 134 of file serial.cpp.

Member Data Documentation

uint8_t create::Serial::byteRead
private

Definition at line 65 of file serial.h.

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

Definition at line 70 of file serial.h.

uint64_t create::Serial::corruptPackets
protected

Definition at line 78 of file serial.h.

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

Definition at line 76 of file serial.h.

bool create::Serial::dataReady
private

Definition at line 62 of file serial.h.

std::condition_variable create::Serial::dataReadyCond
private

Definition at line 60 of file serial.h.

std::mutex create::Serial::dataReadyMut
private

Definition at line 61 of file serial.h.

bool create::Serial::firstRead
private

Definition at line 64 of file serial.h.

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

Definition at line 54 of file serial.h.

std::thread create::Serial::ioThread
private

Definition at line 59 of file serial.h.

bool create::Serial::isReading
private

Definition at line 63 of file serial.h.

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

Definition at line 56 of file serial.h.

boost::asio::signal_set create::Serial::signals
protected

Definition at line 55 of file serial.h.

uint64_t create::Serial::totalPackets
protected

Definition at line 79 of file serial.h.


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


libcreate
Author(s): Jacob Perron
autogenerated on Sat May 8 2021 03:02:37