diff --git a/zanzocam/web_ui/pages.py b/zanzocam/web_ui/pages.py index 2bd69b0..b54c321 100644 --- a/zanzocam/web_ui/pages.py +++ b/zanzocam/web_ui/pages.py @@ -6,7 +6,7 @@ from flask import render_template -from zanzocam.web_ui.utils import read_network_data, read_setup_data_file, read_flag_file, read_log_file, clear_logs +from zanzocam.web_ui.utils import read_network_data, read_setup_data_file, read_flag_file, read_log_file, clear_logs, get_available_wifis from zanzocam.webcam.system import get_wifi_data from zanzocam.constants import * @@ -26,10 +26,12 @@ def home_page(): def network_page(): """ The page with the network forms """ network_data = read_network_data() + wifi_list = get_available_wifis() return render_template("network.html", title="Setup Rete", version=VERSION, - network_data=network_data) + network_data=network_data, + wifi_list=wifi_list) def server_page(): """ The page with the server data forms """ diff --git a/zanzocam/web_ui/templates/network.html b/zanzocam/web_ui/templates/network.html index 1eda05b..c77eced 100644 --- a/zanzocam/web_ui/templates/network.html +++ b/zanzocam/web_ui/templates/network.html @@ -4,40 +4,15 @@
- - - - - -
- - -
-
@@ -46,6 +21,19 @@ +
+ +
+

Reti Wifi Visibili

+ {% if wifi_list %} + {% for wifi in wifi_list %} +

{{ wifi }}

+ {% endfor %} + {% else %} +

Nessun WiFi disponibile

+ {% endif %} +
+
diff --git a/zanzocam/web_ui/utils.py b/zanzocam/web_ui/utils.py index a0d7337..22ec69e 100644 --- a/zanzocam/web_ui/utils.py +++ b/zanzocam/web_ui/utils.py @@ -36,6 +36,21 @@ def read_network_data(): return {"type": "WiFi", "ssid": ssid, "password": password} +def get_available_wifis(): + return [ + 'Quality=31/70 Signal level=-79 dBm ESSID:"MEO-4FD250"', + 'Quality=33/70 Signal level=-77 dBm ESSID:"MEO-WiFi"', + 'Quality=41/70 Signal level=-69 dBm ESSID:"TP-Link_773C"', + 'Quality=26/70 Signal level=-84 dBm ESSID:"ROCHA_SANTOS"', + 'Quality=26/70 Signal level=-84 dBm ESSID:"MEO-WiFi"', + 'Quality=69/70 Signal level=-41 dBm ESSID:"Tarallini"', + 'Quality=34/70 Signal level=-76 dBm ESSID:"NOS-3280"', + 'Quality=24/70 Signal level=-86 dBm ESSID:"DIRECT-BD-HP DeskJet 2700 series"', + 'Quality=18/70 Signal level=-92 dBm ESSID:"Extender-WiFi-8d8f"', + 'Quality=26/70 Signal level=-84 dBm ESSID:"NOWO-97E5B"' + ] + + def _read_data_file(path: Path, default: str, action: Callable, catch_errors: bool=True): """ Reads the given file, applies the action lambda and returns the result.