-
-
Save Wenomok/98b40e90e6095cf42d266053fe2fa930 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HubManager { | |
static const double SCAN_WIFI_TIMEOUT = 60.0; | |
//1 | |
static const _platform = MethodChannel('dexbee.club/HubConfig'); | |
Future<List<WiFiHubModel>> scanWiFiHubList({double timeout = FitBleKitManager.SCAN_WIFI_TIMEOUT}) async { | |
try { | |
List<WiFiHubModel> wifiModelList = []; | |
//2 | |
List<dynamic> result = await _platform.invokeMethod( | |
'scanWiFiHubList', | |
{ | |
'timeout': timeout | |
} | |
); | |
//3 | |
for(Map<dynamic, dynamic> wifiResult in result) { | |
WiFiHubModel? wifiHubModel = WiFiHubModel.parseResult(wifiResult); | |
if(wifiHubModel != null) { | |
wifiModelList.add(wifiHubModel); | |
} | |
} | |
return wifiModelList; | |
} catch(e) { | |
print(e); | |
throw e; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment