update component, added example mqtt user data handler
This commit is contained in:
parent
25fcc1c189
commit
b64880b57a
|
|
@ -1 +1 @@
|
||||||
Subproject commit f6515c5be8dfc5e484d2ae576cfc6e5338912231
|
Subproject commit cabc2904ea64e27dc8deb604d6b5594a048136cb
|
||||||
|
|
@ -5,5 +5,5 @@ idf_component_register(
|
||||||
SRCS main.c
|
SRCS main.c
|
||||||
HTTPPrintCustom.c
|
HTTPPrintCustom.c
|
||||||
HTTPPostCustom.c
|
HTTPPostCustom.c
|
||||||
|
MQTTCustom.c
|
||||||
)
|
)
|
||||||
|
|
|
||||||
31
main/MQTTCustom.c
Normal file
31
main/MQTTCustom.c
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*! Copyright 2022 Bogdan Pilyugin
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* \file MQTTCustom.c
|
||||||
|
* \version 1.0
|
||||||
|
* \date 2022-08-19
|
||||||
|
* \author Bogdan Pilyugin
|
||||||
|
* \brief
|
||||||
|
* \details
|
||||||
|
* \copyright Apache License, Version 2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "MQTT.h"
|
||||||
|
|
||||||
|
void UserDataHndlr(char *data, uint32_t len, int idx)
|
||||||
|
{
|
||||||
|
// Here do something with incoming mqtt data
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -6,11 +6,13 @@
|
||||||
|
|
||||||
#include "SystemConfiguration.h"
|
#include "SystemConfiguration.h"
|
||||||
#include "HTTPServer.h"
|
#include "HTTPServer.h"
|
||||||
|
#include "MQTT.h"
|
||||||
|
|
||||||
#define MANUAL_RESET 0
|
#define MANUAL_RESET 0
|
||||||
|
|
||||||
int HTTPPrintCustom(httpd_req_t *req, char *buf, char *var);
|
int HTTPPrintCustom(httpd_req_t *req, char *buf, char *var);
|
||||||
HTTP_IO_RESULT AfterPostHandlerCustom(httpd_req_t *req, const char *filename, char *PostData);
|
HTTP_IO_RESULT AfterPostHandlerCustom(httpd_req_t *req, const char *filename, char *PostData);
|
||||||
|
void UserDataHndlr(char *data, uint32_t len, int idx);
|
||||||
|
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
|
|
@ -18,6 +20,8 @@ void app_main(void)
|
||||||
WebGuiAppInit();
|
WebGuiAppInit();
|
||||||
regHTTPPrintCustom(&HTTPPrintCustom);
|
regHTTPPrintCustom(&HTTPPrintCustom);
|
||||||
regAfterPostHandlerCustom(&AfterPostHandlerCustom);
|
regAfterPostHandlerCustom(&AfterPostHandlerCustom);
|
||||||
|
regUserDataHandler(&UserDataHndlr);
|
||||||
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user