#include <vesc_packet_factory.h>
Class for creating VESC packets from raw data.
Definition at line 46 of file vesc_packet_factory.h.
Delete copy constructor and equals operator.
vesc_driver::VescPacketFactory::VescPacketFactory |
( |
| ) |
|
|
private |
VescPacketPtr vesc_driver::VescPacketFactory::createPacket |
( |
const Buffer::const_iterator & |
begin, |
|
|
const Buffer::const_iterator & |
end, |
|
|
int * |
num_bytes_needed, |
|
|
std::string * |
what |
|
) |
| |
|
static |
Create a VescPacket from a buffer (factory function). Packet must start (start of frame character) at begin
and complete (end of frame character) before *p end. The buffer element at end
is not examined, i.e. it can be the past-the-end element. Only returns a packet if the packet is valid, i.e. valid size, matching checksum, complete etc. An empty pointer is returned if a packet cannot be found or if it is invalid. If a valid packet is not found, optional output parameter is set to a string providing a reason why a packet was not found. If a packet was not found because additional bytes are needed on the buffer, optional output parameter num_bytes_needed
will contain the number of bytes needed to either determine the size of the packet or complete the packet. Output parameters num_bytes_needed
and what
will be set to 0 and empty if a valid packet is found.
- Parameters
-
begin[in] | Iterator to a buffer at the start-of-frame character |
end[in] | Iterator to the buffer past-the-end element. |
num_bytes_needed[out] | Number of bytes needed to determine the packet size or complete the frame. |
what[out] | Human readable string giving a reason why the packet was not found. |
- Returns
- Pointer to a valid VescPacket if successful. Otherwise, an empty pointer.
Definition at line 63 of file vesc_packet_factory.cpp.
Return the global factory object
void vesc_driver::VescPacketFactory::registerPacketType |
( |
int |
payload_id, |
|
|
CreateFn |
fn |
|
) |
| |
|
static |
The documentation for this class was generated from the following files: