Home ⌂Doc Index ◂Up ▴

eric6.MicroPython.MicroPythonCommandsInterface

Module implementing some file system commands for MicroPython.

Global Attributes

None

Classes

MicroPythonCommandsInterface Class implementing some file system commands for MicroPython.

Functions

None


MicroPythonCommandsInterface

Class implementing some file system commands for MicroPython.

Commands are provided to perform operations on the file system of a connected MicroPython device. Supported commands are:

There are additional commands related to time and version.

Signals

dataReceived(data)
emitted to send data received via the serial connection for further processing
executeAsyncFinished()
emitted to indicate the end of an asynchronously executed list of commands (e.g. a script)

Derived from

QObject

Class Attributes

None

Class Methods

None

Methods

MicroPythonCommandsInterface Constructor
__rawOff Private method to switch 'raw' mode off.
__rawOn Private method to switch the connected device to 'raw' mode.
__readSerial Private slot to read all available serial data and emit it with the "dataReceived" signal for further processing.
__shortError Private method to create a shortened error message.
cd Public method to change the current directory on the connected device.
connectToDevice Public slot to start the manager.
disconnectFromDevice Public slot to stop the thread.
execute Public method to send commands to the connected device and return the result.
executeAsync Public method to execute a series of commands over a period of time without returning any result (asynchronous execution).
fileSystemInfo Public method to obtain information about the currently mounted file systems.
get Public method to copy a file from the connected device.
getImplementation Public method to get some implementation information of the connected device.
getTime Public method to get the current time of the device.
handlePreferencesChanged Public slot to handle a change of the preferences.
isConnected Public method to get the connection status.
lls Public method to get a long directory listing of the connected device including meta data.
ls Public method to get a directory listing of the connected device.
mkdir Public method to create a new directory.
put Public method to copy a local file to the connected device.
pwd Public method to get the current directory of the connected device.
remainingTask
rm Public method to remove a file from the connected device.
rmdir Public method to remove a directory.
rmrf Public method to remove a file or directory recursively.
syncTime Public method to set the time of the connected device to the local computer's time.
version Public method to get the MicroPython version information of the connected device.
write Public method to write data to the connected device.

Static Methods

None

MicroPythonCommandsInterface (Constructor)

MicroPythonCommandsInterface(parent=None)

Constructor

parent (QObject)
reference to the parent object

MicroPythonCommandsInterface.__rawOff

__rawOff()

Private method to switch 'raw' mode off.

MicroPythonCommandsInterface.__rawOn

__rawOn()

Private method to switch the connected device to 'raw' mode.

Note: switching to raw mode is done with synchronous writes.

Returns:
flag indicating success @rtype bool

MicroPythonCommandsInterface.__readSerial

__readSerial()

Private slot to read all available serial data and emit it with the "dataReceived" signal for further processing.

MicroPythonCommandsInterface.__shortError

__shortError(error)

Private method to create a shortened error message.

error (bytes)
verbose error message
Returns:
shortened error message
Return Type:
str

MicroPythonCommandsInterface.cd

cd(dirname)

Public method to change the current directory on the connected device.

dirname (str)
directory to change to
Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.connectToDevice

connectToDevice(port)

Public slot to start the manager.

port (str)
name of the port to be used
Returns:
flag indicating success
Return Type:
bool

MicroPythonCommandsInterface.disconnectFromDevice

disconnectFromDevice()

Public slot to stop the thread.

MicroPythonCommandsInterface.execute

execute(commands)

Public method to send commands to the connected device and return the result.

If no serial connection is available, empty results will be returned.

commands (str)
list of commands to be executed
Returns:
tuple containing stdout and stderr output of the device
Return Type:
tuple of (bytes, bytes)

MicroPythonCommandsInterface.executeAsync

executeAsync(commandsList)

Public method to execute a series of commands over a period of time without returning any result (asynchronous execution).

commandsList (list of bytes)
list of commands to be execute on the device

MicroPythonCommandsInterface.fileSystemInfo

fileSystemInfo()

Public method to obtain information about the currently mounted file systems.

Returns:
tuple of tuples containing the file system name, the total size, the used size and the free size
Return Type:
tuple of tuples of (str, int, int, int)
Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.get

get(deviceFileName, hostFileName=None)

Public method to copy a file from the connected device.

deviceFileName (str)
name of the file to copy
hostFileName (str)
name of the file to copy to
Returns:
flag indicating success
Return Type:
bool
Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.getImplementation

getImplementation()

Public method to get some implementation information of the connected device.

Returns:
dictionary containing the implementation information
Return Type:
dict
Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.getTime

getTime()

Public method to get the current time of the device.

Returns:
time of the device
Return Type:
str
Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.handlePreferencesChanged

handlePreferencesChanged()

Public slot to handle a change of the preferences.

MicroPythonCommandsInterface.isConnected

isConnected()

Public method to get the connection status.

Returns:
flag indicating the connection status
Return Type:
bool

MicroPythonCommandsInterface.lls

lls(dirname="", fullstat=False, showHidden=False)

Public method to get a long directory listing of the connected device including meta data.

dirname (str)
name of the directory to be listed
fullstat (bool)
flag indicating to return the full stat() tuple
showHidden (bool)
flag indicating to show hidden files as well
Returns:
list containing the directory listing with tuple entries of the name and and a tuple of mode, size and time (if fullstat is false) or the complete stat() tuple. 'None' is returned in case the directory doesn't exist.
Return Type:
tuple of (str, tuple)
Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.ls

ls(dirname="")

Public method to get a directory listing of the connected device.

dirname (str)
name of the directory to be listed
Returns:
tuple containg the directory listing
Return Type:
tuple of str
Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.mkdir

mkdir(dirname)

Public method to create a new directory.

dirname (str)
name of the directory to create
Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.put

put(hostFileName, deviceFileName=None)

Public method to copy a local file to the connected device.

hostFileName (str)
name of the file to be copied
deviceFileName (str)
name of the file to copy to
Returns:
flag indicating success
Return Type:
bool
Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.pwd

pwd()

Public method to get the current directory of the connected device.

Returns:
current directory
Return Type:
str
Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.remainingTask

remainingTask()

MicroPythonCommandsInterface.rm

rm(filename)

Public method to remove a file from the connected device.

filename (str)
name of the file to be removed
Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.rmdir

rmdir(dirname)

Public method to remove a directory.

dirname (str)
name of the directory to be removed
Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.rmrf

rmrf(name, recursive=False, force=False)

Public method to remove a file or directory recursively.

name (str)
of the file or directory to remove
recursive (bool)
flag indicating a recursive deletion
force (bool)
flag indicating to ignore errors
Returns:
flag indicating success
Return Type:
bool
Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.syncTime

syncTime()

Public method to set the time of the connected device to the local computer's time.

Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.version

version()

Public method to get the MicroPython version information of the connected device.

Returns:
dictionary containing the version information
Return Type:
dict
Raises IOError:
raised to indicate an issue with the device

MicroPythonCommandsInterface.write

write(data)

Public method to write data to the connected device.

data (bytes or bytearray)
data to be written
Up



Home ⌂Doc Index ◂Up ▴