ip, mask, gateway

This commit is contained in:
zogodo
2019-09-28 20:27:59 +08:00
parent 8c451a8f0e
commit fd1e7402f5
3 changed files with 31 additions and 6 deletions

View File

@@ -67,15 +67,32 @@ exit:
return err;
}
#define TC1_STATUS_JSON "{'sockets':'%s','mode':%d,'station_ssid':'%s','station_pwd':'%s','ap_ssid':'%s','ap_pwd':'%s'}"
#define TC1_STATUS_JSON \
"{\
'sockets':'%s',\
'mode':%d,\
'station_ssid':'%s',\
'station_pwd':'%s',\
'ap_ssid':'%s',\
'ap_pwd':'%s',\
'ip':'%s',\
'mask':'%s',\
'gateway':'%s'\
}"
static int http_get_tc1_status(httpd_request_t *req)
{
OSStatus err = kNoErr;
const unsigned char* sockets = get_socket_status();
char* ap_name = "TC1-AP";
char* ap_pwd = "12345678";
char* ip = "192.168.33.222";
char* mask = "255.255.255.0";
char* gateway = "192.168.33.1";
char* tc1_status = malloc(256);
sprintf(tc1_status, TC1_STATUS_JSON, sockets, (int)sys_config->micoSystemConfig.reserved,
sys_config->micoSystemConfig.ssid, sys_config->micoSystemConfig.user_key, "TC1-AP", "123456");
sys_config->micoSystemConfig.ssid, sys_config->micoSystemConfig.user_key,
ap_name, ap_pwd, ip, mask, gateway);
err = httpd_send_all_header(req, HTTP_RES_200, strlen(tc1_status), HTTP_CONTENT_HTML_STR);
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http socket_status headers."));

View File

@@ -165,15 +165,15 @@
<table>
<tr>
<td class="right">IP:</td>
<td class="info">192.168.33.108</td>
<td class="info" id="ip"></td>
</tr>
<tr>
<td class="right">Mask:</td>
<td class="info">255.255.255.0</td>
<td class="info" id="mask"></td>
</tr>
<tr>
<td class="right">Gateway:</td>
<td class="info">192.168.33.1</td>
<td class="info" id="gateway"></td>
</tr>
</table>
</fieldset>
@@ -220,6 +220,10 @@ var pswd_ipt = document.getElementById("pswd");
var mode_rd1 = document.getElementById("mode1");
var mode_rd2 = document.getElementById("mode2");
var info_ip = document.getElementById("ip");
var info_mask = document.getElementById("mask");
var info_gateway = document.getElementById("gateway");
var mode = -1;
var ap_name = "";
var ap_pswd = "";
@@ -237,6 +241,10 @@ HttpGet("/status", function (re) {
ap_pswd = status.ap_pwd;
//mode = status.mode;
ChangeMode(status.mode);
info_ip.innerHTML = status.ip
info_mask.innerHTML = status.mask
info_gateway.innerHTML = status.gateway
}
});

File diff suppressed because one or more lines are too long