src/eric7/MicroPython/Devices/DeviceBase.py

branch
eric7
changeset 11236
75c26fe1d1c7
parent 11224
65b341cfab55
--- a/src/eric7/MicroPython/Devices/DeviceBase.py	Fri Apr 25 16:22:02 2025 +0200
+++ b/src/eric7/MicroPython/Devices/DeviceBase.py	Fri Apr 25 16:23:02 2025 +0200
@@ -82,6 +82,9 @@
     <li>startAccessPoint: start an access point</li>
     <li>stopAccessPoint: stop the access point</li>
     <li>getConnectedClients: get a list of connected WiFi clients</li>
+    <li>getSecurityModes: get a list of supported security modes</li>
+    <li>enableWebrepl
+    <li>disableWebrepl
     </ul>
 
     Supported Bluetooth commands are:
@@ -1911,8 +1914,8 @@
 
         @param ssid SSID of the access point (unused)
         @type str
-        @param security security method (defaults to None) (unused)
-        @type int (optional)
+        @param security security mode (defaults to None) (unused)
+        @type str (optional)
         @param password password (defaults to None) (unused)
         @type str (optional)
         @param hostname host name of the device (defaults to None) (unused)
@@ -1944,6 +1947,28 @@
         """
         return [], ""
 
+    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
+        """
+        command = """
+def getSecurityModes():
+    import network
+    modes = [s for s in dir(network.WLAN) if s.startswith('SEC_')]
+    return modes
+
+print(getSecurityModes())
+del getSecurityModes
+"""
+        out, err = self.executeCommands(command, mode=self._submitMode)
+        if err:
+            return []
+
+        return ast.literal_eval(out.decode("utf-8"))
+
     def enableWebrepl(self, password):  # noqa: U-100
         """
         Public method to write the given WebREPL password to the connected device and
@@ -1958,8 +1983,7 @@
 
     def disableWebrepl(self):
         """
-        Public method to write the given WebREPL password to the connected device and
-        modify the start script to start the WebREPL server.
+        Public method to modify the start script to not start the WebREPL server.
 
         @return tuple containing a flag indicating success and an error message
         @rtype tuple of (bool, str)

eric ide

mercurial