Arduino KVComm
master
Key-Value pair communication library for Arduino
|
Class for sending SLIP packets with a CRC checksum to check the integrity of the packets. More...
#include <SLIPStream/SLIPSender.hpp>
Public Types | |
using | checksum_t = typename boost::uint_t< CRC::bit_count >::least |
The integer type of the checksum. More... | |
Public Member Functions | |
SLIPSenderCRC ()=default | |
Default constructor. More... | |
SLIPSenderCRC (Sender &&sender) | |
Constructor with sender initialization. More... | |
SLIPSenderCRC (CRC &&crc) | |
Constructor with CRC initialization. More... | |
SLIPSenderCRC (Sender &&sender, CRC &&crc) | |
Constructor with sender and CRC initialization. More... | |
size_t | beginPacket () |
Start a packet. More... | |
size_t | endPacket () |
Finish the packet. More... | |
size_t | write (const uint8_t *data, size_t len) |
Write some data as the body of a packet. More... | |
Private Attributes | |
SLIPSender< Sender > | sender |
CRC | crc |
Class for sending SLIP packets with a CRC checksum to check the integrity of the packets.
Sender | The functor that actually sends a byte over the transmission channel. Takes a single byte as an argument and returns the number of bytes written (similar to Serial.write(uint8_t) ): size_t sender(uint8_t byte) |
CRC | The CRC type to use. |
Definition at line 94 of file SLIPSender.hpp.
using checksum_t = typename boost::uint_t<CRC::bit_count>::least |
The integer type of the checksum.
Definition at line 128 of file SLIPSender.hpp.
|
default |
Default constructor.
|
inline |
Constructor with sender initialization.
sender | Initialization for the sender. Perfect forwarding is used. The CRC is default-initialized. |
Definition at line 107 of file SLIPSender.hpp.
|
inline |
Constructor with CRC initialization.
crc | Initialization for the CRC. Perfect forwarding is used. The sender is default-initialized. |
Definition at line 115 of file SLIPSender.hpp.
|
inline |
Constructor with sender and CRC initialization.
sender | Initialization for the sender. Perfect forwarding is used. |
crc | Initialization for the CRC. Perfect forwarding is used. |
Definition at line 124 of file SLIPSender.hpp.
|
inline |
Start a packet.
Sends a SLIP END character to flush the buffer of the receiver.
Definition at line 131 of file SLIPSender.hpp.
|
inline |
Finish the packet.
Encodes and sends the checksum of all data sent using the write function, followed by a SLIP END character.
Definition at line 144 of file SLIPSender.hpp.
size_t write | ( | const uint8_t * | data, |
size_t | len | ||
) |
Write some data as the body of a packet.
The data is encoded by SLIP before sending, so arbitrary binary data can be sent.
data | A pointer to the data to send. |
len | The number of bytes to send. |
Definition at line 47 of file SLIPSender.ipp.
|
private |
Definition at line 157 of file SLIPSender.hpp.
|
private |
Definition at line 158 of file SLIPSender.hpp.