Byggern
|
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 |
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.
SCP::SCP | ( | Socket ** | sockets, |
uint8_t | number_of_sockets | ||
) |
Initializes the SCP.
sockets | An array of sockets that you want to use. |
number_of_sockets | Number of sockets in the sockets array. |
bool SCP::Receive | ( | uint8_t & | command, |
uint8_t * | data, | ||
uint8_t & | length_of_data | ||
) |
Check if any new messages have been received.
data | An array you want the data to be inserted into. |
length_of_data | The maximum data length. |
void SCP::Send | ( | uint8_t | priority, |
uint8_t | command, | ||
uint8_t * | data, | ||
uint8_t | length_of_data | ||
) |
Sends some data with priority and command.
priority | The socket you want to send this data into. This number refers to the array you passed in the initializer |
command | The command you are sending. See the commands.h for a list of commands |
data | An array containing the data you are sending |
length_of_data | The length of the data array |
|
private |
The number of sockets in the sockets array.
|
private |
An array with sockets.