diff --git a/components/WebGUIAppComponent b/components/WebGUIAppComponent index f6515c5..cabc290 160000 --- a/components/WebGUIAppComponent +++ b/components/WebGUIAppComponent @@ -1 +1 @@ -Subproject commit f6515c5be8dfc5e484d2ae576cfc6e5338912231 +Subproject commit cabc2904ea64e27dc8deb604d6b5594a048136cb diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index d97a3e2..e7cc461 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -5,5 +5,5 @@ idf_component_register( SRCS main.c HTTPPrintCustom.c HTTPPostCustom.c - + MQTTCustom.c ) diff --git a/main/MQTTCustom.c b/main/MQTTCustom.c new file mode 100644 index 0000000..972b9df --- /dev/null +++ b/main/MQTTCustom.c @@ -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 + + +} diff --git a/main/main.c b/main/main.c index 42c17c9..0d4bc92 100644 --- a/main/main.c +++ b/main/main.c @@ -6,11 +6,13 @@ #include "SystemConfiguration.h" #include "HTTPServer.h" +#include "MQTT.h" #define MANUAL_RESET 0 int HTTPPrintCustom(httpd_req_t *req, char *buf, char *var); 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) { @@ -18,6 +20,8 @@ void app_main(void) WebGuiAppInit(); regHTTPPrintCustom(&HTTPPrintCustom); regAfterPostHandlerCustom(&AfterPostHandlerCustom); + regUserDataHandler(&UserDataHndlr); + while (true) {