@@ -553,6 +553,13 @@ def is_busy():
553553 """
554554 return WifiService .wifi_busy
555555
556+ @staticmethod
557+ def _ensure_access_points_loaded ():
558+ if not WifiService .access_points :
559+ WifiService .access_points = mpos .config .SharedPreferences (
560+ "com.micropythonos.system.wifiservice"
561+ ).get_dict ("access_points" )
562+
556563 @staticmethod
557564 def get_saved_networks ():
558565 """
@@ -561,11 +568,7 @@ def get_saved_networks():
561568 Returns:
562569 list: List of saved SSIDs
563570 """
564- if not WifiService .access_points :
565- WifiService .access_points = mpos .config .SharedPreferences (
566- "com.micropythonos.system.wifiservice"
567- ).get_dict ("access_points" )
568-
571+ WifiService ._ensure_access_points_loaded ()
569572 return list (WifiService .access_points .keys ())
570573
571574 @staticmethod
@@ -662,10 +665,7 @@ def get_network_password(ssid):
662665 Returns:
663666 str or None: Password if found, None otherwise
664667 """
665- if not WifiService .access_points :
666- WifiService .access_points = mpos .config .SharedPreferences (
667- "com.micropythonos.system.wifiservice"
668- ).get_dict ("access_points" )
668+ WifiService ._ensure_access_points_loaded ()
669669
670670 ap = WifiService .access_points .get (ssid )
671671 if ap :
@@ -683,10 +683,7 @@ def get_network_hidden(ssid):
683683 Returns:
684684 bool: True if network is hidden, False otherwise
685685 """
686- if not WifiService .access_points :
687- WifiService .access_points = mpos .config .SharedPreferences (
688- "com.micropythonos.system.wifiservice"
689- ).get_dict ("access_points" )
686+ WifiService ._ensure_access_points_loaded ()
690687
691688 ap = WifiService .access_points .get (ssid )
692689 if ap :
0 commit comments