mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-13 21:48:25 +08:00
假设第四次获得扫描结果
This commit is contained in:
@@ -148,8 +148,10 @@ exit:
|
|||||||
|
|
||||||
static int http_get_wifi_scan(httpd_request_t *req)
|
static int http_get_wifi_scan(httpd_request_t *req)
|
||||||
{
|
{
|
||||||
|
static int n = 1;
|
||||||
OSStatus err = kNoErr;
|
OSStatus err = kNoErr;
|
||||||
send_http("OK", 2, exit, &err);
|
char* re = (n++)%4 == 0 ? "OK" : "NO";
|
||||||
|
send_http(re, 2, exit, &err);
|
||||||
exit:
|
exit:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -319,26 +319,26 @@ function SubmitNetwork() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var get_ret = false;
|
|
||||||
function Rescan() {
|
function Rescan() {
|
||||||
HttpPost("/wifi/scan", function (re) {
|
HttpPost("/wifi/scan", function (re) {
|
||||||
alert(re);
|
|
||||||
if (re == "OK") {
|
if (re == "OK") {
|
||||||
get_ret = true;
|
rescan_btn.innerHTML = "Scanning...";
|
||||||
|
rescan_btn.disabled = true;
|
||||||
window.setTimeout(GetScanResult, 1000);
|
window.setTimeout(GetScanResult, 1000);
|
||||||
|
} else {
|
||||||
|
alert(re);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var tt = 5;
|
|
||||||
function GetScanResult() {
|
function GetScanResult() {
|
||||||
HttpGet("/wifi/scan", function (re) {
|
HttpGet("/wifi/scan", function (re) {
|
||||||
console.log(re);
|
if (re == "OK") {
|
||||||
if (get_ret && tt <= 0) {
|
rescan_btn.innerHTML = "Rescan";
|
||||||
get_ret = 0
|
rescan_btn.disabled = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
window.setTimeout(GetScanResult, 1000);
|
window.setTimeout(GetScanResult, 1000);
|
||||||
tt--;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user