Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
kobuki::PacketFinderBase Class Reference

Provides simple packet finder which may be consist of stx, etx, payload, ... More...

#include <packet_finder.hpp>

Inheritance diagram for kobuki::PacketFinderBase:
Inheritance graph
[legend]

Public Types

typedef ecl::PushAndPop< unsigned char > BufferType
 
enum  packetFinderState {
  clearBuffer = 0, waitingForStx, waitingForPayloadSize, waitingForPayloadToEtx,
  waitingForEtx
}
 

Public Member Functions

virtual bool checkSum ()
 
void clear ()
 
void configure (const std::string &sigslots_namespace, const BufferType &putStx, const BufferType &putEtx, unsigned int sizeLengthField, unsigned int sizeMaxPayload, unsigned int sizeChecksumField, bool variableSizePayload)
 
void enableVerbose ()
 
void getBuffer (BufferType &bufferRef)
 
void getPayload (BufferType &bufferRef)
 
unsigned int numberOfDataToRead ()
 
 PacketFinderBase ()
 
virtual bool update (const unsigned char *incoming, unsigned int numberOfIncoming)
 
virtual ~PacketFinderBase ()
 

Public Attributes

enum packetFinderState state
 

Protected Member Functions

bool waitForEtx (const unsigned char incoming, bool &foundPacket)
 
bool waitForPayloadAndEtx (const unsigned char *incoming, unsigned int numberOfIncoming, bool &foundPacket)
 
bool waitForPayloadSize (const unsigned char *incoming, unsigned int numberOfIncoming)
 
bool WaitForStx (const unsigned char datum)
 

Protected Attributes

BufferType buffer
 
BufferType ETX
 
ecl::Signal< const std::string & > sig_error
 
ecl::Signal< const std::string & > sig_warn
 
unsigned int size_checksum_field
 
unsigned int size_etx
 
unsigned int size_length_field
 
unsigned int size_max_payload
 
unsigned int size_payload
 
unsigned int size_stx
 
BufferType STX
 
bool variable_size_payload
 
bool verbose
 

Detailed Description

Provides simple packet finder which may be consist of stx, etx, payload, ...

Note

Usage:

@code
Todo:
(1) getting buffer from this class
(2) simple construction of this class
(3) device abstraction
(4) extend-able packet structures
(5) like ros, auto-generation of code from scripts
(6) packetFinder to ros converter
(7) evaluate it (valgrind)

Definition at line 78 of file packet_finder.hpp.

Member Typedef Documentation

◆ BufferType

Definition at line 91 of file packet_finder.hpp.

Member Enumeration Documentation

◆ packetFinderState

Enumerator
clearBuffer 
waitingForStx 
waitingForPayloadSize 
waitingForPayloadToEtx 
waitingForEtx 

Definition at line 93 of file packet_finder.hpp.

Constructor & Destructor Documentation

◆ PacketFinderBase()

kobuki::PacketFinderBase::PacketFinderBase ( )

Default constructor. Use with configure().

Definition at line 31 of file packet_finder.cpp.

◆ ~PacketFinderBase()

virtual kobuki::PacketFinderBase::~PacketFinderBase ( )
inlinevirtual

Definition at line 123 of file packet_finder.hpp.

Member Function Documentation

◆ checkSum()

bool kobuki::PacketFinderBase::checkSum ( )
virtual

Reimplemented in kobuki::PacketFinder.

Definition at line 77 of file packet_finder.cpp.

◆ clear()

void kobuki::PacketFinderBase::clear ( )

Definition at line 66 of file packet_finder.cpp.

◆ configure()

void kobuki::PacketFinderBase::configure ( const std::string &  sigslots_namespace,
const BufferType putStx,
const BufferType putEtx,
unsigned int  sizeLengthField,
unsigned int  sizeMaxPayload,
unsigned int  sizeChecksumField,
bool  variableSizePayload 
)

Definition at line 41 of file packet_finder.cpp.

◆ enableVerbose()

void kobuki::PacketFinderBase::enableVerbose ( )

