Arduino KVComm  master
Key-Value pair communication library for Arduino
Public Member Functions | Private Attributes | List of all members
SLIPSender< Sender > Class Template Reference

Class for sending SLIP packets. More...

#include <SLIPStream/SLIPSender.hpp>

Collaboration diagram for SLIPSender< Sender >:

Public Member Functions

 SLIPSender ()=default
 Default constructor. More...
 
 SLIPSender (Sender &&sender)
 Constructor with sender 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

Sender sender
 

Detailed Description

template<class Sender>
class SLIPSender< Sender >

Class for sending SLIP packets.

Template Parameters
SenderThe 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)

Definition at line 26 of file SLIPSender.hpp.

Constructor & Destructor Documentation

◆ SLIPSender() [1/2]

SLIPSender ( )
default

Default constructor.

◆ SLIPSender() [2/2]

SLIPSender ( Sender &&  sender)
inline

Constructor with sender initialization.

Parameters
senderInitialization for the sender. Perfect forwarding is used.

Definition at line 38 of file SLIPSender.hpp.

Member Function Documentation

◆ beginPacket()

size_t beginPacket ( )
inline

Start a packet.

Sends a SLIP END character to flush the buffer of the receiver.

Returns
The number of bytes sent by the Sender.

Definition at line 48 of file SLIPSender.hpp.

◆ endPacket()

size_t endPacket ( )
inline

Finish the packet.

Sends a SLIP END character.

Returns
The number of bytes sent by the Sender.

Definition at line 56 of file SLIPSender.hpp.

◆ write()

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.

Parameters
dataA pointer to the data to send.
lenThe number of bytes to send.
Returns
The number of bytes sent by the Sender.

Definition at line 4 of file SLIPSender.ipp.

Member Data Documentation

◆ sender

Sender sender
private

Definition at line 73 of file SLIPSender.hpp.


The documentation for this class was generated from the following files: