From a86f55d837795a28dfe07c8afd0d6fe28b50b39e Mon Sep 17 00:00:00 2001 From: zogodo <742782908@qq.com> Date: Thu, 9 Jan 2020 20:42:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E4=BC=A0=E5=9B=9EOTA?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TC1/http_server/app_httpd.c | 16 ++++++++++++++++ TC1/http_server/index.html | 18 ++++++++++++++++++ TC1/http_server/web_data.c | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/TC1/http_server/app_httpd.c b/TC1/http_server/app_httpd.c index f34d0d8..8893028 100644 --- a/TC1/http_server/app_httpd.c +++ b/TC1/http_server/app_httpd.c @@ -288,6 +288,21 @@ exit: return err; } +static int OtaStart(httpd_request_t *req) +{ + OSStatus err = kNoErr; + char buf[64] = { 0 }; + err = httpd_get_data(req, buf, 64); + require_noerr(err, exit); + + app_httpd_log("OtaStart ota_url[%s]", buf); + //user_ota_start(buf, NULL); + + send_http("OK", 2, exit, &err); +exit: + return err; +} + struct httpd_wsgi_call g_app_handlers[] = { { "/", HTTPD_HDR_DEFORT, 0, HttpGetIndexPage, NULL, NULL, NULL }, { "/socket", HTTPD_HDR_DEFORT, 0, NULL, HttpSetSocketStatus, NULL, NULL }, @@ -297,6 +312,7 @@ struct httpd_wsgi_call g_app_handlers[] = { { "/wifi/scan", HTTPD_HDR_DEFORT, 0, HttpGetWifiScan, HttpSetWifiScan, NULL, NULL }, { "/log", HTTPD_HDR_DEFORT, 0, HttpGetLog, NULL, NULL, NULL }, { "/task", HTTPD_HDR_DEFORT, 0, HttpGetTasks, HttpAddTask, NULL, HttpDelTask }, + { "/ota", HTTPD_HDR_DEFORT, 0, NULL, OtaStart, NULL, NULL }, }; static int g_app_handlers_no = sizeof(g_app_handlers)/sizeof(struct httpd_wsgi_call); diff --git a/TC1/http_server/index.html b/TC1/http_server/index.html index 9bf364d..8bd2d77 100644 --- a/TC1/http_server/index.html +++ b/TC1/http_server/index.html @@ -38,6 +38,7 @@ .power_by{text-align:center;} .power_by a{text-decoration:none;} .log_div{height:300px;overflow:scroll;} + .ota input{width:100%;}
@@ -228,6 +229,15 @@ + +power by github/zTC1