Definition at line 72 of file packet_finder.cpp.

◆ getBuffer()

void kobuki::PacketFinderBase::getBuffer ( BufferType bufferRef)

Definition at line 114 of file packet_finder.cpp.

◆ getPayload()

void kobuki::PacketFinderBase::getPayload ( BufferType bufferRef)

Definition at line 119 of file packet_finder.cpp.

◆ numberOfDataToRead()

unsigned int kobuki::PacketFinderBase::numberOfDataToRead ( )

Definition at line 82 of file packet_finder.cpp.

◆ update()

bool kobuki::PacketFinderBase::update ( const unsigned char *  incoming,
unsigned int  numberOfIncoming 
)
virtual

Checks for incoming packets.

Parameters
incoming
numberOfIncoming
Returns
bool : true if a valid incoming packet has been found.

Definition at line 135 of file packet_finder.cpp.

◆ waitForEtx()

bool kobuki::PacketFinderBase::waitForEtx ( const unsigned char  incoming,
bool &  foundPacket 
)
protected

Definition at line 282 of file packet_finder.cpp.

◆ waitForPayloadAndEtx()

bool kobuki::PacketFinderBase::waitForPayloadAndEtx ( const unsigned char *  incoming,
unsigned int  numberOfIncoming,
bool &  foundPacket 
)
protected

Definition at line 317 of file packet_finder.cpp.

◆ waitForPayloadSize()

bool kobuki::PacketFinderBase::waitForPayloadSize ( const unsigned char *  incoming,
unsigned int  numberOfIncoming 
)
protected

Definition at line 229 of file packet_finder.cpp.

◆ WaitForStx()

bool kobuki::PacketFinderBase::WaitForStx ( const unsigned char  datum)
protected

Definition at line 208 of file packet_finder.cpp.

Member Data Documentation

◆ buffer

BufferType kobuki::PacketFinderBase::buffer
protected

Definition at line 114 of file packet_finder.hpp.

◆ ETX

BufferType kobuki::PacketFinderBase::ETX
protected

Definition at line 113 of file packet_finder.hpp.

◆ sig_error

ecl::Signal<const std::string&> kobuki::PacketFinderBase::sig_error
protected

Definition at line 118 of file packet_finder.hpp.

◆ sig_warn

ecl::Signal<const std::string&> kobuki::PacketFinderBase::sig_warn
protected

Definition at line 118 of file packet_finder.hpp.

◆ size_checksum_field

unsigned int kobuki::PacketFinderBase::size_checksum_field
protected

Definition at line 110 of file packet_finder.hpp.

◆ size_etx

unsigned int kobuki::PacketFinderBase::size_etx
protected

Definition at line 105 of file packet_finder.hpp.

◆ size_length_field

unsigned int kobuki::PacketFinderBase::size_length_field
protected

Definition at line 106 of file packet_finder.hpp.

◆ size_max_payload

unsigned int kobuki::PacketFinderBase::size_max_payload
protected

Definition at line 108 of file packet_finder.hpp.

◆ size_payload

unsigned int kobuki::PacketFinderBase::size_payload
protected

Definition at line 109 of file packet_finder.hpp.

◆ size_stx

unsigned int kobuki::PacketFinderBase::size_stx
protected

Definition at line 104 of file packet_finder.hpp.

◆ state

enum packetFinderState kobuki::PacketFinderBase::state

Definition at line 101 of file packet_finder.hpp.

◆ STX

BufferType kobuki::PacketFinderBase::STX
protected

Definition at line 112 of file packet_finder.hpp.

◆ variable_size_payload

bool kobuki::PacketFinderBase::variable_size_payload
protected

Definition at line 107 of file packet_finder.hpp.

◆ verbose

bool kobuki::PacketFinderBase::verbose
protected

Definition at line 116 of file packet_finder.hpp.


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


kobuki_driver
Author(s): Daniel Stonier , Younghun Ju , Jorge Santos Simon
autogenerated on Wed Mar 2 2022 00:26:14