# eric7.MicroPython.Devices.GenericMicroPythonDevices

Module implementing the device interface class for generic MicroPython devices (i.e. those devices not specifically supported yet).

### Global Attributes

None

### Classes

GenericMicroPythonDevice | Class implementing the device interface for generic MicroPython boards.

### Functions

createDevice | Function to instantiate a MicroPython device object.

## GenericMicroPythonDevice

Class implementing the device interface for generic MicroPython boards.

### Derived from

BaseDevice

### Class Attributes

None

### Class Methods

None

### Methods

GenericMicroPythonDevice | Constructor
__activateBootloader | Private slot to switch the board into 'bootloader' mode.
__createGenericMenu | Private method to create the Generic submenu.
__deviceVolumeMounted | Private method to check, if the device volume is mounted.
__findWorkspace | Private method to find the workspace directory.
__firmwareVersionResponse | Private slot handling the response of the latest version request.
__resetDevice | Private slot to reset the connected device.
__showFirmwareVersions | Private slot to show the firmware version of the connected device and the available firmware version.
_getSetTimeCode | Protected method to get the device code to set the time.
addDeviceMenuEntries | Public method to add device specific entries to the given menu.
canRunScript | Public method to determine, if a script can be executed.
canStartFileManager | Public method to determine, if a File Manager can be started.
canStartPlotter | Public method to determine, if a Plotter can be started.
canStartRepl | Public method to determine, if a REPL can be started.
deviceName | Public method to get the name of the device.
getDocumentationUrl | Public method to get the device documentation URL.
getFirmwareUrl | Public method to get the device firmware download URL.
getWorkspace | Public method to get the workspace directory.
runScript | Public method to run the given Python script.
setButtons | Public method to enable the supported action buttons.
supportsLocalFileAccess | Public method to indicate file access via a local directory.

### Static Methods

None

#### GenericMicroPythonDevice (Constructor)

GenericMicroPythonDevice(microPythonWidget, deviceType, vid, pid, parent=None)

Constructor

microPythonWidget (MicroPythonWidget)
  reference to the main MicroPython widget
deviceType (str)
  device type assigned to this device interface
vid (int)
  vendor ID
pid (int)
  product ID
parent (QObject)
  reference to the parent object

#### GenericMicroPythonDevice.__activateBootloader

__activateBootloader()

Private slot to switch the board into 'bootloader' mode.

#### GenericMicroPythonDevice.__createGenericMenu

__createGenericMenu()

Private method to create the Generic submenu.

#### GenericMicroPythonDevice.__deviceVolumeMounted

__deviceVolumeMounted()

Private method to check, if the device volume is mounted.

Return:
  flag indicated a mounted device

Return Type:
  bool

#### GenericMicroPythonDevice.__findWorkspace

__findWorkspace(silent=False)

Private method to find the workspace directory.

silent (bool)
  flag indicating silent operations

Return:
  workspace directory used for saving files

Return Type:
  str

#### GenericMicroPythonDevice.__firmwareVersionResponse

__firmwareVersionResponse(reply)

Private slot handling the response of the latest version request.

reply (QNetworkReply)
  reference to the reply object

#### GenericMicroPythonDevice.__resetDevice

__resetDevice()

Private slot to reset the connected device.

#### GenericMicroPythonDevice.__showFirmwareVersions

__showFirmwareVersions()

Private slot to show the firmware version of the connected device and the available firmware version.

#### GenericMicroPythonDevice._getSetTimeCode

_getSetTimeCode()

Protected method to get the device code to set the time.

Note: This method must be implemented in the various device specific subclasses.

Return:
  code to be executed on the connected device to set the time

Return Type:
  str

#### GenericMicroPythonDevice.addDeviceMenuEntries

addDeviceMenuEntries(menu)

Public method to add device specific entries to the given menu.

menu (QMenu)
  reference to the context menu

#### GenericMicroPythonDevice.canRunScript

canRunScript()

Public method to determine, if a script can be executed.

Return:
  tuple containing a flag indicating it is safe to start a Plotter and a reason why it cannot.

Return Type:
  tuple of (bool, str)

#### GenericMicroPythonDevice.canStartFileManager

canStartFileManager()

Public method to determine, if a File Manager can be started.

Return:
  tuple containing a flag indicating it is safe to start a File Manager and a reason why it cannot.

Return Type:
  tuple of (bool, str)

#### GenericMicroPythonDevice.canStartPlotter

canStartPlotter()

Public method to determine, if a Plotter can be started.

Return:
  tuple containing a flag indicating it is safe to start a Plotter and a reason why it cannot.

Return Type:
  tuple of (bool, str)

#### GenericMicroPythonDevice.canStartRepl

canStartRepl()

Public method to determine, if a REPL can be started.

Return:
  tuple containing a flag indicating it is safe to start a REPL and a reason why it cannot.

Return Type:
  tuple of (bool, str)

#### GenericMicroPythonDevice.deviceName

deviceName()

Public method to get the name of the device.

Return:
  name of the device

Return Type:
  str

#### GenericMicroPythonDevice.getDocumentationUrl

getDocumentationUrl()

Public method to get the device documentation URL.

Return:
  documentation URL of the device

Return Type:
  str

#### GenericMicroPythonDevice.getFirmwareUrl

getFirmwareUrl()

Public method to get the device firmware download URL.

Return:
  firmware download URL of the device

Return Type:
  str

#### GenericMicroPythonDevice.getWorkspace

getWorkspace(silent=False)

Public method to get the workspace directory.

silent (bool)
  flag indicating silent operations

Return:
  workspace directory used for saving files

Return Type:
  str

#### GenericMicroPythonDevice.runScript

runScript(script)

Public method to run the given Python script.

script (str)
  script to be executed

#### GenericMicroPythonDevice.setButtons

setButtons()

Public method to enable the supported action buttons.

#### GenericMicroPythonDevice.supportsLocalFileAccess

supportsLocalFileAccess()

Public method to indicate file access via a local directory.

Return:
  flag indicating file access via local directory

Return Type:
  bool

Up

## createDevice

createDevice(microPythonWidget, deviceType, vid, pid, _boardName, _serialNumber)

Function to instantiate a MicroPython device object.

microPythonWidget (MicroPythonWidget)
  reference to the main MicroPython widget
deviceType (str)
  device type assigned to this device interface
vid (int)
  vendor ID
pid (int)
  product ID
_boardName (str)
  name of the board (unused)
_serialNumber (str)
  serial number of the board (unused)

Return:
  reference to the instantiated device object

Return Type:
  GenericMicroPythonDevice

Up