Connectino Library
Public Member Functions | Protected Member Functions | List of all members
ConnectinoModule Class Referenceabstract

Binuart module. More...

#include <ConnectinoModule.h>

Inheritance diagram for ConnectinoModule:
ConnectinoAjax ConnectinoArrowConnect ConnectinoBinuart ConnectinoMqtt ConnectinoNet ConnectinoWlan

Public Member Functions

void begin ()
 Starts the module.
 
virtual bool moduleCallback (uint8_t subId, uint8_t reqId, uint16_t dataSize, uint8_t *data)=0
 Callback function for serial frames of the Binuart module. More...
 
virtual uint8_t getModId ()=0
 Return the modules ID. More...
 

Protected Member Functions

bool append (uint8_t **buffer, uint16_t *bufferSize, const char data[], const uint8_t numOfSizeBytes=1)
 Append a string to the frames payload. More...
 
bool append (uint8_t **buffer, uint16_t *bufferSize, const uint8_t data[], const uint16_t dataSize, const uint8_t numOfSizeBytes=1)
 Append binary data to the frames payload. More...
 
bool append (uint8_t **buffer, uint16_t *bufferSize, const bool data)
 Append a boolean to the frames payload. More...
 
bool append (uint8_t **buffer, uint16_t *bufferSize, const uint8_t data)
 Append a uint8_t variable to the frames payload. More...
 
bool append (uint8_t **buffer, uint16_t *bufferSize, const uint16_t data)
 Append a uint16_t variable to the frames payload. More...
 
bool append (uint8_t **buffer, uint16_t *bufferSize, const uint32_t data)
 Append a uint32_t variable to the frames payload. More...
 

Detailed Description

Binuart module.

This is the abstract base class for all modules of the Connectino library. All Connectino library classes are derived from this base class. It also contains useful helper functions for building the frames for the WiFi module.

Member Function Documentation

◆ moduleCallback()

virtual bool ConnectinoModule::moduleCallback ( uint8_t  subId,
uint8_t  reqId,
uint16_t  dataSize,
uint8_t *  data 
)
pure virtual

Callback function for serial frames of the Binuart module.

This function will be called for messages sent by the WiFi module which are targeted at the Binuart module.

Parameters
subIdSub ID of the message.
reqIdRequest ID of the message.
dataSizeSize of the received data.
dataReference to the received data.
Return values
Themodule needs to return true if the frame should be kept in the buffer. If true is returned, incoming frames will be discarded.
Note
This virtual function needs to be implemented by the derived child class.

Implemented in ConnectinoWlan, ConnectinoNet, ConnectinoArrowConnect, ConnectinoMqtt, ConnectinoAjax, and ConnectinoBinuart.

◆ getModId()

virtual uint8_t ConnectinoModule::getModId ( )
pure virtual

Return the modules ID.

This function needs to return the ID of the module.

Return values
IDof the module.
Note
This virtual function needs to be implemented by the derived child class.

Implemented in ConnectinoWlan, ConnectinoNet, ConnectinoArrowConnect, ConnectinoMqtt, ConnectinoAjax, and ConnectinoBinuart.

◆ append() [1/6]

bool ConnectinoModule::append ( uint8_t **  buffer,
uint16_t *  bufferSize,
const char  data[],
const uint8_t  numOfSizeBytes = 1 
)
protected

Append a string to the frames payload.

This function will append a string to the payload of the frame that is currently built and compute the remaining buffer size and set the buffer pointer to the next free byte in the buffer.

Parameters
bufferCurrent frame buffer.
bufferSizeCurrent size of the buffer.
dataThe string which should be appended.
numOfSizeBytesOptional parameter to define the length of the size information the string is prepended with, since the strings in the frames are not null terminated.
Return values
Trueif success, false otherwise.

◆ append() [2/6]

bool ConnectinoModule::append ( uint8_t **  buffer,
uint16_t *  bufferSize,
const uint8_t  data[],
const uint16_t  dataSize,
const uint8_t  numOfSizeBytes = 1 
)
protected

Append binary data to the frames payload.

This function will append binary data to the payload of the frame that is currently built and compute the remaining buffer size and set the buffer pointer to the next free byte in the buffer.

Parameters
bufferCurrent frame buffer.
bufferSizeCurrent size of the buffer.
dataThe binary data which should be appended.
dataSizeSize of the binary data.
numOfSizeBytesOptional parameter to define the length of the size information the data is prepended with.
Return values
Trueif success, false otherwise.

◆ append() [3/6]

bool ConnectinoModule::append ( uint8_t **  buffer,
uint16_t *  bufferSize,
const bool  data 
)
protected

Append a boolean to the frames payload.

This function will append a boolean to the payload of the frame that is currently built and compute the remaining buffer size and set the buffer pointer to the next free byte in the buffer.

Parameters
bufferCurrent frame buffer.
bufferSizeCurrent size of the buffer.
dataThe boolean which should be appended.
Return values
Trueif success, false otherwise.

◆ append() [4/6]

bool ConnectinoModule::append ( uint8_t **  buffer,
uint16_t *  bufferSize,
const uint8_t  data 
)
protected

Append a uint8_t variable to the frames payload.

This function will append a uint8_t to the payload of the frame that is currently built and compute the remaining buffer size and set the buffer pointer to the next free byte in the buffer.

Parameters
bufferCurrent frame buffer.
bufferSizeCurrent size of the buffer.
dataThe uint8_t variable which should be appended.
Return values
Trueif success, false otherwise.

◆ append() [5/6]

bool ConnectinoModule::append ( uint8_t **  buffer,
uint16_t *  bufferSize,
const uint16_t  data 
)
protected

Append a uint16_t variable to the frames payload.

This function will append a uint16_t to the payload of the frame that is currently built and compute the remaining buffer size and set the buffer pointer to the next free byte in the buffer.

Parameters
bufferCurrent frame buffer.
bufferSizeCurrent size of the buffer.
dataThe uint16_t variable which should be appended.
Return values
Trueif success, false otherwise.

◆ append() [6/6]

bool ConnectinoModule::append ( uint8_t **  buffer,
uint16_t *  bufferSize,
const uint32_t  data 
)
protected

Append a uint32_t variable to the frames payload.

This function will append a uint32_t to the payload of the frame that is currently built and compute the remaining buffer size and set the buffer pointer to the next free byte in the buffer.

Parameters
bufferCurrent frame buffer.
bufferSizeCurrent size of the buffer.
dataThe uint32_t variable which should be appended.
Return values
Trueif success, false otherwise.

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