Arduino KVComm
master
Key-Value pair communication library for Arduino
|
Go to the documentation of this file.
3 #include <AH/STL/algorithm>
4 #include <AH/STL/utility>
9 #include <boost/integer.hpp>
25 template <
class Sender>
70 size_t write(
const uint8_t *data,
size_t len);
93 template <
class Sender,
class CRC>
128 using checksum_t =
typename boost::uint_t<CRC::bit_count>::least;
133 return sender.beginPacket();
145 constexpr
size_t numChars =
sizeof(
checksum_t);
146 uint8_t buffer[numChars];
148 memcpy(buffer, &checksum, numChars);
149 std::reverse(std::begin(buffer), std::end(buffer));
150 return sender.write(buffer, numChars) +
sender.endPacket();
154 size_t write(
const uint8_t *data,
size_t len);
Class for sending SLIP packets.
SLIPSender(Sender &&sender)
Constructor with sender initialization.
size_t write(const uint8_t *data, size_t len)
Write some data as the body of a packet.
typename boost::uint_t< CRC::bit_count >::least checksum_t
The integer type of the checksum.
size_t endPacket()
Finish the packet.
size_t beginPacket()
Start a packet.
SLIPSenderCRC()=default
Default constructor.
SLIPSender()=default
Default constructor.
SLIPSender< Sender > sender
size_t write(const uint8_t *data, size_t len)
Write some data as the body of a packet.
size_t beginPacket()
Start a packet.
size_t endPacket()
Finish the packet.
SLIPSenderCRC(CRC &&crc)
Constructor with CRC initialization.
SLIPSenderCRC(Sender &&sender, CRC &&crc)
Constructor with sender and CRC initialization.
Class for sending SLIP packets with a CRC checksum to check the integrity of the packets.
const static uint8_t END
indicates end of packet
SLIPSenderCRC(Sender &&sender)
Constructor with sender initialization.