diff --git a/resources/I-CUBE-Mongoose/App/mongoose_app.c b/resources/I-CUBE-Mongoose/App/mongoose_app.c deleted file mode 100644 index 88154be7..00000000 --- a/resources/I-CUBE-Mongoose/App/mongoose_app.c +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-FileCopyrightText: 2026 Cesanta Software Limited -// SPDX-License-Identifier: GPL-2.0-only or commercial -// -// See guides: -// https://mongoose.ws/docs/guides/web-dashboard-guide/ - device dashboard - -#include "mongoose.h" - -#if MG_ARCH == MG_ARCH_UNIX || MG_ARCH == MG_ARCH_WIN32 -#define HTTP_ADDR "http://0.0.0.0:8000" -#else -#define HTTP_ADDR "http://0.0.0.0:80" -#endif - -static struct mg_mgr s_mgr; - -// Connection event handler function -static void http_ev_handler(struct mg_connection *c, int ev, void *ev_data) { - if (ev == MG_EV_HTTP_MSG) { // New HTTP request received - struct mg_http_message *hm = (struct mg_http_message *) ev_data; - if (mg_match(hm->uri, mg_str("/api/hello"), NULL)) { - mg_http_reply(c, 200, "", "{%m:%d}\n", MG_ESC("status"), 1); - } else { - mg_http_reply(c, 200, "", "Hello from Mongoose %s\n", MG_VERSION); - } - } -} -void mongoose_init(void) { - mg_mgr_init(&s_mgr); - mg_http_listen(&s_mgr, HTTP_ADDR, http_ev_handler, NULL); -} - -void mongoose_poll(void) { - mg_mgr_poll(&s_mgr, 1); -} diff --git a/resources/I-CUBE-Mongoose/Cesanta.I-CUBE-Mongoose.pdsc b/resources/I-CUBE-Mongoose/Cesanta.I-CUBE-Mongoose.pdsc index 2c42ea75..8425db95 100644 --- a/resources/I-CUBE-Mongoose/Cesanta.I-CUBE-Mongoose.pdsc +++ b/resources/I-CUBE-Mongoose/Cesanta.I-CUBE-Mongoose.pdsc @@ -7,7 +7,7 @@ License.txt https://mongoose.ws/contact/ - See https://github.com/cesanta/mongoose/releases/tag/7.21 + See https://github.com/cesanta/mongoose/releases/tag/7.21 See https://github.com/cesanta/mongoose/releases/tag/7.21 See https://github.com/cesanta/mongoose/releases/tag/7.13 @@ -21,13 +21,14 @@ - + Mongoose - TCP/IP stack + TLS + HTTP + WebSocket + MQTT + Firmware OTA - - + + + diff --git a/resources/I-CUBE-Mongoose/Makefile b/resources/I-CUBE-Mongoose/Makefile index c82e92d2..7187aa0a 100644 --- a/resources/I-CUBE-Mongoose/Makefile +++ b/resources/I-CUBE-Mongoose/Makefile @@ -1,10 +1,10 @@ -VERSION = 7.21.1 -PACKPATH = Mongoose -FILES = $(PACKPATH) App Cesanta.I-CUBE-Mongoose.pdsc License.txt Release_Notes.html +VERSION = 7.21.2 +REPO_ROOT = ../.. +FILES = Mongoose App Cesanta.I-CUBE-Mongoose.pdsc License.txt Release_Notes.html all: Cesanta.I-CUBE-Mongoose.$(VERSION).pack -Cesanta.I-CUBE-Mongoose.$(VERSION).pack: $(FILES) $(PACKPATH)/mongoose.h $(PACKPATH)/mongoose.c +Cesanta.I-CUBE-Mongoose.$(VERSION).pack: $(FILES) Mongoose/mongoose.h Mongoose/mongoose.c App/mongoose_app.c App/dashboard.html.c zip -r $@ $^ # Get packchk from https://github.com/Open-CMSIS-Pack/cmsis-toolbox @@ -13,13 +13,18 @@ check: Cesanta.I-CUBE-Mongoose.$(VERSION).pack packchk Cesanta.I-CUBE-Mongoose.pdsc License.txt: - cp ../../LICENSE $@ -$(PACKPATH): - mkdir -p $(PACKPATH) -$(PACKPATH)/mongoose.h: $(PACKPATH) - cp ../../mongoose.h $@ -$(PACKPATH)/mongoose.c: $(PACKPATH) - cp ../../mongoose.c $@ + cp $(REPO_ROOT)/LICENSE $@ +Mongoose: + mkdir -p Mongoose +App/mongoose_app.c: + cp $(REPO_ROOT)/tutorials/device-dashboard/mongoose_app.c $@ +App/dashboard.html.c: + make -C $(REPO_ROOT)/tutorials/device-dashboard dashboard.html.c + cp $(REPO_ROOT)/tutorials/device-dashboard/dashboard.html.c $@ +Mongoose/mongoose.h: Mongoose + cp $(REPO_ROOT)/mongoose.h $@ +Mongoose/mongoose.c: Mongoose + cp $(REPO_ROOT)/mongoose.c $@ clean: - rm -rf *.pack License.txt $(PACKPATH) + rm -rf *.pack License.txt Mongoose App/*.{html,js,c}