Tue, 14 Feb 2023 18:10:30 +0100
Reorganized the MicroPython code even more.
<!DOCTYPE html> <html><head> <title>eric7.MicroPython.MicroPythonDeviceInterface</title> <meta charset="UTF-8"> <link rel="stylesheet" href="styles.css"> </head> <body> <a NAME="top" ID="top"></a> <h1>eric7.MicroPython.MicroPythonDeviceInterface</h1> <p> Module implementing some file system commands for MicroPython. </p> <h3>Global Attributes</h3> <table> <tr><td>None</td></tr> </table> <h3>Classes</h3> <table> <tr> <td><a href="#MicroPythonDeviceInterface">MicroPythonDeviceInterface</a></td> <td>Class implementing some file system commands for MicroPython.</td> </tr> </table> <h3>Functions</h3> <table> <tr><td>None</td></tr> </table> <hr /> <hr /> <a NAME="MicroPythonDeviceInterface" ID="MicroPythonDeviceInterface"></a> <h2>MicroPythonDeviceInterface</h2> <p> Class implementing some file system commands for MicroPython. </p> <p> Commands are provided to perform operations on the file system of a connected MicroPython device. Supported commands are: <ul> <li>ls: directory listing</li> <li>lls: directory listing with meta data</li> <li>cd: change directory</li> <li>pwd: get the current directory</li> <li>put: copy a file to the connected device</li> <li>putData: write data to a file of the connected device</li> <li>get: get a file from the connected device</li> <li>getData: read data of a file of the connected device</li> <li>rm: remove a file from the connected device</li> <li>rmrf: remove a file/directory recursively (like 'rm -rf' in bash) <li>mkdir: create a new directory</li> <li>rmdir: remove an empty directory</li> <li>fileSystemInfo: get information about the file system </ul> </p> <p> There are additional non file systemcommands. <ul> <li>getBoardData: get information about the connected board</li> <li>getDeviceData: get version info about MicroPython and some implementation information</li> <li>getModules: get a list of built-in modules</li> <li>getTime: get the current time</li> <li>syncTime: synchronize the time of the connected device</li> <li>showTime: show the current time of the connected device</li> </ul> </p> <h3>Signals</h3> <dl> <dt>dataReceived(data)</dt> <dd> emitted to send data received via the serial connection for further processing </dd> <dt>executeAsyncFinished()</dt> <dd> emitted to indicate the end of an asynchronously executed list of commands (e.g. a script) </dd> </dl> <h3>Derived from</h3> QObject <h3>Class Attributes</h3> <table> <tr><td>None</td></tr> </table> <h3>Class Methods</h3> <table> <tr><td>None</td></tr> </table> <h3>Methods</h3> <table> <tr> <td><a href="#MicroPythonDeviceInterface.__init__">MicroPythonDeviceInterface</a></td> <td>Constructor</td> </tr> <tr> <td><a href="#MicroPythonDeviceInterface.__rawOff">__rawOff</a></td> <td>Private method to switch 'raw' mode off.</td> </tr> <tr> <td><a href="#MicroPythonDeviceInterface.__rawOn">__rawOn</a></td> <td>Private method to switch the connected device to 'raw' mode.</td> </tr> <tr> <td><a href="#MicroPythonDeviceInterface.__readSerial">__readSerial</a></td> <td>Private slot to read all available serial data and emit it with the "dataReceived" signal for further processing.</td> </tr> <tr> <td><a href="#MicroPythonDeviceInterface.connectToDevice">connectToDevice</a></td> <td>Public slot to start the manager.</td> </tr> <tr> <td><a href="#MicroPythonDeviceInterface.disconnectFromDevice">disconnectFromDevice</a></td> <td>Public slot to stop the thread.</td> </tr> <tr> <td><a href="#MicroPythonDeviceInterface.execute">execute</a></td> <td>Public method to send commands to the connected device and return the result.</td> </tr> <tr> <td><a href="#MicroPythonDeviceInterface.executeAsync">executeAsync</a></td> <td>Public method to execute a series of commands over a period of time without returning any result (asynchronous execution).</td> </tr> <tr> <td><a href="#MicroPythonDeviceInterface.handlePreferencesChanged">handlePreferencesChanged</a></td> <td>Public slot to handle a change of the preferences.</td> </tr> <tr> <td><a href="#MicroPythonDeviceInterface.isConnected">isConnected</a></td> <td>Public method to get the connection status.</td> </tr> <tr> <td><a href="#MicroPythonDeviceInterface.probeDevice">probeDevice</a></td> <td>Public method to check the device is responding.</td> </tr> <tr> <td><a href="#MicroPythonDeviceInterface.write">write</a></td> <td>Public method to write data to the connected device.</td> </tr> </table> <h3>Static Methods</h3> <table> <tr><td>None</td></tr> </table> <a NAME="MicroPythonDeviceInterface.__init__" ID="MicroPythonDeviceInterface.__init__"></a> <h4>MicroPythonDeviceInterface (Constructor)</h4> <b>MicroPythonDeviceInterface</b>(<i>parent=None</i>) <p> Constructor </p> <dl> <dt><i>parent</i> (QObject)</dt> <dd> reference to the parent object </dd> </dl> <a NAME="MicroPythonDeviceInterface.__rawOff" ID="MicroPythonDeviceInterface.__rawOff"></a> <h4>MicroPythonDeviceInterface.__rawOff</h4> <b>__rawOff</b>(<i></i>) <p> Private method to switch 'raw' mode off. </p> <a NAME="MicroPythonDeviceInterface.__rawOn" ID="MicroPythonDeviceInterface.__rawOn"></a> <h4>MicroPythonDeviceInterface.__rawOn</h4> <b>__rawOn</b>(<i></i>) <p> Private method to switch the connected device to 'raw' mode. </p> <p> Note: switching to raw mode is done with synchronous writes. </p> <dl> <dt>Return:</dt> <dd> flag indicating success @rtype bool </dd> </dl> <a NAME="MicroPythonDeviceInterface.__readSerial" ID="MicroPythonDeviceInterface.__readSerial"></a> <h4>MicroPythonDeviceInterface.__readSerial</h4> <b>__readSerial</b>(<i></i>) <p> Private slot to read all available serial data and emit it with the "dataReceived" signal for further processing. </p> <a NAME="MicroPythonDeviceInterface.connectToDevice" ID="MicroPythonDeviceInterface.connectToDevice"></a> <h4>MicroPythonDeviceInterface.connectToDevice</h4> <b>connectToDevice</b>(<i>port</i>) <p> Public slot to start the manager. </p> <dl> <dt><i>port</i> (str)</dt> <dd> name of the port to be used </dd> </dl> <dl> <dt>Return:</dt> <dd> flag indicating success </dd> </dl> <dl> <dt>Return Type:</dt> <dd> bool </dd> </dl> <a NAME="MicroPythonDeviceInterface.disconnectFromDevice" ID="MicroPythonDeviceInterface.disconnectFromDevice"></a> <h4>MicroPythonDeviceInterface.disconnectFromDevice</h4> <b>disconnectFromDevice</b>(<i></i>) <p> Public slot to stop the thread. </p> <a NAME="MicroPythonDeviceInterface.execute" ID="MicroPythonDeviceInterface.execute"></a> <h4>MicroPythonDeviceInterface.execute</h4> <b>execute</b>(<i>commands</i>) <p> Public method to send commands to the connected device and return the result. </p> <p> If no serial connection is available, empty results will be returned. </p> <dl> <dt><i>commands</i> (str or list of str)</dt> <dd> list of commands to be executed </dd> </dl> <dl> <dt>Return:</dt> <dd> tuple containing stdout and stderr output of the device </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bytes, bytes) </dd> </dl> <a NAME="MicroPythonDeviceInterface.executeAsync" ID="MicroPythonDeviceInterface.executeAsync"></a> <h4>MicroPythonDeviceInterface.executeAsync</h4> <b>executeAsync</b>(<i>commandsList</i>) <p> Public method to execute a series of commands over a period of time without returning any result (asynchronous execution). </p> <dl> <dt><i>commandsList</i> (list of bytes)</dt> <dd> list of commands to be execute on the device </dd> </dl> <a NAME="MicroPythonDeviceInterface.handlePreferencesChanged" ID="MicroPythonDeviceInterface.handlePreferencesChanged"></a> <h4>MicroPythonDeviceInterface.handlePreferencesChanged</h4> <b>handlePreferencesChanged</b>(<i></i>) <p> Public slot to handle a change of the preferences. </p> <a NAME="MicroPythonDeviceInterface.isConnected" ID="MicroPythonDeviceInterface.isConnected"></a> <h4>MicroPythonDeviceInterface.isConnected</h4> <b>isConnected</b>(<i></i>) <p> Public method to get the connection status. </p> <dl> <dt>Return:</dt> <dd> flag indicating the connection status </dd> </dl> <dl> <dt>Return Type:</dt> <dd> bool </dd> </dl> <a NAME="MicroPythonDeviceInterface.probeDevice" ID="MicroPythonDeviceInterface.probeDevice"></a> <h4>MicroPythonDeviceInterface.probeDevice</h4> <b>probeDevice</b>(<i></i>) <p> Public method to check the device is responding. </p> <p> If the device has not been flashed with a MicroPython formware, the probe will fail. </p> <dl> <dt>Return:</dt> <dd> flag indicating a communicating MicroPython device </dd> </dl> <dl> <dt>Return Type:</dt> <dd> bool </dd> </dl> <a NAME="MicroPythonDeviceInterface.write" ID="MicroPythonDeviceInterface.write"></a> <h4>MicroPythonDeviceInterface.write</h4> <b>write</b>(<i>data</i>) <p> Public method to write data to the connected device. </p> <dl> <dt><i>data</i> (bytes or bytearray)</dt> <dd> data to be written </dd> </dl> <div align="right"><a href="#top">Up</a></div> <hr /> </body></html>