src/eric7/MicroPython/Devices/RP2Devices.py

branch
eric7
changeset 11237
c1c31b861d54
parent 11236
75c26fe1d1c7
child 11240
c48c615c04a3
diff -r 75c26fe1d1c7 -r c1c31b861d54 src/eric7/MicroPython/Devices/RP2Devices.py
--- a/src/eric7/MicroPython/Devices/RP2Devices.py	Fri Apr 25 16:23:02 2025 +0200
+++ b/src/eric7/MicroPython/Devices/RP2Devices.py	Sat Apr 26 11:58:15 2025 +0200
@@ -85,13 +85,13 @@
                 2: "WPA",
                 3: "WPA2",
                 4: "WPA/WPA2",
-                5: "WPA2 (CCMP)",
+                5: "WPA2",
                 6: "WPA3",
                 7: "WPA2/WPA3",
             },
             "picowireless": {
                 2: "WPA",
-                4: "WPA2 (CCMP)",
+                4: "WPA2",
                 5: "WEP",
                 7: self.tr("open", "open WiFi network"),
                 8: self.tr("automatic"),
@@ -663,6 +663,7 @@
         'connected': pw.get_connection_status() == 8,
         'status': pw.get_connection_status(),
         'mac': ubinascii.hexlify(pw.get_mac_address(), ':').decode(),
+        'ap_security': pw.get_current_encryption_type(),
     }
     if ap['active']:
         ap['essid'] = pw.get_current_ssid()
@@ -724,10 +725,25 @@
                 station["ap_security"] = self.tr("unknown ({0})").format(
                     station["ap_security"]
                 )
-        if "ap_security" in ap and self._deviceData["wifi_type"] == "picow":
-            try:
-                ap["ap_security"] = self.__securityMapping[ap["ap_security"]]
-            except KeyError:
+        if "ap_security" in ap:
+            if self._deviceData["wifi_type"] == "picow":
+                try:
+                    ap["ap_security"] = self.__securityMapping[ap["ap_security"]]
+                except KeyError:
+                    ap["ap_security"] = self.tr("unknown ({0})").format(
+                        ap["ap_security"]
+                    )
+            elif self._deviceData["wifi_type"] == "picowireless":
+                # translate the numerical AP security to a string
+                try:
+                    ap["ap_security"] = self.__securityTranslations["picowireless"][
+                        ap["ap_security"]
+                    ]
+                except KeyError:
+                    ap["ap_security"] = self.tr("unknown ({0})").format(
+                        ap["ap_security"]
+                    )
+            else:
                 ap["ap_security"] = self.tr("unknown ({0})").format(ap["ap_security"])
 
         return station, ap, overall
@@ -1361,6 +1377,19 @@
         else:
             return super().stopAccessPoint()
 
+    def getSecurityModes(self):
+        """
+        Public method to get a list of security modes supported by the device.
+
+        @return list of supported security modes
+        @rtype list of str
+        """
+        if self._deviceData["wifi_type"] == "picowireless":
+            # Pimoroni picowireless supports just WPA2 in AP mode.
+            return ["SEC_WPA2"]
+        else:
+            return super().getSecurityModes()
+
     def getConnectedClients(self):
         """
         Public method to get a list of connected clients.

eric ide

mercurial