mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-13 21:48:25 +08:00
可以传回OTA地址
This commit is contained in:
@@ -288,6 +288,21 @@ exit:
|
|||||||
return err;
|
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[] = {
|
struct httpd_wsgi_call g_app_handlers[] = {
|
||||||
{ "/", HTTPD_HDR_DEFORT, 0, HttpGetIndexPage, NULL, NULL, NULL },
|
{ "/", HTTPD_HDR_DEFORT, 0, HttpGetIndexPage, NULL, NULL, NULL },
|
||||||
{ "/socket", HTTPD_HDR_DEFORT, 0, NULL, HttpSetSocketStatus, 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 },
|
{ "/wifi/scan", HTTPD_HDR_DEFORT, 0, HttpGetWifiScan, HttpSetWifiScan, NULL, NULL },
|
||||||
{ "/log", HTTPD_HDR_DEFORT, 0, HttpGetLog, NULL, NULL, NULL },
|
{ "/log", HTTPD_HDR_DEFORT, 0, HttpGetLog, NULL, NULL, NULL },
|
||||||
{ "/task", HTTPD_HDR_DEFORT, 0, HttpGetTasks, HttpAddTask, NULL, HttpDelTask },
|
{ "/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);
|
static int g_app_handlers_no = sizeof(g_app_handlers)/sizeof(struct httpd_wsgi_call);
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
.power_by{text-align:center;}
|
.power_by{text-align:center;}
|
||||||
.power_by a{text-decoration:none;}
|
.power_by a{text-decoration:none;}
|
||||||
.log_div{height:300px;overflow:scroll;}
|
.log_div{height:300px;overflow:scroll;}
|
||||||
|
.ota input{width:100%;}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -228,6 +229,15 @@
|
|||||||
<button class="submit_bt" onclick="GetSysLog()">Refresh</button>
|
<button class="submit_bt" onclick="GetSysLog()">Refresh</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class="ota">
|
||||||
|
<legend>OTA Update</legend>
|
||||||
|
<input type="text" id="ato_url" value="http://119.23.191.79/tc1/TC1@MK3031@moc.ota.bin">
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<button class="submit_bt" onclick="OtaStart()">Update</button>
|
||||||
|
<span class="status_sp success">OK</span>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<p class="power_by">power by <a id="end" href="https://github.com/zogodo/zTC1" target="_blank">github/zTC1</a></p>
|
<p class="power_by">power by <a id="end" href="https://github.com/zogodo/zTC1" target="_blank">github/zTC1</a></p>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -533,6 +543,14 @@ function DelTimedTask() {
|
|||||||
}, time);
|
}, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function OtaStart() {
|
||||||
|
ato_url = document.getElementById("ato_url").value;
|
||||||
|
SetIng(4);
|
||||||
|
HttpPost("/ota", function (re) {
|
||||||
|
SetOK(4);
|
||||||
|
}, ato_url);
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user