diff -r c1e298e5c588 -r c9244db5566a src/eric7/MicroPython/Devices/DeviceBase.py --- a/src/eric7/MicroPython/Devices/DeviceBase.py Mon Mar 06 17:03:40 2023 +0100 +++ b/src/eric7/MicroPython/Devices/DeviceBase.py Tue Mar 07 16:22:07 2023 +0100 @@ -76,6 +76,13 @@ <li>stopAccessPoint: stop the access point</li> <li>getConnectedClients: get a list of connected WiFi clients</li> </ul> + + Supported Bluetooth commands are: + <ul> + <li>hasBluetooth: check, if the board has Bluetooth functionality</li> + <li>getBluetoothStatus: get Bluetooth status data</li> + <li>deactivateBluetoothInterface: deactivate a Bluetooth interface</li> + </ul> """ def __init__(self, microPythonWidget, deviceType, parent=None): @@ -1466,6 +1473,62 @@ """ return False + def addDeviceBluetoothEntries(self, menu): + """ + Public method to add device specific entries to the given menu. + + @param menu reference to the context menu + @type QMenu + """ + pass + + def getBluetoothStatus(self): + """ + Public method to get Bluetooth status data of the connected board. + + @return list of tuples containing the translated status data label and + the associated value + @rtype list of tuples of (str, str) + """ + return [] + + def activateBluetoothInterface(self): + """ + Public method to activate the Bluetooth interface. + + @return flag indicating the new state of the Bluetooth interface + @rtype bool + """ + return False + + def deactivateBluetoothInterface(self): + """ + Public method to deactivate the Bluetooth interface. + + @return flag indicating the new state of the Bluetooth interface + @rtype bool + """ + return False + + ################################################################## + ## Methods below implement some utility methods + ################################################################## + + def bool2str(self, val, capitalized=True): + """ + Public method to generate a yes/no string given a truth value. + + @param val truth value to be converted + @type bool + @param capitalized flag indicating a capitalized variant + @type bool + @return string with 'yes' or 'no' + @rtype str + """ + if capitalized: + return self.tr("Yes") if val else self.tr("No") + else: + return self.tr("yes") if val else self.tr("no") # # eflag: noqa = M613