--- a/src/eric7/MicroPython/Devices/DeviceBase.py Sat Feb 18 09:21:42 2023 +0100 +++ b/src/eric7/MicroPython/Devices/DeviceBase.py Sat Feb 18 10:11:44 2023 +0100 @@ -93,6 +93,9 @@ if connected: with contextlib.suppress(OSError): self._deviceData = self.__getDeviceData() + self._deviceData["wifi"], self._deviceData["wifi_type"] = self.hasWifi() + self._deviceData["bluetooth"] = self.hasBluetooth() + self._deviceData["ethernet"] = self.hasEthernet() def getDeviceType(self): """ @@ -103,14 +106,19 @@ """ return self._deviceType - def getDeviceData(self): + def getDeviceData(self, key=None): """ Public method to get a copy of the determined device data. + @param key name of the data to get (None to get all data) (defaults to None) + @type str (optional) @return dictionary containing the essential device data @rtype dict """ - return copy.deepcopy(self._deviceData) + if key is None: + return copy.deepcopy(self._deviceData) + else: + return self._deviceData[key] def checkDeviceData(self): """ @@ -1147,6 +1155,65 @@ if err: raise OSError(self._shortError(err)) + ################################################################## + ## Methods below implement WiFi related methods + ################################################################## + + def hasWifi(self): + """ + Public method to check the availability of WiFi. + + @return tuple containing a flag indicating the availability of WiFi + and the WiFi type (picow or pimoroni) + @rtype tuple of (bool, str) + @exception OSError raised to indicate an issue with the device + """ + return False, "" + + def getWifiData(self): + """ + Public method to get data related to the current WiFi status + + @return tuple of two dictionaries containing the WiFi status data + for the WiFi client and access point + @rtype tuple of (dict, dict) + """ + return {}, {} + + def addDeviceWifiEntries(self, menu): + """ + Public method to add device specific entries to the given menu. + + @param menu reference to the context menu + @type QMenu + """ + pass + + ################################################################## + ## Methods below implement Ethernet related methods + ################################################################## + + def hasEthernet(self): + """ + Public method to check the availability of Ethernet. + + @return flag indicating the availability of Ethernet + @rtype bool + """ + return False + + ################################################################## + ## Methods below implement Bluetooth related methods + ################################################################## + + def hasBluetooth(self): + """ + Public method to check the availability of Bluetooth. + + @return flag indicating the availability of Bluetooth + @rtype bool + """ + return False # # eflag: noqa = M613