added callback for user defined payload handler, some dependencies
cleared
This commit is contained in:
parent
5475f5e165
commit
fc2b1879e4
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#ifndef COMPONENTS_WEBGUIAPP_INCLUDE_SYSTEMAPPLICATION_H_
|
||||
#define COMPONENTS_WEBGUIAPP_INCLUDE_SYSTEMAPPLICATION_H_
|
||||
#include "webguiapp.h"
|
||||
#include "SysConfiguration.h"
|
||||
#include "esp_err.h"
|
||||
#include "jRead.h"
|
||||
#include "jWrite.h"
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@
|
|||
|
||||
#ifndef COMPONENTS_WEBGUIAPP_INCLUDE_USERCALLBACKS_H_
|
||||
#define COMPONENTS_WEBGUIAPP_INCLUDE_USERCALLBACKS_H_
|
||||
#include "HTTPServer.h"
|
||||
|
||||
#include "webguiapp.h"
|
||||
|
||||
//Callback for current time obtain notification
|
||||
void regTimeSyncCallback(void (*time_sync)(struct timeval *tv));
|
||||
|
|
@ -38,4 +39,7 @@ void regHTTPPrintCustom(int (*print_handler)(httpd_req_t *req, char *buf, char *
|
|||
//User handler of variables 'var1=value1&var2=value2' styled in POST requests.
|
||||
void regAfterPostHandlerCustom(HTTP_IO_RESULT (*post_handler)(httpd_req_t *req, const char *filename, char *PostData));
|
||||
|
||||
//User handler for various payload types
|
||||
void regCustomPayloadTypeHandler(sys_error_code (*payload_handler)(data_message_t *MSG));
|
||||
|
||||
#endif /* COMPONENTS_WEBGUIAPP_INCLUDE_USERCALLBACKS_H_ */
|
||||
|
|
|
|||
|
|
@ -31,12 +31,10 @@
|
|||
#include "esp_log.h"
|
||||
#include "esp_event.h"
|
||||
#include "esp_netif.h"
|
||||
#include "esp_system.h"
|
||||
#include "driver/spi_master.h"
|
||||
|
||||
#include "SystemApplication.h"
|
||||
#include "UserCallbacks.h"
|
||||
#include "SysConfiguration.h"
|
||||
|
||||
|
||||
esp_err_t spi_device_polling_transmit_synchronized(spi_device_handle_t handle, spi_transaction_t *trans_desc);
|
||||
void SetAppVars( rest_var_t* appvars, int size);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,15 @@
|
|||
|
||||
#define MAX_JSON_DATA_SIZE 1024
|
||||
|
||||
//sys_error_code SysPayloadTypeVarsHandler(data_message_t *MSG)
|
||||
|
||||
sys_error_code (*CustomPayloadTypeHandler)(data_message_t *MSG);
|
||||
|
||||
void regCustomPayloadTypeHandler(sys_error_code (*payload_handler)(data_message_t *MSG))
|
||||
{
|
||||
CustomPayloadTypeHandler = payload_handler;
|
||||
}
|
||||
|
||||
static esp_err_t SHA256hmacHash(unsigned char *data,
|
||||
int datalen,
|
||||
unsigned char *key,
|
||||
|
|
@ -291,8 +300,12 @@ static sys_error_code SysDataParser(data_message_t *MSG)
|
|||
//MSG->parsedData.payload = malloc(sizeof(payload_type_vars)); Not needed for this case
|
||||
return SysPayloadTypeVarsHandler(MSG);
|
||||
break;
|
||||
|
||||
default:
|
||||
return SYS_ERROR_PARSE_PAYLOADTYPE;
|
||||
if (CustomPayloadTypeHandler)
|
||||
CustomPayloadTypeHandler(MSG);
|
||||
else
|
||||
return SYS_ERROR_PARSE_PAYLOADTYPE;
|
||||
}
|
||||
|
||||
return SYS_ERROR_UNKNOWN;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user