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) |
| 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:
@code
Definition at line 71 of file packet_finder.hpp.
| typedef ecl::PushAndPop<unsigned char> kobuki::PacketFinderBase::BufferType |
Definition at line 74 of file packet_finder.hpp.
Definition at line 76 of file packet_finder.hpp.
Default constructor. Use with configure().
Definition at line 26 of file packet_finder.cpp.
| virtual kobuki::PacketFinderBase::~PacketFinderBase | ( | ) | [inline, virtual] |
Definition at line 106 of file packet_finder.hpp.
| bool kobuki::PacketFinderBase::checkSum | ( | ) | [virtual] |
Reimplemented in kobuki::PacketFinder.
Definition at line 72 of file packet_finder.cpp.
| void kobuki::PacketFinderBase::clear | ( | void | ) |
Definition at line 61 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 36 of file packet_finder.cpp.
Definition at line 67 of file packet_finder.cpp.
| void kobuki::PacketFinderBase::getBuffer | ( | BufferType & | bufferRef | ) |
Definition at line 109 of file packet_finder.cpp.
| unsigned int kobuki::PacketFinderBase::numberOfDataToRead | ( | ) |
Definition at line 77 of file packet_finder.cpp.
| bool kobuki::PacketFinderBase::update | ( | const unsigned char * | incoming, |
| unsigned int | numberOfIncoming | ||
| ) | [virtual] |
Checks for incoming packets.
| incoming | |
| numberOfIncoming |
Definition at line 121 of file packet_finder.cpp.
| bool kobuki::PacketFinderBase::waitForEtx | ( | const unsigned char | incoming, |
| bool & | foundPacket | ||
| ) | [protected] |
Definition at line 268 of file packet_finder.cpp.
| bool kobuki::PacketFinderBase::waitForPayloadAndEtx | ( | const unsigned char * | incoming, |
| unsigned int | numberOfIncoming, | ||
| bool & | foundPacket | ||
| ) | [protected] |
Definition at line 303 of file packet_finder.cpp.
| bool kobuki::PacketFinderBase::waitForPayloadSize | ( | const unsigned char * | incoming, |
| unsigned int | numberOfIncoming | ||
| ) | [protected] |
Definition at line 215 of file packet_finder.cpp.
| bool kobuki::PacketFinderBase::WaitForStx | ( | const unsigned char | datum | ) | [protected] |
Definition at line 194 of file packet_finder.cpp.
BufferType kobuki::PacketFinderBase::buffer [protected] |
Definition at line 97 of file packet_finder.hpp.
BufferType kobuki::PacketFinderBase::ETX [protected] |
Definition at line 96 of file packet_finder.hpp.
ecl::Signal<const std::string&> kobuki::PacketFinderBase::sig_error [protected] |
Definition at line 101 of file packet_finder.hpp.
ecl::Signal<const std::string&> kobuki::PacketFinderBase::sig_warn [protected] |
Definition at line 101 of file packet_finder.hpp.
unsigned int kobuki::PacketFinderBase::size_checksum_field [protected] |
Definition at line 93 of file packet_finder.hpp.
unsigned int kobuki::PacketFinderBase::size_etx [protected] |
Definition at line 88 of file packet_finder.hpp.
unsigned int kobuki::PacketFinderBase::size_length_field [protected] |
Definition at line 89 of file packet_finder.hpp.
unsigned int kobuki::PacketFinderBase::size_max_payload [protected] |
Definition at line 91 of file packet_finder.hpp.
unsigned int kobuki::PacketFinderBase::size_payload [protected] |
Definition at line 92 of file packet_finder.hpp.
unsigned int kobuki::PacketFinderBase::size_stx [protected] |
Definition at line 87 of file packet_finder.hpp.
Definition at line 84 of file packet_finder.hpp.
BufferType kobuki::PacketFinderBase::STX [protected] |
Definition at line 95 of file packet_finder.hpp.
bool kobuki::PacketFinderBase::variable_size_payload [protected] |
Definition at line 90 of file packet_finder.hpp.
bool kobuki::PacketFinderBase::verbose [protected] |
Definition at line 99 of file packet_finder.hpp.