src/eric7/MicroPython/Devices/EspDevices.py

branch
mpy_network
changeset 9798
4402d76c5fa9
parent 9797
3be7b2326e2c
child 9799
a79430a8811d
--- a/src/eric7/MicroPython/Devices/EspDevices.py	Fri Feb 24 14:11:20 2023 +0100
+++ b/src/eric7/MicroPython/Devices/EspDevices.py	Fri Feb 24 18:36:43 2023 +0100
@@ -665,9 +665,9 @@
         """
         Public method to get data related to the current WiFi status.
 
-        @return tuple of two dictionaries containing the WiFi status data
-            for the WiFi client and access point
-        @rtype tuple of (dict, dict)
+        @return tuple of three dictionaries containing the WiFi status data
+            for the WiFi client, access point and overall data
+        @rtype tuple of (dict, dict, dict)
         @exception OSError raised to indicate an issue with the device
         """
         command = """
@@ -708,6 +708,11 @@
             pass
     print(ujson.dumps(ap))
 
+    overall = {
+        'active': station['active'] or ap['active']
+    }
+    print(ujson.dumps(overall))
+
 wifi_status()
 del wifi_status
 """
@@ -716,9 +721,10 @@
         if err:
             raise OSError(self._shortError(err))
 
-        stationStr, apStr = out.decode("utf-8").splitlines()
+        stationStr, apStr, overallStr = out.decode("utf-8").splitlines()
         station = json.loads(stationStr)
         ap = json.loads(apStr)
+        overall = json.loads(overallStr)
         try:
             station["status"] = self.__statusTranslations[station["status"]]
         except KeyError:
@@ -727,7 +733,7 @@
             ap["status"] = self.__statusTranslations[ap["status"]]
         except KeyError:
             ap["status"] = str(ap["status"])
-        return station, ap
+        return station, ap, overall
 
     def connectWifi(self, ssid, password):
         """
@@ -760,9 +766,9 @@
 connect_wifi({0}, {1})
 del connect_wifi
 """.format(
-                repr(ssid),
-                repr(password if password else ""),
-            )
+            repr(ssid),
+            repr(password if password else ""),
+        )
 
         with EricOverrideCursor():
             out, err = self._interface.execute(command, timeout=15000)
@@ -831,7 +837,9 @@
 
 save_wifi_creds({0}, {1})
 del save_wifi_creds
-""".format(repr(ssid), repr(password) if password else "''")
+""".format(
+            repr(ssid), repr(password) if password else "''"
+        )
         bootCommand = """
 def modify_boot():
     add = True
@@ -1010,8 +1018,8 @@
 deactivate()
 del deactivate
 """.format(
-                interface
-            )
+            interface
+        )
 
         out, err = self._interface.execute(command)
         if err:
@@ -1058,8 +1066,8 @@
 start_ap({0}, {1}, {2}, {3})
 del start_ap
 """.format(
-                repr(ssid), security, repr(password), ifconfig
-            )
+            repr(ssid), security, repr(password), ifconfig
+        )
 
         out, err = self._interface.execute(command, timeout=15000)
         if err:

eric ide

mercurial