src/eric7/Documentation/Source/eric7.MicroPython.MicroPythonSerialPort.html

Wed, 26 Mar 2025 19:46:41 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 26 Mar 2025 19:46:41 +0100
branch
eric7
changeset 11190
f5ffdf0164ab
parent 10479
856476537696
permissions
-rw-r--r--

MicroPython
- Added the capability to show the sha256 hash of a device file.

<!DOCTYPE html>
<html><head>
<title>eric7.MicroPython.MicroPythonSerialPort</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<a NAME="top" ID="top"></a>
<h1>eric7.MicroPython.MicroPythonSerialPort</h1>
<p>
Module implementing a QSerialPort with additional functionality for
MicroPython devices.
</p>

<h3>Global Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>

<h3>Classes</h3>
<table>
<tr>
<td><a href="#MicroPythonSerialPort">MicroPythonSerialPort</a></td>
<td>Class implementing a QSerialPort with additional functionality for MicroPython devices.</td>
</tr>
</table>

<h3>Functions</h3>
<table>
<tr><td>None</td></tr>
</table>

<hr />
<hr />
<a NAME="MicroPythonSerialPort" ID="MicroPythonSerialPort"></a>
<h2>MicroPythonSerialPort</h2>
<p>
    Class implementing a QSerialPort with additional functionality for
    MicroPython devices.
</p>

<h3>Derived from</h3>
QSerialPort
<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="#MicroPythonSerialPort.__init__">MicroPythonSerialPort</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#MicroPythonSerialPort.closeSerialLink">closeSerialLink</a></td>
<td>Public method to close the open serial connection.</td>
</tr>
<tr>
<td><a href="#MicroPythonSerialPort.hasTimedOut">hasTimedOut</a></td>
<td>Public method to check, if the last 'readUntil' has timed out.</td>
</tr>
<tr>
<td><a href="#MicroPythonSerialPort.isConnected">isConnected</a></td>
<td>Public method to get the connection state.</td>
</tr>
<tr>
<td><a href="#MicroPythonSerialPort.openSerialLink">openSerialLink</a></td>
<td>Public method to open a serial link to a given serial port.</td>
</tr>
<tr>
<td><a href="#MicroPythonSerialPort.readUntil">readUntil</a></td>
<td>Public method to read data until an expected sequence is found (default: \n) or a specific size is exceeded.</td>
</tr>
<tr>
<td><a href="#MicroPythonSerialPort.setTimeout">setTimeout</a></td>
<td>Public method to set the timeout for device operations.</td>
</tr>
</table>

<h3>Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>


<a NAME="MicroPythonSerialPort.__init__" ID="MicroPythonSerialPort.__init__"></a>
<h4>MicroPythonSerialPort (Constructor)</h4>
<b>MicroPythonSerialPort</b>(<i>timeout=10000, parent=None</i>)
<p>
        Constructor
</p>

<dl>

<dt><i>timeout</i> (int)</dt>
<dd>
timout in milliseconds to be set
</dd>
<dt><i>parent</i> (QObject)</dt>
<dd>
reference to the parent object
</dd>
</dl>
<a NAME="MicroPythonSerialPort.closeSerialLink" ID="MicroPythonSerialPort.closeSerialLink"></a>
<h4>MicroPythonSerialPort.closeSerialLink</h4>
<b>closeSerialLink</b>(<i></i>)
<p>
        Public method to close the open serial connection.
</p>

<a NAME="MicroPythonSerialPort.hasTimedOut" ID="MicroPythonSerialPort.hasTimedOut"></a>
<h4>MicroPythonSerialPort.hasTimedOut</h4>
<b>hasTimedOut</b>(<i></i>)
<p>
        Public method to check, if the last 'readUntil' has timed out.
</p>

<dl>
<dt>Return:</dt>
<dd>
flag indicating a timeout
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="MicroPythonSerialPort.isConnected" ID="MicroPythonSerialPort.isConnected"></a>
<h4>MicroPythonSerialPort.isConnected</h4>
<b>isConnected</b>(<i></i>)
<p>
        Public method to get the connection state.
</p>

<dl>
<dt>Return:</dt>
<dd>
flag indicating the connection state
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="MicroPythonSerialPort.openSerialLink" ID="MicroPythonSerialPort.openSerialLink"></a>
<h4>MicroPythonSerialPort.openSerialLink</h4>
<b>openSerialLink</b>(<i>port</i>)
<p>
        Public method to open a serial link to a given serial port.
</p>

<dl>

<dt><i>port</i> (str)</dt>
<dd>
port name to connect to
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating success and an error message
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
tuple of (bool, str)
</dd>
</dl>
<a NAME="MicroPythonSerialPort.readUntil" ID="MicroPythonSerialPort.readUntil"></a>
<h4>MicroPythonSerialPort.readUntil</h4>
<b>readUntil</b>(<i>expected=b"\n", size=None, timeout=0</i>)
<p>
        Public method to read data until an expected sequence is found
        (default: \n) or a specific size is exceeded.
</p>

<dl>

<dt><i>expected</i> (bytes (optional))</dt>
<dd>
expected bytes sequence (defaults to \n)
</dd>
<dt><i>size</i> (int (optional))</dt>
<dd>
maximum data to be read (defaults to None)
</dd>
<dt><i>timeout</i> (int (optional))</dt>
<dd>
timeout in milliseconds (0 for configured default)
            (defaults to 0)
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
bytes read from the device including the expected sequence
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bytes
</dd>
</dl>
<a NAME="MicroPythonSerialPort.setTimeout" ID="MicroPythonSerialPort.setTimeout"></a>
<h4>MicroPythonSerialPort.setTimeout</h4>
<b>setTimeout</b>(<i>timeout</i>)
<p>
        Public method to set the timeout for device operations.
</p>

<dl>

<dt><i>timeout</i> (int)</dt>
<dd>
timout in milliseconds to be set
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>

eric ide

mercurial