src/eric7/MicroPython/Devices/CircuitPythonDevices.py

branch
eric7
changeset 11236
75c26fe1d1c7
parent 11208
f776db7cc222
diff -r b984f0085bed -r 75c26fe1d1c7 src/eric7/MicroPython/Devices/CircuitPythonDevices.py
--- a/src/eric7/MicroPython/Devices/CircuitPythonDevices.py	Fri Apr 25 16:22:02 2025 +0200
+++ b/src/eric7/MicroPython/Devices/CircuitPythonDevices.py	Fri Apr 25 16:23:02 2025 +0200
@@ -98,16 +98,20 @@
             "WPA3_PSK": "WPA3",
             "WPA2_WPA3_PSK": "WPA2/WPA3",
         }
+
         self.__securityCode2AuthModeString = {
-            0: "[wifi.AuthMode.OPEN]",
-            1: "[wifi.AuthMode.WEP]",
-            2: "[wifi.AuthMode.WPA, wifi.AuthMode.PSK]",
-            3: "[wifi.AuthMode.WPA2, wifi.AuthMode.PSK]",
-            4: "[wifi.AuthMode.WPA, wifi.AuthMode.WPA2, wifi.AuthMode.PSK]",
-            5: "[wifi.AuthMode.WPA2, wifi.AuthMode.ENTERPRISE]",
-            6: "[wifi.AuthMode.WPA3, wifi.AuthMode.PSK]",
-            7: "[wifi.AuthMode.WPA2, wifi.AuthMode.WPA3, wifi.AuthMode.PSK]",
+            "SEC_OPEN": "[wifi.AuthMode.OPEN]",
+            "SEC_WEP": "[wifi.AuthMode.WEP]",
+            "SEC_WPA": "[wifi.AuthMode.WPA, wifi.AuthMode.PSK]",
+            "SEC_WPA2": "[wifi.AuthMode.WPA2, wifi.AuthMode.PSK]",
+            "SEC_WPA_WPA2": "[wifi.AuthMode.WPA, wifi.AuthMode.WPA2, wifi.AuthMode.PSK]",
+            # noqa: E-501
+            "SEC_WPA2_ENT": "[wifi.AuthMode.WPA2, wifi.AuthMode.ENTERPRISE]",
+            "SEC_WPA3": "[wifi.AuthMode.WPA3, wifi.AuthMode.PSK]",
+            "SEC_WPA2_WPA3": "[wifi.AuthMode.WPA2, wifi.AuthMode.WPA3, wifi.AuthMode.PSK]",
+            # noqa: E-501
         }
+
         self.__bleAddressType = {
             0: self.tr("Public"),
             1: self.tr("Random Static"),
@@ -1237,8 +1241,8 @@
 
         @param ssid SSID of the access point
         @type str
-        @param security security method (defaults to None)
-        @type int (optional)
+        @param security security mode (defaults to None) (unused)
+        @type str (optional)
         @param password password (defaults to None)
         @type str (optional)
         @param hostname host name of the device (defaults to None)
@@ -1250,7 +1254,7 @@
         @rtype tuple of (bool, str)
         """
         if security is None or password is None:
-            security = 0
+            security = "SEC_OPEN"
             password = ""  # secok
         authmode = self.__securityCode2AuthModeString[security]
 
@@ -1332,6 +1336,15 @@
             self.tr("CircuitPython does not support reporting of connected clients."),
         )
 
+    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
+        """
+        return list(self.__securityCode2AuthModeString.keys())
+
     ##################################################################
     ## Methods below implement Ethernet related methods
     ##################################################################

eric ide

mercurial