Byggern
SCP Class Reference

SCP (Simple Command Protocol) is an application layer protocol designed to send commands. More...

#include <scp.h>

Public Member Functions

 SCP (Socket **sockets, uint8_t number_of_sockets)
 
void Send (uint8_t priority, uint8_t command, uint8_t *data, uint8_t length_of_data)
 
bool Receive (uint8_t &command, uint8_t *data, uint8_t &length_of_data)
 

Private Attributes

Socket ** sockets
 
uint8_t number_of_sockets
 

Detailed Description

SCP (Simple Command Protocol) is an application layer protocol designed to send commands.

The frame is built up by first one byte identifying the command, the second byte identifying the length of the data (n), and the last n bytes is the data.

This class is using Socket as its link layer implementation.

Constructor & Destructor Documentation

§ SCP()

SCP::SCP ( Socket **  sockets,
uint8_t  number_of_sockets 
)

Initializes the SCP.

Parameters
socketsAn array of sockets that you want to use.
number_of_socketsNumber of sockets in the sockets array.

Member Function Documentation

§ Receive()

bool SCP::Receive ( uint8_t &  command,
uint8_t *  data,
uint8_t &  length_of_data 
)

Check if any new messages have been received.

Parameters
dataAn array you want the data to be inserted into.
length_of_dataThe maximum data length.
Returns
Whether a command was available for reading.

§ Send()

void SCP::Send ( uint8_t  priority,
uint8_t  command,
uint8_t *  data,
uint8_t  length_of_data 
)

Sends some data with priority and command.

Parameters
priorityThe socket you want to send this data into. This number refers to the array you passed in the initializer
commandThe command you are sending. See the commands.h for a list of commands
dataAn array containing the data you are sending
length_of_dataThe length of the data array

Member Data Documentation

§ number_of_sockets

uint8_t SCP::number_of_sockets
private

The number of sockets in the sockets array.

§ sockets

Socket* * SCP::sockets
private

An array with sockets.


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