1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.MicroPython.MicroPythonCommandsInterface</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.MicroPython.MicroPythonCommandsInterface</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing some file system commands for MicroPython. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>None</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#MicroPythonCommandsInterface">MicroPythonCommandsInterface</a></td> |
|
25 <td>Class implementing some file system commands for MicroPython.</td> |
|
26 </tr> |
|
27 </table> |
|
28 <h3>Functions</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>None</td></tr> |
|
32 </table> |
|
33 <hr /> |
|
34 <hr /> |
|
35 <a NAME="MicroPythonCommandsInterface" ID="MicroPythonCommandsInterface"></a> |
|
36 <h2>MicroPythonCommandsInterface</h2> |
|
37 |
|
38 <p> |
|
39 Class implementing some file system commands for MicroPython. |
|
40 </p> |
|
41 <p> |
|
42 Commands are provided to perform operations on the file system of a |
|
43 connected MicroPython device. Supported commands are: |
|
44 <ul> |
|
45 <li>ls: directory listing</li> |
|
46 <li>lls: directory listing with meta data</li> |
|
47 <li>cd: change directory</li> |
|
48 <li>pwd: get the current directory</li> |
|
49 <li>put: copy a file to the connected device</li> |
|
50 <li>get: get a file from the connected device</li> |
|
51 <li>rm: remove a file from the connected device</li> |
|
52 <li>rmrf: remove a file/directory recursively (like 'rm -rf' in bash) |
|
53 <li>mkdir: create a new directory</li> |
|
54 <li>rmdir: remove an empty directory</li> |
|
55 </ul> |
|
56 </p> |
|
57 <p> |
|
58 There are additional commands related to time and version. |
|
59 <ul> |
|
60 <li>version: get version info about MicroPython</li> |
|
61 <li>getImplementation: get some implementation information</li> |
|
62 <li>syncTime: synchronize the time of the connected device</li> |
|
63 <li>showTime: show the current time of the connected device</li> |
|
64 </ul> |
|
65 </p> |
|
66 <h3>Signals</h3> |
|
67 <dl> |
|
68 |
|
69 <dt>dataReceived(data)</dt> |
|
70 <dd> |
|
71 emitted to send data received via the serial |
|
72 connection for further processing |
|
73 </dd> |
|
74 <dt>executeAsyncFinished()</dt> |
|
75 <dd> |
|
76 emitted to indicate the end of an |
|
77 asynchronously executed list of commands (e.g. a script) |
|
78 </dd> |
|
79 </dl> |
|
80 <h3>Derived from</h3> |
|
81 QObject |
|
82 <h3>Class Attributes</h3> |
|
83 |
|
84 <table> |
|
85 <tr><td>None</td></tr> |
|
86 </table> |
|
87 <h3>Class Methods</h3> |
|
88 |
|
89 <table> |
|
90 <tr><td>None</td></tr> |
|
91 </table> |
|
92 <h3>Methods</h3> |
|
93 |
|
94 <table> |
|
95 |
|
96 <tr> |
|
97 <td><a href="#MicroPythonCommandsInterface.__init__">MicroPythonCommandsInterface</a></td> |
|
98 <td>Constructor</td> |
|
99 </tr> |
|
100 <tr> |
|
101 <td><a href="#MicroPythonCommandsInterface.__rawOff">__rawOff</a></td> |
|
102 <td>Private method to switch 'raw' mode off.</td> |
|
103 </tr> |
|
104 <tr> |
|
105 <td><a href="#MicroPythonCommandsInterface.__rawOn">__rawOn</a></td> |
|
106 <td>Private method to switch the connected device to 'raw' mode.</td> |
|
107 </tr> |
|
108 <tr> |
|
109 <td><a href="#MicroPythonCommandsInterface.__readSerial">__readSerial</a></td> |
|
110 <td>Private slot to read all available serial data and emit it with the "dataReceived" signal for further processing.</td> |
|
111 </tr> |
|
112 <tr> |
|
113 <td><a href="#MicroPythonCommandsInterface.__shortError">__shortError</a></td> |
|
114 <td>Private method to create a shortened error message.</td> |
|
115 </tr> |
|
116 <tr> |
|
117 <td><a href="#MicroPythonCommandsInterface.cd">cd</a></td> |
|
118 <td>Public method to change the current directory on the connected device.</td> |
|
119 </tr> |
|
120 <tr> |
|
121 <td><a href="#MicroPythonCommandsInterface.connectToDevice">connectToDevice</a></td> |
|
122 <td>Public slot to start the manager.</td> |
|
123 </tr> |
|
124 <tr> |
|
125 <td><a href="#MicroPythonCommandsInterface.disconnectFromDevice">disconnectFromDevice</a></td> |
|
126 <td>Public slot to stop the thread.</td> |
|
127 </tr> |
|
128 <tr> |
|
129 <td><a href="#MicroPythonCommandsInterface.execute">execute</a></td> |
|
130 <td>Public method to send commands to the connected device and return the result.</td> |
|
131 </tr> |
|
132 <tr> |
|
133 <td><a href="#MicroPythonCommandsInterface.executeAsync">executeAsync</a></td> |
|
134 <td>Public method to execute a series of commands over a period of time without returning any result (asynchronous execution).</td> |
|
135 </tr> |
|
136 <tr> |
|
137 <td><a href="#MicroPythonCommandsInterface.fileSystemInfo">fileSystemInfo</a></td> |
|
138 <td>Public method to obtain information about the currently mounted file systems.</td> |
|
139 </tr> |
|
140 <tr> |
|
141 <td><a href="#MicroPythonCommandsInterface.get">get</a></td> |
|
142 <td>Public method to copy a file from the connected device.</td> |
|
143 </tr> |
|
144 <tr> |
|
145 <td><a href="#MicroPythonCommandsInterface.getBoardInformation">getBoardInformation</a></td> |
|
146 <td>Public method to get some information data of the connected board.</td> |
|
147 </tr> |
|
148 <tr> |
|
149 <td><a href="#MicroPythonCommandsInterface.getData">getData</a></td> |
|
150 <td>Public method to read data from the connected device.</td> |
|
151 </tr> |
|
152 <tr> |
|
153 <td><a href="#MicroPythonCommandsInterface.getDeviceData">getDeviceData</a></td> |
|
154 <td>Public method to get some essential data for the connected board.</td> |
|
155 </tr> |
|
156 <tr> |
|
157 <td><a href="#MicroPythonCommandsInterface.getModules">getModules</a></td> |
|
158 <td>Public method to show a list of modules built into the firmware.</td> |
|
159 </tr> |
|
160 <tr> |
|
161 <td><a href="#MicroPythonCommandsInterface.getTime">getTime</a></td> |
|
162 <td>Public method to get the current time of the device.</td> |
|
163 </tr> |
|
164 <tr> |
|
165 <td><a href="#MicroPythonCommandsInterface.handlePreferencesChanged">handlePreferencesChanged</a></td> |
|
166 <td>Public slot to handle a change of the preferences.</td> |
|
167 </tr> |
|
168 <tr> |
|
169 <td><a href="#MicroPythonCommandsInterface.isConnected">isConnected</a></td> |
|
170 <td>Public method to get the connection status.</td> |
|
171 </tr> |
|
172 <tr> |
|
173 <td><a href="#MicroPythonCommandsInterface.lls">lls</a></td> |
|
174 <td>Public method to get a long directory listing of the connected device including meta data.</td> |
|
175 </tr> |
|
176 <tr> |
|
177 <td><a href="#MicroPythonCommandsInterface.ls">ls</a></td> |
|
178 <td>Public method to get a directory listing of the connected device.</td> |
|
179 </tr> |
|
180 <tr> |
|
181 <td><a href="#MicroPythonCommandsInterface.mkdir">mkdir</a></td> |
|
182 <td>Public method to create a new directory.</td> |
|
183 </tr> |
|
184 <tr> |
|
185 <td><a href="#MicroPythonCommandsInterface.probeDevice">probeDevice</a></td> |
|
186 <td>Public method to check the device is responding.</td> |
|
187 </tr> |
|
188 <tr> |
|
189 <td><a href="#MicroPythonCommandsInterface.put">put</a></td> |
|
190 <td>Public method to copy a local file to the connected device.</td> |
|
191 </tr> |
|
192 <tr> |
|
193 <td><a href="#MicroPythonCommandsInterface.putData">putData</a></td> |
|
194 <td>Public method to write the given data to the connected device.</td> |
|
195 </tr> |
|
196 <tr> |
|
197 <td><a href="#MicroPythonCommandsInterface.pwd">pwd</a></td> |
|
198 <td>Public method to get the current directory of the connected device.</td> |
|
199 </tr> |
|
200 <tr> |
|
201 <td><a href="#MicroPythonCommandsInterface.remainingTask">remainingTask</a></td> |
|
202 <td></td> |
|
203 </tr> |
|
204 <tr> |
|
205 <td><a href="#MicroPythonCommandsInterface.rm">rm</a></td> |
|
206 <td>Public method to remove a file from the connected device.</td> |
|
207 </tr> |
|
208 <tr> |
|
209 <td><a href="#MicroPythonCommandsInterface.rmdir">rmdir</a></td> |
|
210 <td>Public method to remove a directory.</td> |
|
211 </tr> |
|
212 <tr> |
|
213 <td><a href="#MicroPythonCommandsInterface.rmrf">rmrf</a></td> |
|
214 <td>Public method to remove a file or directory recursively.</td> |
|
215 </tr> |
|
216 <tr> |
|
217 <td><a href="#MicroPythonCommandsInterface.syncTime">syncTime</a></td> |
|
218 <td>Public method to set the time of the connected device to the local computer's time.</td> |
|
219 </tr> |
|
220 <tr> |
|
221 <td><a href="#MicroPythonCommandsInterface.write">write</a></td> |
|
222 <td>Public method to write data to the connected device.</td> |
|
223 </tr> |
|
224 </table> |
|
225 <h3>Static Methods</h3> |
|
226 |
|
227 <table> |
|
228 <tr><td>None</td></tr> |
|
229 </table> |
|
230 |
|
231 <a NAME="MicroPythonCommandsInterface.__init__" ID="MicroPythonCommandsInterface.__init__"></a> |
|
232 <h4>MicroPythonCommandsInterface (Constructor)</h4> |
|
233 <b>MicroPythonCommandsInterface</b>(<i>parent=None</i>) |
|
234 |
|
235 <p> |
|
236 Constructor |
|
237 </p> |
|
238 <dl> |
|
239 |
|
240 <dt><i>parent</i> (QObject)</dt> |
|
241 <dd> |
|
242 reference to the parent object |
|
243 </dd> |
|
244 </dl> |
|
245 <a NAME="MicroPythonCommandsInterface.__rawOff" ID="MicroPythonCommandsInterface.__rawOff"></a> |
|
246 <h4>MicroPythonCommandsInterface.__rawOff</h4> |
|
247 <b>__rawOff</b>(<i></i>) |
|
248 |
|
249 <p> |
|
250 Private method to switch 'raw' mode off. |
|
251 </p> |
|
252 <a NAME="MicroPythonCommandsInterface.__rawOn" ID="MicroPythonCommandsInterface.__rawOn"></a> |
|
253 <h4>MicroPythonCommandsInterface.__rawOn</h4> |
|
254 <b>__rawOn</b>(<i></i>) |
|
255 |
|
256 <p> |
|
257 Private method to switch the connected device to 'raw' mode. |
|
258 </p> |
|
259 <p> |
|
260 Note: switching to raw mode is done with synchronous writes. |
|
261 </p> |
|
262 <dl> |
|
263 <dt>Return:</dt> |
|
264 <dd> |
|
265 flag indicating success |
|
266 @rtype bool |
|
267 </dd> |
|
268 </dl> |
|
269 <a NAME="MicroPythonCommandsInterface.__readSerial" ID="MicroPythonCommandsInterface.__readSerial"></a> |
|
270 <h4>MicroPythonCommandsInterface.__readSerial</h4> |
|
271 <b>__readSerial</b>(<i></i>) |
|
272 |
|
273 <p> |
|
274 Private slot to read all available serial data and emit it with the |
|
275 "dataReceived" signal for further processing. |
|
276 </p> |
|
277 <a NAME="MicroPythonCommandsInterface.__shortError" ID="MicroPythonCommandsInterface.__shortError"></a> |
|
278 <h4>MicroPythonCommandsInterface.__shortError</h4> |
|
279 <b>__shortError</b>(<i>error</i>) |
|
280 |
|
281 <p> |
|
282 Private method to create a shortened error message. |
|
283 </p> |
|
284 <dl> |
|
285 |
|
286 <dt><i>error</i> (bytes)</dt> |
|
287 <dd> |
|
288 verbose error message |
|
289 </dd> |
|
290 </dl> |
|
291 <dl> |
|
292 <dt>Return:</dt> |
|
293 <dd> |
|
294 shortened error message |
|
295 </dd> |
|
296 </dl> |
|
297 <dl> |
|
298 <dt>Return Type:</dt> |
|
299 <dd> |
|
300 str |
|
301 </dd> |
|
302 </dl> |
|
303 <a NAME="MicroPythonCommandsInterface.cd" ID="MicroPythonCommandsInterface.cd"></a> |
|
304 <h4>MicroPythonCommandsInterface.cd</h4> |
|
305 <b>cd</b>(<i>dirname</i>) |
|
306 |
|
307 <p> |
|
308 Public method to change the current directory on the connected device. |
|
309 </p> |
|
310 <dl> |
|
311 |
|
312 <dt><i>dirname</i> (str)</dt> |
|
313 <dd> |
|
314 directory to change to |
|
315 </dd> |
|
316 </dl> |
|
317 <dl> |
|
318 |
|
319 <dt>Raises <b>OSError</b>:</dt> |
|
320 <dd> |
|
321 raised to indicate an issue with the device |
|
322 </dd> |
|
323 </dl> |
|
324 <a NAME="MicroPythonCommandsInterface.connectToDevice" ID="MicroPythonCommandsInterface.connectToDevice"></a> |
|
325 <h4>MicroPythonCommandsInterface.connectToDevice</h4> |
|
326 <b>connectToDevice</b>(<i>port</i>) |
|
327 |
|
328 <p> |
|
329 Public slot to start the manager. |
|
330 </p> |
|
331 <dl> |
|
332 |
|
333 <dt><i>port</i> (str)</dt> |
|
334 <dd> |
|
335 name of the port to be used |
|
336 </dd> |
|
337 </dl> |
|
338 <dl> |
|
339 <dt>Return:</dt> |
|
340 <dd> |
|
341 flag indicating success |
|
342 </dd> |
|
343 </dl> |
|
344 <dl> |
|
345 <dt>Return Type:</dt> |
|
346 <dd> |
|
347 bool |
|
348 </dd> |
|
349 </dl> |
|
350 <a NAME="MicroPythonCommandsInterface.disconnectFromDevice" ID="MicroPythonCommandsInterface.disconnectFromDevice"></a> |
|
351 <h4>MicroPythonCommandsInterface.disconnectFromDevice</h4> |
|
352 <b>disconnectFromDevice</b>(<i></i>) |
|
353 |
|
354 <p> |
|
355 Public slot to stop the thread. |
|
356 </p> |
|
357 <a NAME="MicroPythonCommandsInterface.execute" ID="MicroPythonCommandsInterface.execute"></a> |
|
358 <h4>MicroPythonCommandsInterface.execute</h4> |
|
359 <b>execute</b>(<i>commands</i>) |
|
360 |
|
361 <p> |
|
362 Public method to send commands to the connected device and return the |
|
363 result. |
|
364 </p> |
|
365 <p> |
|
366 If no serial connection is available, empty results will be returned. |
|
367 </p> |
|
368 <dl> |
|
369 |
|
370 <dt><i>commands</i> (str)</dt> |
|
371 <dd> |
|
372 list of commands to be executed |
|
373 </dd> |
|
374 </dl> |
|
375 <dl> |
|
376 <dt>Return:</dt> |
|
377 <dd> |
|
378 tuple containing stdout and stderr output of the device |
|
379 </dd> |
|
380 </dl> |
|
381 <dl> |
|
382 <dt>Return Type:</dt> |
|
383 <dd> |
|
384 tuple of (bytes, bytes) |
|
385 </dd> |
|
386 </dl> |
|
387 <a NAME="MicroPythonCommandsInterface.executeAsync" ID="MicroPythonCommandsInterface.executeAsync"></a> |
|
388 <h4>MicroPythonCommandsInterface.executeAsync</h4> |
|
389 <b>executeAsync</b>(<i>commandsList</i>) |
|
390 |
|
391 <p> |
|
392 Public method to execute a series of commands over a period of time |
|
393 without returning any result (asynchronous execution). |
|
394 </p> |
|
395 <dl> |
|
396 |
|
397 <dt><i>commandsList</i> (list of bytes)</dt> |
|
398 <dd> |
|
399 list of commands to be execute on the device |
|
400 </dd> |
|
401 </dl> |
|
402 <a NAME="MicroPythonCommandsInterface.fileSystemInfo" ID="MicroPythonCommandsInterface.fileSystemInfo"></a> |
|
403 <h4>MicroPythonCommandsInterface.fileSystemInfo</h4> |
|
404 <b>fileSystemInfo</b>(<i></i>) |
|
405 |
|
406 <p> |
|
407 Public method to obtain information about the currently mounted file |
|
408 systems. |
|
409 </p> |
|
410 <dl> |
|
411 <dt>Return:</dt> |
|
412 <dd> |
|
413 tuple of tuples containing the file system name, the total |
|
414 size, the used size and the free size |
|
415 </dd> |
|
416 </dl> |
|
417 <dl> |
|
418 <dt>Return Type:</dt> |
|
419 <dd> |
|
420 tuple of tuples of (str, int, int, int) |
|
421 </dd> |
|
422 </dl> |
|
423 <dl> |
|
424 |
|
425 <dt>Raises <b>OSError</b>:</dt> |
|
426 <dd> |
|
427 raised to indicate an issue with the device |
|
428 </dd> |
|
429 </dl> |
|
430 <a NAME="MicroPythonCommandsInterface.get" ID="MicroPythonCommandsInterface.get"></a> |
|
431 <h4>MicroPythonCommandsInterface.get</h4> |
|
432 <b>get</b>(<i>deviceFileName, hostFileName=None</i>) |
|
433 |
|
434 <p> |
|
435 Public method to copy a file from the connected device. |
|
436 </p> |
|
437 <dl> |
|
438 |
|
439 <dt><i>deviceFileName</i> (str)</dt> |
|
440 <dd> |
|
441 name of the file to copy |
|
442 </dd> |
|
443 <dt><i>hostFileName</i> (str)</dt> |
|
444 <dd> |
|
445 name of the file to copy to |
|
446 </dd> |
|
447 </dl> |
|
448 <dl> |
|
449 <dt>Return:</dt> |
|
450 <dd> |
|
451 flag indicating success |
|
452 </dd> |
|
453 </dl> |
|
454 <dl> |
|
455 <dt>Return Type:</dt> |
|
456 <dd> |
|
457 bool |
|
458 </dd> |
|
459 </dl> |
|
460 <dl> |
|
461 |
|
462 <dt>Raises <b>OSError</b>:</dt> |
|
463 <dd> |
|
464 raised to indicate an issue with the device |
|
465 </dd> |
|
466 </dl> |
|
467 <a NAME="MicroPythonCommandsInterface.getBoardInformation" ID="MicroPythonCommandsInterface.getBoardInformation"></a> |
|
468 <h4>MicroPythonCommandsInterface.getBoardInformation</h4> |
|
469 <b>getBoardInformation</b>(<i></i>) |
|
470 |
|
471 <p> |
|
472 Public method to get some information data of the connected board. |
|
473 </p> |
|
474 <dl> |
|
475 <dt>Return:</dt> |
|
476 <dd> |
|
477 dictionary containing the determined data |
|
478 </dd> |
|
479 </dl> |
|
480 <dl> |
|
481 <dt>Return Type:</dt> |
|
482 <dd> |
|
483 dict |
|
484 </dd> |
|
485 </dl> |
|
486 <dl> |
|
487 |
|
488 <dt>Raises <b>OSError</b>:</dt> |
|
489 <dd> |
|
490 raised to indicate an issue with the device |
|
491 </dd> |
|
492 </dl> |
|
493 <a NAME="MicroPythonCommandsInterface.getData" ID="MicroPythonCommandsInterface.getData"></a> |
|
494 <h4>MicroPythonCommandsInterface.getData</h4> |
|
495 <b>getData</b>(<i>deviceFileName</i>) |
|
496 |
|
497 <p> |
|
498 Public method to read data from the connected device. |
|
499 </p> |
|
500 <dl> |
|
501 |
|
502 <dt><i>deviceFileName</i> (str)</dt> |
|
503 <dd> |
|
504 name of the file to read from |
|
505 </dd> |
|
506 </dl> |
|
507 <dl> |
|
508 <dt>Return:</dt> |
|
509 <dd> |
|
510 data read from the device |
|
511 </dd> |
|
512 </dl> |
|
513 <dl> |
|
514 <dt>Return Type:</dt> |
|
515 <dd> |
|
516 bytes |
|
517 </dd> |
|
518 </dl> |
|
519 <dl> |
|
520 |
|
521 <dt>Raises <b>OSError</b>:</dt> |
|
522 <dd> |
|
523 raised to indicate an issue with the device |
|
524 </dd> |
|
525 </dl> |
|
526 <a NAME="MicroPythonCommandsInterface.getDeviceData" ID="MicroPythonCommandsInterface.getDeviceData"></a> |
|
527 <h4>MicroPythonCommandsInterface.getDeviceData</h4> |
|
528 <b>getDeviceData</b>(<i></i>) |
|
529 |
|
530 <p> |
|
531 Public method to get some essential data for the connected board. |
|
532 </p> |
|
533 <dl> |
|
534 <dt>Return:</dt> |
|
535 <dd> |
|
536 dictionary containing the determined data |
|
537 </dd> |
|
538 </dl> |
|
539 <dl> |
|
540 <dt>Return Type:</dt> |
|
541 <dd> |
|
542 dict |
|
543 </dd> |
|
544 </dl> |
|
545 <dl> |
|
546 |
|
547 <dt>Raises <b>OSError</b>:</dt> |
|
548 <dd> |
|
549 raised to indicate an issue with the device |
|
550 </dd> |
|
551 </dl> |
|
552 <a NAME="MicroPythonCommandsInterface.getModules" ID="MicroPythonCommandsInterface.getModules"></a> |
|
553 <h4>MicroPythonCommandsInterface.getModules</h4> |
|
554 <b>getModules</b>(<i></i>) |
|
555 |
|
556 <p> |
|
557 Public method to show a list of modules built into the firmware. |
|
558 </p> |
|
559 <dl> |
|
560 <dt>Return:</dt> |
|
561 <dd> |
|
562 list of builtin modules |
|
563 </dd> |
|
564 </dl> |
|
565 <dl> |
|
566 <dt>Return Type:</dt> |
|
567 <dd> |
|
568 list of str |
|
569 </dd> |
|
570 </dl> |
|
571 <dl> |
|
572 |
|
573 <dt>Raises <b>OSError</b>:</dt> |
|
574 <dd> |
|
575 raised to indicate an issue with the device |
|
576 </dd> |
|
577 </dl> |
|
578 <a NAME="MicroPythonCommandsInterface.getTime" ID="MicroPythonCommandsInterface.getTime"></a> |
|
579 <h4>MicroPythonCommandsInterface.getTime</h4> |
|
580 <b>getTime</b>(<i></i>) |
|
581 |
|
582 <p> |
|
583 Public method to get the current time of the device. |
|
584 </p> |
|
585 <dl> |
|
586 <dt>Return:</dt> |
|
587 <dd> |
|
588 time of the device |
|
589 </dd> |
|
590 </dl> |
|
591 <dl> |
|
592 <dt>Return Type:</dt> |
|
593 <dd> |
|
594 str |
|
595 </dd> |
|
596 </dl> |
|
597 <dl> |
|
598 |
|
599 <dt>Raises <b>OSError</b>:</dt> |
|
600 <dd> |
|
601 raised to indicate an issue with the device |
|
602 </dd> |
|
603 </dl> |
|
604 <a NAME="MicroPythonCommandsInterface.handlePreferencesChanged" ID="MicroPythonCommandsInterface.handlePreferencesChanged"></a> |
|
605 <h4>MicroPythonCommandsInterface.handlePreferencesChanged</h4> |
|
606 <b>handlePreferencesChanged</b>(<i></i>) |
|
607 |
|
608 <p> |
|
609 Public slot to handle a change of the preferences. |
|
610 </p> |
|
611 <a NAME="MicroPythonCommandsInterface.isConnected" ID="MicroPythonCommandsInterface.isConnected"></a> |
|
612 <h4>MicroPythonCommandsInterface.isConnected</h4> |
|
613 <b>isConnected</b>(<i></i>) |
|
614 |
|
615 <p> |
|
616 Public method to get the connection status. |
|
617 </p> |
|
618 <dl> |
|
619 <dt>Return:</dt> |
|
620 <dd> |
|
621 flag indicating the connection status |
|
622 </dd> |
|
623 </dl> |
|
624 <dl> |
|
625 <dt>Return Type:</dt> |
|
626 <dd> |
|
627 bool |
|
628 </dd> |
|
629 </dl> |
|
630 <a NAME="MicroPythonCommandsInterface.lls" ID="MicroPythonCommandsInterface.lls"></a> |
|
631 <h4>MicroPythonCommandsInterface.lls</h4> |
|
632 <b>lls</b>(<i>dirname="", fullstat=False, showHidden=False</i>) |
|
633 |
|
634 <p> |
|
635 Public method to get a long directory listing of the connected device |
|
636 including meta data. |
|
637 </p> |
|
638 <dl> |
|
639 |
|
640 <dt><i>dirname</i> (str)</dt> |
|
641 <dd> |
|
642 name of the directory to be listed |
|
643 </dd> |
|
644 <dt><i>fullstat</i> (bool)</dt> |
|
645 <dd> |
|
646 flag indicating to return the full stat() tuple |
|
647 </dd> |
|
648 <dt><i>showHidden</i> (bool)</dt> |
|
649 <dd> |
|
650 flag indicating to show hidden files as well |
|
651 </dd> |
|
652 </dl> |
|
653 <dl> |
|
654 <dt>Return:</dt> |
|
655 <dd> |
|
656 list containing the directory listing with tuple entries of |
|
657 the name and and a tuple of mode, size and time (if fullstat is |
|
658 false) or the complete stat() tuple. 'None' is returned in case the |
|
659 directory doesn't exist. |
|
660 </dd> |
|
661 </dl> |
|
662 <dl> |
|
663 <dt>Return Type:</dt> |
|
664 <dd> |
|
665 tuple of (str, tuple) |
|
666 </dd> |
|
667 </dl> |
|
668 <dl> |
|
669 |
|
670 <dt>Raises <b>OSError</b>:</dt> |
|
671 <dd> |
|
672 raised to indicate an issue with the device |
|
673 </dd> |
|
674 </dl> |
|
675 <a NAME="MicroPythonCommandsInterface.ls" ID="MicroPythonCommandsInterface.ls"></a> |
|
676 <h4>MicroPythonCommandsInterface.ls</h4> |
|
677 <b>ls</b>(<i>dirname=""</i>) |
|
678 |
|
679 <p> |
|
680 Public method to get a directory listing of the connected device. |
|
681 </p> |
|
682 <dl> |
|
683 |
|
684 <dt><i>dirname</i> (str)</dt> |
|
685 <dd> |
|
686 name of the directory to be listed |
|
687 </dd> |
|
688 </dl> |
|
689 <dl> |
|
690 <dt>Return:</dt> |
|
691 <dd> |
|
692 tuple containg the directory listing |
|
693 </dd> |
|
694 </dl> |
|
695 <dl> |
|
696 <dt>Return Type:</dt> |
|
697 <dd> |
|
698 tuple of str |
|
699 </dd> |
|
700 </dl> |
|
701 <dl> |
|
702 |
|
703 <dt>Raises <b>OSError</b>:</dt> |
|
704 <dd> |
|
705 raised to indicate an issue with the device |
|
706 </dd> |
|
707 </dl> |
|
708 <a NAME="MicroPythonCommandsInterface.mkdir" ID="MicroPythonCommandsInterface.mkdir"></a> |
|
709 <h4>MicroPythonCommandsInterface.mkdir</h4> |
|
710 <b>mkdir</b>(<i>dirname</i>) |
|
711 |
|
712 <p> |
|
713 Public method to create a new directory. |
|
714 </p> |
|
715 <dl> |
|
716 |
|
717 <dt><i>dirname</i> (str)</dt> |
|
718 <dd> |
|
719 name of the directory to create |
|
720 </dd> |
|
721 </dl> |
|
722 <dl> |
|
723 |
|
724 <dt>Raises <b>OSError</b>:</dt> |
|
725 <dd> |
|
726 raised to indicate an issue with the device |
|
727 </dd> |
|
728 </dl> |
|
729 <a NAME="MicroPythonCommandsInterface.probeDevice" ID="MicroPythonCommandsInterface.probeDevice"></a> |
|
730 <h4>MicroPythonCommandsInterface.probeDevice</h4> |
|
731 <b>probeDevice</b>(<i></i>) |
|
732 |
|
733 <p> |
|
734 Public method to check the device is responding. |
|
735 </p> |
|
736 <p> |
|
737 If the device has not been flashed with a MicroPython formware, the |
|
738 probe will fail. |
|
739 </p> |
|
740 <dl> |
|
741 <dt>Return:</dt> |
|
742 <dd> |
|
743 flag indicating a communicating MicroPython device |
|
744 </dd> |
|
745 </dl> |
|
746 <dl> |
|
747 <dt>Return Type:</dt> |
|
748 <dd> |
|
749 bool |
|
750 </dd> |
|
751 </dl> |
|
752 <a NAME="MicroPythonCommandsInterface.put" ID="MicroPythonCommandsInterface.put"></a> |
|
753 <h4>MicroPythonCommandsInterface.put</h4> |
|
754 <b>put</b>(<i>hostFileName, deviceFileName=None</i>) |
|
755 |
|
756 <p> |
|
757 Public method to copy a local file to the connected device. |
|
758 </p> |
|
759 <dl> |
|
760 |
|
761 <dt><i>hostFileName</i> (str)</dt> |
|
762 <dd> |
|
763 name of the file to be copied |
|
764 </dd> |
|
765 <dt><i>deviceFileName</i> (str)</dt> |
|
766 <dd> |
|
767 name of the file to copy to |
|
768 </dd> |
|
769 </dl> |
|
770 <dl> |
|
771 <dt>Return:</dt> |
|
772 <dd> |
|
773 flag indicating success |
|
774 </dd> |
|
775 </dl> |
|
776 <dl> |
|
777 <dt>Return Type:</dt> |
|
778 <dd> |
|
779 bool |
|
780 </dd> |
|
781 </dl> |
|
782 <dl> |
|
783 |
|
784 <dt>Raises <b>OSError</b>:</dt> |
|
785 <dd> |
|
786 raised to indicate an issue with the device |
|
787 </dd> |
|
788 </dl> |
|
789 <a NAME="MicroPythonCommandsInterface.putData" ID="MicroPythonCommandsInterface.putData"></a> |
|
790 <h4>MicroPythonCommandsInterface.putData</h4> |
|
791 <b>putData</b>(<i>deviceFileName, content</i>) |
|
792 |
|
793 <p> |
|
794 Public method to write the given data to the connected device. |
|
795 </p> |
|
796 <dl> |
|
797 |
|
798 <dt><i>deviceFileName</i> (str)</dt> |
|
799 <dd> |
|
800 name of the file to write to |
|
801 </dd> |
|
802 <dt><i>content</i> (bytes)</dt> |
|
803 <dd> |
|
804 data to write |
|
805 </dd> |
|
806 </dl> |
|
807 <dl> |
|
808 <dt>Return:</dt> |
|
809 <dd> |
|
810 flag indicating success |
|
811 </dd> |
|
812 </dl> |
|
813 <dl> |
|
814 <dt>Return Type:</dt> |
|
815 <dd> |
|
816 bool |
|
817 </dd> |
|
818 </dl> |
|
819 <dl> |
|
820 |
|
821 <dt>Raises <b>OSError</b>:</dt> |
|
822 <dd> |
|
823 raised to indicate an issue with the device |
|
824 </dd> |
|
825 </dl> |
|
826 <a NAME="MicroPythonCommandsInterface.pwd" ID="MicroPythonCommandsInterface.pwd"></a> |
|
827 <h4>MicroPythonCommandsInterface.pwd</h4> |
|
828 <b>pwd</b>(<i></i>) |
|
829 |
|
830 <p> |
|
831 Public method to get the current directory of the connected device. |
|
832 </p> |
|
833 <dl> |
|
834 <dt>Return:</dt> |
|
835 <dd> |
|
836 current directory |
|
837 </dd> |
|
838 </dl> |
|
839 <dl> |
|
840 <dt>Return Type:</dt> |
|
841 <dd> |
|
842 str |
|
843 </dd> |
|
844 </dl> |
|
845 <dl> |
|
846 |
|
847 <dt>Raises <b>OSError</b>:</dt> |
|
848 <dd> |
|
849 raised to indicate an issue with the device |
|
850 </dd> |
|
851 </dl> |
|
852 <a NAME="MicroPythonCommandsInterface.remainingTask" ID="MicroPythonCommandsInterface.remainingTask"></a> |
|
853 <h4>MicroPythonCommandsInterface.remainingTask</h4> |
|
854 <b>remainingTask</b>(<i></i>) |
|
855 |
|
856 <a NAME="MicroPythonCommandsInterface.rm" ID="MicroPythonCommandsInterface.rm"></a> |
|
857 <h4>MicroPythonCommandsInterface.rm</h4> |
|
858 <b>rm</b>(<i>filename</i>) |
|
859 |
|
860 <p> |
|
861 Public method to remove a file from the connected device. |
|
862 </p> |
|
863 <dl> |
|
864 |
|
865 <dt><i>filename</i> (str)</dt> |
|
866 <dd> |
|
867 name of the file to be removed |
|
868 </dd> |
|
869 </dl> |
|
870 <dl> |
|
871 |
|
872 <dt>Raises <b>OSError</b>:</dt> |
|
873 <dd> |
|
874 raised to indicate an issue with the device |
|
875 </dd> |
|
876 </dl> |
|
877 <a NAME="MicroPythonCommandsInterface.rmdir" ID="MicroPythonCommandsInterface.rmdir"></a> |
|
878 <h4>MicroPythonCommandsInterface.rmdir</h4> |
|
879 <b>rmdir</b>(<i>dirname</i>) |
|
880 |
|
881 <p> |
|
882 Public method to remove a directory. |
|
883 </p> |
|
884 <dl> |
|
885 |
|
886 <dt><i>dirname</i> (str)</dt> |
|
887 <dd> |
|
888 name of the directory to be removed |
|
889 </dd> |
|
890 </dl> |
|
891 <dl> |
|
892 |
|
893 <dt>Raises <b>OSError</b>:</dt> |
|
894 <dd> |
|
895 raised to indicate an issue with the device |
|
896 </dd> |
|
897 </dl> |
|
898 <a NAME="MicroPythonCommandsInterface.rmrf" ID="MicroPythonCommandsInterface.rmrf"></a> |
|
899 <h4>MicroPythonCommandsInterface.rmrf</h4> |
|
900 <b>rmrf</b>(<i>name, recursive=False, force=False</i>) |
|
901 |
|
902 <p> |
|
903 Public method to remove a file or directory recursively. |
|
904 </p> |
|
905 <dl> |
|
906 |
|
907 <dt><i>name</i> (str)</dt> |
|
908 <dd> |
|
909 of the file or directory to remove |
|
910 </dd> |
|
911 <dt><i>recursive</i> (bool)</dt> |
|
912 <dd> |
|
913 flag indicating a recursive deletion |
|
914 </dd> |
|
915 <dt><i>force</i> (bool)</dt> |
|
916 <dd> |
|
917 flag indicating to ignore errors |
|
918 </dd> |
|
919 </dl> |
|
920 <dl> |
|
921 <dt>Return:</dt> |
|
922 <dd> |
|
923 flag indicating success |
|
924 </dd> |
|
925 </dl> |
|
926 <dl> |
|
927 <dt>Return Type:</dt> |
|
928 <dd> |
|
929 bool |
|
930 </dd> |
|
931 </dl> |
|
932 <dl> |
|
933 |
|
934 <dt>Raises <b>OSError</b>:</dt> |
|
935 <dd> |
|
936 raised to indicate an issue with the device |
|
937 </dd> |
|
938 </dl> |
|
939 <a NAME="MicroPythonCommandsInterface.syncTime" ID="MicroPythonCommandsInterface.syncTime"></a> |
|
940 <h4>MicroPythonCommandsInterface.syncTime</h4> |
|
941 <b>syncTime</b>(<i>deviceType, hasCPy=False</i>) |
|
942 |
|
943 <p> |
|
944 Public method to set the time of the connected device to the local |
|
945 computer's time. |
|
946 </p> |
|
947 <dl> |
|
948 |
|
949 <dt><i>deviceType</i> (str)</dt> |
|
950 <dd> |
|
951 type of board to sync time to |
|
952 </dd> |
|
953 <dt><i>hasCPy</i> (bool)</dt> |
|
954 <dd> |
|
955 flag indicating that the device has CircuitPython loadede |
|
956 (defaults to False) |
|
957 </dd> |
|
958 </dl> |
|
959 <dl> |
|
960 |
|
961 <dt>Raises <b>OSError</b>:</dt> |
|
962 <dd> |
|
963 raised to indicate an issue with the device |
|
964 </dd> |
|
965 </dl> |
|
966 <a NAME="MicroPythonCommandsInterface.write" ID="MicroPythonCommandsInterface.write"></a> |
|
967 <h4>MicroPythonCommandsInterface.write</h4> |
|
968 <b>write</b>(<i>data</i>) |
|
969 |
|
970 <p> |
|
971 Public method to write data to the connected device. |
|
972 </p> |
|
973 <dl> |
|
974 |
|
975 <dt><i>data</i> (bytes or bytearray)</dt> |
|
976 <dd> |
|
977 data to be written |
|
978 </dd> |
|
979 </dl> |
|
980 <div align="right"><a href="#top">Up</a></div> |
|
981 <hr /> |
|
982 </body></html> |
|