wifiScan method
Implementation
Future<List<WiFiInfo>> wifiScan({bool cache = true, int timeout = 5}) async {
if (cache == true) {
return wifiList;
}
//get_wifi_scan_result
//wifi_scan
bool ret = await _command.writeCgi("wifi_scan.cgi?", timeout: timeout);
if (ret) {
CommandResult result =
await _command.waitCommandResult((int cmd, Uint8List data) {
return cmd == 24618;
}, timeout);
if (result.isSuccess) {
Map data = result.getMap();
if (data == null) {
bool ret2 = await _command.writeCgi("get_wifi_scan_result.cgi?",
timeout: timeout);
if (ret2) {
CommandResult result2 =
await _command.waitCommandResult((int cmd, Uint8List data) {
return cmd == 24584;
}, timeout);
if (result2.isSuccess) {
Map data2 = result2.getMap();
_setWIfiInfo(data2);
}
}
} else {
_setWIfiInfo(data);
}
}
}
return wifiList;
}