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

branch
mpy_network
changeset 9990
54c614d91eff
parent 9989
286c2a21f36f
child 10015
9352f33732ae
equal deleted inserted replaced
9989:286c2a21f36f 9990:54c614d91eff
7 <body> 7 <body>
8 <a NAME="top" ID="top"></a> 8 <a NAME="top" ID="top"></a>
9 <h1>eric7.MicroPython.MicroPythonDeviceInterface</h1> 9 <h1>eric7.MicroPython.MicroPythonDeviceInterface</h1>
10 10
11 <p> 11 <p>
12 Module implementing some file system commands for MicroPython. 12 Module implementing an interface base class to talk to a connected MicroPython device.
13 </p> 13 </p>
14 <h3>Global Attributes</h3> 14 <h3>Global Attributes</h3>
15 15
16 <table> 16 <table>
17 <tr><td>None</td></tr> 17 <tr><td>None</td></tr>
41 <h3>Signals</h3> 41 <h3>Signals</h3>
42 <dl> 42 <dl>
43 43
44 <dt>dataReceived(data)</dt> 44 <dt>dataReceived(data)</dt>
45 <dd> 45 <dd>
46 emitted to send data received via the serial 46 emitted to send data received via the connection
47 connection for further processing 47 for further processing
48 </dd> 48 </dd>
49 <dt>executeAsyncFinished()</dt> 49 <dt>executeAsyncFinished()</dt>
50 <dd> 50 <dd>
51 emitted to indicate the end of an 51 emitted to indicate the end of an
52 asynchronously executed list of commands (e.g. a script) 52 asynchronously executed list of commands (e.g. a script)
55 <h3>Derived from</h3> 55 <h3>Derived from</h3>
56 QObject 56 QObject
57 <h3>Class Attributes</h3> 57 <h3>Class Attributes</h3>
58 58
59 <table> 59 <table>
60 <tr><td>PasteModePrompt</td></tr><tr><td>TracebackMarker</td></tr> 60 <tr><td>None</td></tr>
61 </table> 61 </table>
62 <h3>Class Methods</h3> 62 <h3>Class Methods</h3>
63 63
64 <table> 64 <table>
65 <tr><td>None</td></tr> 65 <tr><td>None</td></tr>
71 <tr> 71 <tr>
72 <td><a href="#MicroPythonDeviceInterface.__init__">MicroPythonDeviceInterface</a></td> 72 <td><a href="#MicroPythonDeviceInterface.__init__">MicroPythonDeviceInterface</a></td>
73 <td>Constructor</td> 73 <td>Constructor</td>
74 </tr> 74 </tr>
75 <tr> 75 <tr>
76 <td><a href="#MicroPythonDeviceInterface.__executeAsyncPaste">__executeAsyncPaste</a></td>
77 <td>Private method to execute a series of commands over a period of time without returning any result (asynchronous execution).</td>
78 </tr>
79 <tr>
80 <td><a href="#MicroPythonDeviceInterface.__executeAsyncRaw">__executeAsyncRaw</a></td>
81 <td>Private method to execute a series of commands over a period of time without returning any result (asynchronous execution).</td>
82 </tr>
83 <tr>
84 <td><a href="#MicroPythonDeviceInterface.__execute_paste">__execute_paste</a></td>
85 <td>Private method to send commands to the connected device using 'paste' mode and return the result.</td>
86 </tr>
87 <tr>
88 <td><a href="#MicroPythonDeviceInterface.__execute_raw">__execute_raw</a></td>
89 <td>Private method to send commands to the connected device using 'raw REPL' mode and return the result.</td>
90 </tr>
91 <tr>
92 <td><a href="#MicroPythonDeviceInterface.__pasteOff">__pasteOff</a></td>
93 <td>Private method to switch 'paste' mode off.</td>
94 </tr>
95 <tr>
96 <td><a href="#MicroPythonDeviceInterface.__pasteOn">__pasteOn</a></td>
97 <td>Private method to switch the connected device to 'paste' mode.</td>
98 </tr>
99 <tr>
100 <td><a href="#MicroPythonDeviceInterface.__rawOff">__rawOff</a></td>
101 <td>Private method to switch 'raw' mode off.</td>
102 </tr>
103 <tr>
104 <td><a href="#MicroPythonDeviceInterface.__rawOn">__rawOn</a></td>
105 <td>Private method to switch the connected device to 'raw' mode.</td>
106 </tr>
107 <tr>
108 <td><a href="#MicroPythonDeviceInterface.__readSerial">__readSerial</a></td>
109 <td>Private slot to read all available serial data and emit it with the "dataReceived" signal for further processing.</td>
110 </tr>
111 <tr>
112 <td><a href="#MicroPythonDeviceInterface.connectToDevice">connectToDevice</a></td> 76 <td><a href="#MicroPythonDeviceInterface.connectToDevice">connectToDevice</a></td>
113 <td>Public slot to start the manager.</td> 77 <td>Public slot to connect to the device.</td>
114 </tr> 78 </tr>
115 <tr> 79 <tr>
116 <td><a href="#MicroPythonDeviceInterface.disconnectFromDevice">disconnectFromDevice</a></td> 80 <td><a href="#MicroPythonDeviceInterface.disconnectFromDevice">disconnectFromDevice</a></td>
117 <td>Public slot to stop the thread.</td> 81 <td>Public slot to disconnect from the device.</td>
118 </tr> 82 </tr>
119 <tr> 83 <tr>
120 <td><a href="#MicroPythonDeviceInterface.execute">execute</a></td> 84 <td><a href="#MicroPythonDeviceInterface.execute">execute</a></td>
121 <td>Public method to send commands to the connected device and return the result.</td> 85 <td>Public method to send commands to the connected device and return the result.</td>
122 </tr> 86 </tr>
159 <dt><i>parent</i> (QObject)</dt> 123 <dt><i>parent</i> (QObject)</dt>
160 <dd> 124 <dd>
161 reference to the parent object 125 reference to the parent object
162 </dd> 126 </dd>
163 </dl> 127 </dl>
164 <a NAME="MicroPythonDeviceInterface.__executeAsyncPaste" ID="MicroPythonDeviceInterface.__executeAsyncPaste"></a>
165 <h4>MicroPythonDeviceInterface.__executeAsyncPaste</h4>
166 <b>__executeAsyncPaste</b>(<i>commandsList</i>)
167
168 <p>
169 Private method to execute a series of commands over a period of time
170 without returning any result (asynchronous execution).
171 </p>
172 <dl>
173
174 <dt><i>commandsList</i> (list of str)</dt>
175 <dd>
176 list of commands to be execute on the device
177 </dd>
178 </dl>
179 <a NAME="MicroPythonDeviceInterface.__executeAsyncRaw" ID="MicroPythonDeviceInterface.__executeAsyncRaw"></a>
180 <h4>MicroPythonDeviceInterface.__executeAsyncRaw</h4>
181 <b>__executeAsyncRaw</b>(<i>commandsList</i>)
182
183 <p>
184 Private method to execute a series of commands over a period of time
185 without returning any result (asynchronous execution).
186 </p>
187 <dl>
188
189 <dt><i>commandsList</i> (list of bytes)</dt>
190 <dd>
191 list of commands to be execute on the device
192 </dd>
193 </dl>
194 <a NAME="MicroPythonDeviceInterface.__execute_paste" ID="MicroPythonDeviceInterface.__execute_paste"></a>
195 <h4>MicroPythonDeviceInterface.__execute_paste</h4>
196 <b>__execute_paste</b>(<i>commands, timeout=0</i>)
197
198 <p>
199 Private method to send commands to the connected device using 'paste' mode
200 and return the result.
201 </p>
202 <p>
203 If no serial connection is available, empty results will be returned.
204 </p>
205 <dl>
206
207 <dt><i>commands</i> (str or list of str)</dt>
208 <dd>
209 list of commands to be executed
210 </dd>
211 <dt><i>timeout</i> (int (optional))</dt>
212 <dd>
213 per command timeout in milliseconds (0 for configured default)
214 (defaults to 0)
215 </dd>
216 </dl>
217 <dl>
218 <dt>Return:</dt>
219 <dd>
220 tuple containing stdout and stderr output of the device
221 </dd>
222 </dl>
223 <dl>
224 <dt>Return Type:</dt>
225 <dd>
226 tuple of (bytes, bytes)
227 </dd>
228 </dl>
229 <a NAME="MicroPythonDeviceInterface.__execute_raw" ID="MicroPythonDeviceInterface.__execute_raw"></a>
230 <h4>MicroPythonDeviceInterface.__execute_raw</h4>
231 <b>__execute_raw</b>(<i>commands, timeout=0</i>)
232
233 <p>
234 Private method to send commands to the connected device using 'raw REPL' mode
235 and return the result.
236 </p>
237 <p>
238 If no serial connection is available, empty results will be returned.
239 </p>
240 <dl>
241
242 <dt><i>commands</i> (str or list of str)</dt>
243 <dd>
244 list of commands to be executed
245 </dd>
246 <dt><i>timeout</i> (int (optional))</dt>
247 <dd>
248 per command timeout in milliseconds (0 for configured default)
249 (defaults to 0)
250 </dd>
251 </dl>
252 <dl>
253 <dt>Return:</dt>
254 <dd>
255 tuple containing stdout and stderr output of the device
256 </dd>
257 </dl>
258 <dl>
259 <dt>Return Type:</dt>
260 <dd>
261 tuple of (bytes, bytes)
262 </dd>
263 </dl>
264 <a NAME="MicroPythonDeviceInterface.__pasteOff" ID="MicroPythonDeviceInterface.__pasteOff"></a>
265 <h4>MicroPythonDeviceInterface.__pasteOff</h4>
266 <b>__pasteOff</b>(<i></i>)
267
268 <p>
269 Private method to switch 'paste' mode off.
270 </p>
271 <a NAME="MicroPythonDeviceInterface.__pasteOn" ID="MicroPythonDeviceInterface.__pasteOn"></a>
272 <h4>MicroPythonDeviceInterface.__pasteOn</h4>
273 <b>__pasteOn</b>(<i></i>)
274
275 <p>
276 Private method to switch the connected device to 'paste' mode.
277 </p>
278 <p>
279 Note: switching to paste mode is done with synchronous writes.
280 </p>
281 <dl>
282 <dt>Return:</dt>
283 <dd>
284 flag indicating success
285 </dd>
286 </dl>
287 <dl>
288 <dt>Return Type:</dt>
289 <dd>
290 bool
291 </dd>
292 </dl>
293 <a NAME="MicroPythonDeviceInterface.__rawOff" ID="MicroPythonDeviceInterface.__rawOff"></a>
294 <h4>MicroPythonDeviceInterface.__rawOff</h4>
295 <b>__rawOff</b>(<i></i>)
296
297 <p>
298 Private method to switch 'raw' mode off.
299 </p>
300 <a NAME="MicroPythonDeviceInterface.__rawOn" ID="MicroPythonDeviceInterface.__rawOn"></a>
301 <h4>MicroPythonDeviceInterface.__rawOn</h4>
302 <b>__rawOn</b>(<i></i>)
303
304 <p>
305 Private method to switch the connected device to 'raw' mode.
306 </p>
307 <p>
308 Note: switching to raw mode is done with synchronous writes.
309 </p>
310 <dl>
311 <dt>Return:</dt>
312 <dd>
313 flag indicating success
314 </dd>
315 </dl>
316 <dl>
317 <dt>Return Type:</dt>
318 <dd>
319 bool
320 </dd>
321 </dl>
322 <a NAME="MicroPythonDeviceInterface.__readSerial" ID="MicroPythonDeviceInterface.__readSerial"></a>
323 <h4>MicroPythonDeviceInterface.__readSerial</h4>
324 <b>__readSerial</b>(<i></i>)
325
326 <p>
327 Private slot to read all available serial data and emit it with the
328 "dataReceived" signal for further processing.
329 </p>
330 <a NAME="MicroPythonDeviceInterface.connectToDevice" ID="MicroPythonDeviceInterface.connectToDevice"></a> 128 <a NAME="MicroPythonDeviceInterface.connectToDevice" ID="MicroPythonDeviceInterface.connectToDevice"></a>
331 <h4>MicroPythonDeviceInterface.connectToDevice</h4> 129 <h4>MicroPythonDeviceInterface.connectToDevice</h4>
332 <b>connectToDevice</b>(<i>port</i>) 130 <b>connectToDevice</b>(<i>connection</i>)
333 131
334 <p> 132 <p>
335 Public slot to start the manager. 133 Public slot to connect to the device.
336 </p> 134 </p>
337 <dl> 135 <dl>
338 136
339 <dt><i>port</i> (str)</dt> 137 <dt><i>connection</i> (str)</dt>
340 <dd> 138 <dd>
341 name of the port to be used 139 name of the connection to be used
342 </dd> 140 </dd>
343 </dl> 141 </dl>
344 <dl> 142 <dl>
345 <dt>Return:</dt> 143 <dt>Return:</dt>
346 <dd> 144 <dd>
349 </dl> 147 </dl>
350 <dl> 148 <dl>
351 <dt>Return Type:</dt> 149 <dt>Return Type:</dt>
352 <dd> 150 <dd>
353 bool 151 bool
152 </dd>
153 </dl>
154 <dl>
155
156 <dt>Raises <b>NotImplementedError</b>:</dt>
157 <dd>
158 raised to indicate that this method needs to
159 be implemented in a derived class
354 </dd> 160 </dd>
355 </dl> 161 </dl>
356 <a NAME="MicroPythonDeviceInterface.disconnectFromDevice" ID="MicroPythonDeviceInterface.disconnectFromDevice"></a> 162 <a NAME="MicroPythonDeviceInterface.disconnectFromDevice" ID="MicroPythonDeviceInterface.disconnectFromDevice"></a>
357 <h4>MicroPythonDeviceInterface.disconnectFromDevice</h4> 163 <h4>MicroPythonDeviceInterface.disconnectFromDevice</h4>
358 <b>disconnectFromDevice</b>(<i></i>) 164 <b>disconnectFromDevice</b>(<i></i>)
359 165
360 <p> 166 <p>
361 Public slot to stop the thread. 167 Public slot to disconnect from the device.
362 </p> 168 </p>
169 <dl>
170
171 <dt>Raises <b>NotImplementedError</b>:</dt>
172 <dd>
173 raised to indicate that this method needs to
174 be implemented in a derived class
175 </dd>
176 </dl>
363 <a NAME="MicroPythonDeviceInterface.execute" ID="MicroPythonDeviceInterface.execute"></a> 177 <a NAME="MicroPythonDeviceInterface.execute" ID="MicroPythonDeviceInterface.execute"></a>
364 <h4>MicroPythonDeviceInterface.execute</h4> 178 <h4>MicroPythonDeviceInterface.execute</h4>
365 <b>execute</b>(<i>commands, *, mode="raw", timeout=0</i>) 179 <b>execute</b>(<i>commands, *, mode="raw", timeout=0</i>)
366 180
367 <p> 181 <p>
368 Public method to send commands to the connected device and return the 182 Public method to send commands to the connected device and return the
369 result. 183 result.
370 </p> 184 </p>
371 <p> 185 <p>
372 If no serial connection is available, empty results will be returned. 186 If no connection is available, empty results will be returned.
373 </p> 187 </p>
374 <dl> 188 <dl>
375 189
376 <dt><i>commands</i> (str or list of str)</dt> 190 <dt><i>commands</i> (str or list of str)</dt>
377 <dd> 191 <dd>
400 tuple of (bytes, bytes) 214 tuple of (bytes, bytes)
401 </dd> 215 </dd>
402 </dl> 216 </dl>
403 <dl> 217 <dl>
404 218
219 <dt>Raises <b>NotImplementedError</b>:</dt>
220 <dd>
221 raised to indicate that this method needs to
222 be implemented in a derived class
223 </dd>
405 <dt>Raises <b>ValueError</b>:</dt> 224 <dt>Raises <b>ValueError</b>:</dt>
406 <dd> 225 <dd>
407 raised in case of an unsupported submit mode 226 raised in case of an unsupported submit mode
408 </dd> 227 </dd>
409 </dl> 228 </dl>
419 238
420 <dt><i>commandsList</i> (list of str)</dt> 239 <dt><i>commandsList</i> (list of str)</dt>
421 <dd> 240 <dd>
422 list of commands to be execute on the device 241 list of commands to be execute on the device
423 </dd> 242 </dd>
424 <dt><i>submitMode</i> (str (one of 'raw' or 'paste'))</dt> 243 <dt><i>submitMode</i> (str)</dt>
425 <dd> 244 <dd>
426 mode to be used to submit the commands 245 mode to be used to submit the commands (one of 'raw'
427 </dd> 246 or 'paste')
428 </dl> 247 </dd>
429 <dl> 248 </dl>
430 249 <dl>
250
251 <dt>Raises <b>NotImplementedError</b>:</dt>
252 <dd>
253 raised to indicate that this method needs to
254 be implemented in a derived class
255 </dd>
431 <dt>Raises <b>ValueError</b>:</dt> 256 <dt>Raises <b>ValueError</b>:</dt>
432 <dd> 257 <dd>
433 raised to indicate an unknown submit mode 258 raised to indicate an unknown submit mode
434 </dd> 259 </dd>
435 </dl> 260 </dl>
457 <dt>Return Type:</dt> 282 <dt>Return Type:</dt>
458 <dd> 283 <dd>
459 bool 284 bool
460 </dd> 285 </dd>
461 </dl> 286 </dl>
287 <dl>
288
289 <dt>Raises <b>NotImplementedError</b>:</dt>
290 <dd>
291 raised to indicate that this method needs to
292 be implemented in a derived class
293 </dd>
294 </dl>
462 <a NAME="MicroPythonDeviceInterface.probeDevice" ID="MicroPythonDeviceInterface.probeDevice"></a> 295 <a NAME="MicroPythonDeviceInterface.probeDevice" ID="MicroPythonDeviceInterface.probeDevice"></a>
463 <h4>MicroPythonDeviceInterface.probeDevice</h4> 296 <h4>MicroPythonDeviceInterface.probeDevice</h4>
464 <b>probeDevice</b>(<i></i>) 297 <b>probeDevice</b>(<i></i>)
465 298
466 <p> 299 <p>
467 Public method to check the device is responding. 300 Public method to check the device is responding.
468 </p> 301 </p>
469 <p> 302 <p>
470 If the device has not been flashed with a MicroPython formware, the 303 If the device has not been flashed with a MicroPython firmware, the
471 probe will fail. 304 probe will fail.
472 </p> 305 </p>
473 <dl> 306 <dl>
474 <dt>Return:</dt> 307 <dt>Return:</dt>
475 <dd> 308 <dd>
478 </dl> 311 </dl>
479 <dl> 312 <dl>
480 <dt>Return Type:</dt> 313 <dt>Return Type:</dt>
481 <dd> 314 <dd>
482 bool 315 bool
316 </dd>
317 </dl>
318 <dl>
319
320 <dt>Raises <b>NotImplementedError</b>:</dt>
321 <dd>
322 raised to indicate that this method needs to
323 be implemented in a derived class
483 </dd> 324 </dd>
484 </dl> 325 </dl>
485 <a NAME="MicroPythonDeviceInterface.write" ID="MicroPythonDeviceInterface.write"></a> 326 <a NAME="MicroPythonDeviceInterface.write" ID="MicroPythonDeviceInterface.write"></a>
486 <h4>MicroPythonDeviceInterface.write</h4> 327 <h4>MicroPythonDeviceInterface.write</h4>
487 <b>write</b>(<i>data</i>) 328 <b>write</b>(<i>data</i>)
494 <dt><i>data</i> (bytes or bytearray)</dt> 335 <dt><i>data</i> (bytes or bytearray)</dt>
495 <dd> 336 <dd>
496 data to be written 337 data to be written
497 </dd> 338 </dd>
498 </dl> 339 </dl>
340 <dl>
341
342 <dt>Raises <b>NotImplementedError</b>:</dt>
343 <dd>
344 raised to indicate that this method needs to
345 be implemented in a derived class
346 </dd>
347 </dl>
499 <div align="right"><a href="#top">Up</a></div> 348 <div align="right"><a href="#top">Up</a></div>
500 <hr /> 349 <hr />
501 </body></html> 350 </body></html>

eric ide

mercurial