src/eric7/MicroPython/WifiDialogs/WifiController.py

branch
mpy_network
changeset 9779
8d3c7c991085
parent 9776
210bf87ae5c7
child 9781
3112f77f722b
diff -r 210bf87ae5c7 -r 8d3c7c991085 src/eric7/MicroPython/WifiDialogs/WifiController.py
--- a/src/eric7/MicroPython/WifiDialogs/WifiController.py	Sat Feb 18 18:12:32 2023 +0100
+++ b/src/eric7/MicroPython/WifiDialogs/WifiController.py	Sun Feb 19 14:45:16 2023 +0100
@@ -42,13 +42,32 @@
         @rtype QMenu
         """
         wifiMenu = QMenu(self.tr("WiFi Functions"), menu)
+        wifiMenu.setTearOffEnabled(True)
         wifiMenu.addAction(self.tr("Show WiFi Status"), self.__showWifiStatus)
         wifiMenu.addSeparator()
         wifiMenu.addAction(self.tr("Connect WiFi"), self.__connectWifi)
+        wifiMenu.addAction(self.tr("Check Internet Connection"), self.__checkInternet)
         wifiMenu.addAction(self.tr("Disconnect WiFi"), self.__disconnectWifi)
+        wifiMenu.addSeparator()
+        wifiMenu.addAction(self.tr("Scan Networks"), self.__scanNetwork)
+        wifiMenu.addSeparator()
+        wifiMenu.addAction(self.tr("Write WiFi Credentials"), self.__writeCredentials)
+        wifiMenu.addAction(self.tr("Remove WiFi Credentials"), self.__removeCredentials)
+        wifiMenu.addSeparator()
+        wifiMenu.addAction(self.tr("Start WiFi Access Point"), self.__startAccessPoint)
+        wifiMenu.addAction(self.tr("Stop WiFi Access Point"), self.__stopAccessPoint)
+        wifiMenu.addSeparator()
+        wifiMenu.addAction(
+            self.tr("Deactivate Client Interface"),
+            lambda: self.__deactivateInterface("STA")
+        )
+        wifiMenu.addAction(
+            self.tr("Deactivate Access Point Interface"),
+            lambda: self.__deactivateInterface("AP")
+        )
 
         # add device specific entries (if there are any)
-        self.__device.addDeviceWifiEntries(wifiMenu)
+        self.__mpy.getDevice().addDeviceWifiEntries(wifiMenu)
 
         return wifiMenu
 
@@ -123,3 +142,68 @@
                     "<p>Reason: {0}</p>"
                 ).format(error if error else self.tr("unknown")),
             )
+
+    @pyqtSlot()
+    def __checkInternet(self):
+        """
+        Private slot to check the availability of an internet connection.
+        """
+        # TODO: not implemented yet
+        pass
+
+    @pyqtSlot()
+    def __scanNetwork(self):
+        """
+        Private slot to scan for visible WiFi networks.
+        """
+        # TODO: not implemented yet
+        pass
+
+    @pyqtSlot()
+    def __writeCredentials(self):
+        """
+        Private slot to save the WiFi login credentials to the connected device.
+
+        This will also modify the boot script to perform an automatic WiFi connection.
+        """
+        # TODO: not implemented yet
+        pass
+
+    @pyqtSlot()
+    def __removeCredentials(self):
+        """
+        Private slot to remove the saved WiFi credentials from the connected device.
+
+        This will not remove the auto-connect part of the boot script. This needs to be
+        done manually if desired.
+        """
+        # TODO: not implemented yet
+        pass
+
+    @pyqtSlot()
+    def __startAccessPoint(self):
+        """
+        Private slot to start the Access Point interface of the connected device.
+        """
+        # TODO: not implemented yet
+        pass
+
+    @pyqtSlot()
+    def __stopAccessPoint(self):
+        """
+        Private slot to stop the Access Point interface of the connected device.
+        """
+        # TODO: not implemented yet
+        pass
+
+    def __deactivateInterface(self, interface):
+        """
+        Private method to deactivate a given WiFi interface of the connected device.
+
+        @param interface designation of the interface to be deactivated (one of 'AP'
+            or 'STA')
+        @type str
+        """
+        # TODO: not implemented yet
+        pass
+

eric ide

mercurial