|
@@ -83,7 +83,8 @@ public class MainActivity extends FlutterActivity {
|
|
// System.out.println("获取扫描列表");
|
|
// System.out.println("获取扫描列表");
|
|
// System.out.println(scanResults);
|
|
// System.out.println(scanResults);
|
|
// System.out.println("-----------------------------");
|
|
// System.out.println("-----------------------------");
|
|
- List<Map<String,String>> wifiList = new ArrayList<>();
|
|
|
|
|
|
+// List<Map<String,String>> wifiList = new ArrayList<>();
|
|
|
|
+ JSONObject response = new JSONObject();
|
|
for (ScanResult scanResult : scanResults) {
|
|
for (ScanResult scanResult : scanResults) {
|
|
if(!scanResult.SSID.equals("endo-lighting")){
|
|
if(!scanResult.SSID.equals("endo-lighting")){
|
|
continue;
|
|
continue;
|
|
@@ -92,16 +93,17 @@ public class MainActivity extends FlutterActivity {
|
|
wifi.put("ssid",scanResult.SSID);
|
|
wifi.put("ssid",scanResult.SSID);
|
|
wifi.put("bssid",scanResult.BSSID);
|
|
wifi.put("bssid",scanResult.BSSID);
|
|
wifi.put("level", String.valueOf(scanResult.level));
|
|
wifi.put("level", String.valueOf(scanResult.level));
|
|
- wifiList.add(wifi);
|
|
|
|
- }
|
|
|
|
- JSONObject response = new JSONObject();
|
|
|
|
- try {
|
|
|
|
- response.put("cmd","scanResult");
|
|
|
|
- response.put("data",wifiList);
|
|
|
|
- } catch (JSONException e) {
|
|
|
|
- throw new RuntimeException(e);
|
|
|
|
|
|
+ try {
|
|
|
|
+ response.put("cmd","scanResult");
|
|
|
|
+ response.put("data",wifi);
|
|
|
|
+ } catch (JSONException e) {
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
+ }
|
|
|
|
+ EventChannelPlugin.getInstance().sendEventData(response.toString());
|
|
|
|
+// wifiList.add(wifi);
|
|
}
|
|
}
|
|
- EventChannelPlugin.getInstance().sendEventData(response.toString());
|
|
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
private void checkAndRequestPermissions() {
|
|
private void checkAndRequestPermissions() {
|