--- a/src/eric7/MicroPython/WifiDialogs/WifiController.py Thu Feb 23 13:31:55 2023 +0100 +++ b/src/eric7/MicroPython/WifiDialogs/WifiController.py Fri Feb 24 14:11:20 2023 +0100 @@ -57,6 +57,9 @@ wifiMenu.addSeparator() wifiMenu.addAction(self.tr("Start WiFi Access Point"), self.__startAccessPoint) wifiMenu.addAction( + self.tr("Start WiFi Access Point with IP"), self.__startAccessPointIP + ) + wifiMenu.addAction( self.tr("Show Connected Clients"), self.__showConnectedClients ) wifiMenu.addAction(self.tr("Stop WiFi Access Point"), self.__stopAccessPoint) @@ -256,23 +259,34 @@ ) @pyqtSlot() - def __startAccessPoint(self): + def __startAccessPoint(self, withIP=False): """ Private slot to start the Access Point interface of the connected device. + + @param withIP flag indicating to start the access point with an IP configuration + @type bool """ from .WifiApConfigDialog import WifiApConfigDialog - dlg = WifiApConfigDialog() + dlg = WifiApConfigDialog(withIP=withIP) if dlg.exec() == QDialog.DialogCode.Accepted: - ssid, password, security, remember = dlg.getApConfig() + ssid, password, security, remember, ifconfig = dlg.getApConfig() if remember: Preferences.setMicroPython("WifiApName", ssid) Preferences.setMicroPython("WifiApPassword", password) Preferences.setMicroPython("WifiApAuthMode", security) + if withIP: + Preferences.setMicroPython("WifiApAddress", ifconfig[0]) + Preferences.setMicroPython("WifiApNetmask", ifconfig[1]) + Preferences.setMicroPython("WifiApGateway", ifconfig[2]) + Preferences.setMicroPython("WifiApDNS", ifconfig[3]) ok, err = self.__mpy.getDevice().startAccessPoint( - ssid, security=security, password=password + ssid, + security=security, + password=password, + ifconfig=ifconfig if withIP else None, ) if ok: EricMessageBox.information( @@ -293,6 +307,14 @@ ) @pyqtSlot() + def __startAccessPointIP(self): + """ + Private slot to start the Access Point interface of the connected device + with given IP parameters. + """ + self.__startAccessPoint(withIP=True) + + @pyqtSlot() def __stopAccessPoint(self): """ Private slot to stop the Access Point interface of the connected device.