EnigmaIOT  0.9.8
Secure sensor and gateway platform based on ESP8266 and ESP32
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GatewayAPI Class Reference

#include <GatewayAPI.h>

Public Member Functions

void begin ()
 Starts REST API web server. More...
 

Protected Member Functions

void getNodeNumber (AsyncWebServerRequest *request)
 Processes node number request. More...
 
void getMaxNodes (AsyncWebServerRequest *request)
 Processes max node number request. More...
 
void getNodes (AsyncWebServerRequest *request)
 Processes node list request. More...
 
void nodeOp (AsyncWebServerRequest *request)
 Processes node information request. More...
 
void getGwInfo (AsyncWebServerRequest *request)
 Processes gateway information request. More...
 
void restartGw (AsyncWebServerRequest *request)
 Processes gateway restart request. More...
 
void resetGw (AsyncWebServerRequest *request)
 Processes gateway configuration reset request. More...
 
void restartNode (AsyncWebServerRequest *request)
 Processes node information request. More...
 
void onNotFound (AsyncWebServerRequest *request)
 Processes unknown entry points or methods. More...
 
NodegetNodeFromParam (AsyncWebServerRequest *request)
 Gets node reference from request parameters. More...
 
const char * deleteNode (Node *node, int &resultCode)
 Processes node deletion request. More...
 
char * getNodeInfo (Node *node, int &resultCode, char *nodeInfo, size_t len)
 Builds node info. More...
 
char * buildGwInfo (char *gwInfo, size_t len)
 Builds gateway info. More...
 
bool restartNodeRequest (Node *node)
 Sends restart node message. More...
 

Protected Attributes

AsyncWebServer * server
 Web server instance. More...
 

Detailed Description

Definition at line 25 of file GatewayAPI.h.

Member Function Documentation

◆ begin()

void GatewayAPI::begin ( )

Starts REST API web server.

Definition at line 28 of file GatewayAPI.cpp.

◆ buildGwInfo()

char * GatewayAPI::buildGwInfo ( char *  gwInfo,
size_t  len 
)
protected

Builds gateway info.

Parameters
gwInfoGateway information JSON
lenJSON length

Definition at line 54 of file GatewayAPI.cpp.

◆ deleteNode()

const char * GatewayAPI::deleteNode ( Node node,
int &  resultCode 
)
protected

Processes node deletion request.

Parameters
nodeNode to delete
resultCodeResult code

Definition at line 140 of file GatewayAPI.cpp.

◆ getGwInfo()

void GatewayAPI::getGwInfo ( AsyncWebServerRequest *  request)
protected

Processes gateway information request.

Parameters
requestGateway information request

Definition at line 78 of file GatewayAPI.cpp.

◆ getMaxNodes()

void GatewayAPI::getMaxNodes ( AsyncWebServerRequest *  request)
protected

Processes max node number request.

Parameters
requestMax node number request

Definition at line 251 of file GatewayAPI.cpp.

◆ getNodeFromParam()

Node * GatewayAPI::getNodeFromParam ( AsyncWebServerRequest *  request)
protected

Gets node reference from request parameters.

Parameters
requestRequest with node parameter (NodeID, Name or MAC address)

Definition at line 92 of file GatewayAPI.cpp.

◆ getNodeInfo()

char * GatewayAPI::getNodeInfo ( Node node,
int &  resultCode,
char *  nodeInfo,
size_t  len 
)
protected

Builds node info.

Parameters
nodeNode to get info from
resultCodeResult code
nodeInfoNode information JSON element
lenJSON length

Definition at line 155 of file GatewayAPI.cpp.

◆ getNodeNumber()

void GatewayAPI::getNodeNumber ( AsyncWebServerRequest *  request)
protected

Processes node number request.

Parameters
requestNode number request

Definition at line 46 of file GatewayAPI.cpp.

◆ getNodes()

void GatewayAPI::getNodes ( AsyncWebServerRequest *  request)
protected

Processes node list request.

Parameters
requestNode list request

Definition at line 325 of file GatewayAPI.cpp.

◆ nodeOp()

void GatewayAPI::nodeOp ( AsyncWebServerRequest *  request)
protected

Processes node information request.

Parameters
requestNode information request

Definition at line 219 of file GatewayAPI.cpp.

◆ onNotFound()

void GatewayAPI::onNotFound ( AsyncWebServerRequest *  request)
protected

Processes unknown entry points or methods.

Parameters
requestRequest

Definition at line 378 of file GatewayAPI.cpp.

◆ resetGw()

void GatewayAPI::resetGw ( AsyncWebServerRequest *  request)
protected

Processes gateway configuration reset request.

Parameters
requestGateway configuration reset request

Definition at line 292 of file GatewayAPI.cpp.

◆ restartGw()

void GatewayAPI::restartGw ( AsyncWebServerRequest *  request)
protected

Processes gateway restart request.

Parameters
requestGateway restart request

Definition at line 259 of file GatewayAPI.cpp.

◆ restartNode()

void GatewayAPI::restartNode ( AsyncWebServerRequest *  request)
protected

Processes node information request.

Parameters
requestNode information request

Definition at line 198 of file GatewayAPI.cpp.

◆ restartNodeRequest()

bool GatewayAPI::restartNodeRequest ( Node node)
protected

Sends restart node message.

Parameters
nodeNode te send restart to

Definition at line 194 of file GatewayAPI.cpp.

Member Data Documentation

◆ server

AsyncWebServer* GatewayAPI::server
protected

Web server instance.

Definition at line 27 of file GatewayAPI.h.


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