Provides simple packet finder which may be consist of stx, etx, payload, ... More...
#include <packet_finder.hpp>
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 |
Provides simple packet finder which may be consist of stx, etx, payload, ...
Usage:
Definition at line 78 of file packet_finder.hpp.
typedef ecl::PushAndPop<unsigned char> kobuki::PacketFinderBase::BufferType |
Definition at line 91 of file packet_finder.hpp.
Enumerator | |
---|---|
clearBuffer | |
waitingForStx | |
waitingForPayloadSize | |
waitingForPayloadToEtx | |
waitingForEtx |
Definition at line 93 of file packet_finder.hpp.
kobuki::PacketFinderBase::PacketFinderBase | ( | ) |
Default constructor. Use with configure().
Definition at line 31 of file packet_finder.cpp.
|
inlinevirtual |
Definition at line 123 of file packet_finder.hpp.
|
virtual |
Reimplemented in kobuki::PacketFinder.
Definition at line 77 of file packet_finder.cpp.
void kobuki::PacketFinderBase::clear | ( | ) |
Definition at line 66 of file packet_finder.cpp.
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.
void kobuki::PacketFinderBase::enableVerbose | ( | ) |
Definition at line 72 of file packet_finder.cpp.
void kobuki::PacketFinderBase::getBuffer | ( | BufferType & | bufferRef | ) |
Definition at line 114 of file packet_finder.cpp.
void kobuki::PacketFinderBase::getPayload | ( | BufferType & | bufferRef | ) |
Definition at line 119 of file packet_finder.cpp.
unsigned int kobuki::PacketFinderBase::numberOfDataToRead | ( | ) |
Definition at line 82 of file packet_finder.cpp.
|
virtual |
Checks for incoming packets.
incoming | |
numberOfIncoming |
Definition at line 135 of file packet_finder.cpp.
|
protected |
Definition at line 282 of file packet_finder.cpp.
|
protected |
Definition at line 317 of file packet_finder.cpp.
|
protected |
Definition at line 229 of file packet_finder.cpp.
|
protected |
Definition at line 208 of file packet_finder.cpp.
|
protected |
Definition at line 114 of file packet_finder.hpp.
|
protected |
Definition at line 113 of file packet_finder.hpp.
|
protected |
Definition at line 118 of file packet_finder.hpp.
|
protected |
Definition at line 118 of file packet_finder.hpp.
|
protected |
Definition at line 110 of file packet_finder.hpp.
|
protected |
Definition at line 105 of file packet_finder.hpp.
|
protected |
Definition at line 106 of file packet_finder.hpp.
|
protected |
Definition at line 108 of file packet_finder.hpp.
|
protected |
Definition at line 109 of file packet_finder.hpp.
|
protected |
Definition at line 104 of file packet_finder.hpp.
enum packetFinderState kobuki::PacketFinderBase::state |
Definition at line 101 of file packet_finder.hpp.
|
protected |
Definition at line 112 of file packet_finder.hpp.
|
protected |
Definition at line 107 of file packet_finder.hpp.
|
protected |
Definition at line 116 of file packet_finder.hpp.