network: Update network_connected implementation
This commit is contained in:
parent
b9402af687
commit
976bb7ceb1
|
@ -109,6 +109,7 @@ bool network_connected(uint32_t type, const char *ssid)
|
||||||
int err;
|
int err;
|
||||||
struct network_info *info;
|
struct network_info *info;
|
||||||
struct network_info search;
|
struct network_info search;
|
||||||
|
const char *strtype;
|
||||||
|
|
||||||
search.type = type;
|
search.type = type;
|
||||||
strncpy(search.ssid, ssid, 32);
|
strncpy(search.ssid, ssid, 32);
|
||||||
|
@ -118,15 +119,15 @@ bool network_connected(uint32_t type, const char *ssid)
|
||||||
if (!info)
|
if (!info)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch(type) {
|
strtype = scan_ssid_security_to_str(type);
|
||||||
case SCAN_SSID_SECURITY_PSK:
|
if (!strtype)
|
||||||
err = storage_network_get_mtime("psk", ssid,
|
|
||||||
&info->connected_time);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
|
||||||
|
|
||||||
|
err = storage_network_touch(strtype, ssid);
|
||||||
|
if (err < 0)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
err = storage_network_get_mtime(strtype, ssid, &info->connected_time);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue