src/eric7/Documentation/Source/eric7.MicroPython.Devices.DeviceBase.html

branch
eric7
changeset 9756
9854647c8c5c
child 9765
6378da868bb0
equal deleted inserted replaced
9755:1a09700229e7 9756:9854647c8c5c
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.MicroPython.Devices.DeviceBase</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.Devices.DeviceBase</h1>
10
11 <p>
12 Module implementing some utility functions and the MicroPythonDevice base
13 class.
14 </p>
15 <h3>Global Attributes</h3>
16
17 <table>
18 <tr><td>None</td></tr>
19 </table>
20 <h3>Classes</h3>
21
22 <table>
23
24 <tr>
25 <td><a href="#BaseDevice">BaseDevice</a></td>
26 <td>Base class for the more specific MicroPython devices.</td>
27 </tr>
28 </table>
29 <h3>Functions</h3>
30
31 <table>
32 <tr><td>None</td></tr>
33 </table>
34 <hr />
35 <hr />
36 <a NAME="BaseDevice" ID="BaseDevice"></a>
37 <h2>BaseDevice</h2>
38
39 <p>
40 Base class for the more specific MicroPython devices.
41 </p>
42 <h3>Derived from</h3>
43 QObject
44 <h3>Class Attributes</h3>
45
46 <table>
47 <tr><td>None</td></tr>
48 </table>
49 <h3>Class Methods</h3>
50
51 <table>
52 <tr><td>None</td></tr>
53 </table>
54 <h3>Methods</h3>
55
56 <table>
57
58 <tr>
59 <td><a href="#BaseDevice.__init__">BaseDevice</a></td>
60 <td>Constructor</td>
61 </tr>
62 <tr>
63 <td><a href="#BaseDevice.addDeviceMenuEntries">addDeviceMenuEntries</a></td>
64 <td>Public method to add device specific entries to the given menu.</td>
65 </tr>
66 <tr>
67 <td><a href="#BaseDevice.canRunScript">canRunScript</a></td>
68 <td>Public method to determine, if a script can be executed.</td>
69 </tr>
70 <tr>
71 <td><a href="#BaseDevice.canStartFileManager">canStartFileManager</a></td>
72 <td>Public method to determine, if a File Manager can be started.</td>
73 </tr>
74 <tr>
75 <td><a href="#BaseDevice.canStartPlotter">canStartPlotter</a></td>
76 <td>Public method to determine, if a Plotter can be started.</td>
77 </tr>
78 <tr>
79 <td><a href="#BaseDevice.canStartRepl">canStartRepl</a></td>
80 <td>Public method to determine, if a REPL can be started.</td>
81 </tr>
82 <tr>
83 <td><a href="#BaseDevice.checkDeviceData">checkDeviceData</a></td>
84 <td>Public method to check the validity of the device data determined during connecting the device.</td>
85 </tr>
86 <tr>
87 <td><a href="#BaseDevice.deviceName">deviceName</a></td>
88 <td>Public method to get the name of the device.</td>
89 </tr>
90 <tr>
91 <td><a href="#BaseDevice.downloadFirmware">downloadFirmware</a></td>
92 <td>Public method to download the device firmware.</td>
93 </tr>
94 <tr>
95 <td><a href="#BaseDevice.forceInterrupt">forceInterrupt</a></td>
96 <td>Public method to determine the need for an interrupt when opening the serial connection.</td>
97 </tr>
98 <tr>
99 <td><a href="#BaseDevice.getDeviceData">getDeviceData</a></td>
100 <td>Public method to get a copy of the determined device data.</td>
101 </tr>
102 <tr>
103 <td><a href="#BaseDevice.getDeviceType">getDeviceType</a></td>
104 <td>Public method to get the device type.</td>
105 </tr>
106 <tr>
107 <td><a href="#BaseDevice.getDocumentationUrl">getDocumentationUrl</a></td>
108 <td>Public method to get the device documentation URL.</td>
109 </tr>
110 <tr>
111 <td><a href="#BaseDevice.getDownloadMenuEntries">getDownloadMenuEntries</a></td>
112 <td>Public method to retrieve the entries for the downloads menu.</td>
113 </tr>
114 <tr>
115 <td><a href="#BaseDevice.getFirmwareUrl">getFirmwareUrl</a></td>
116 <td>Public method to get the device firmware download URL.</td>
117 </tr>
118 <tr>
119 <td><a href="#BaseDevice.getWorkspace">getWorkspace</a></td>
120 <td>Public method to get the workspace directory.</td>
121 </tr>
122 <tr>
123 <td><a href="#BaseDevice.handleDataFlood">handleDataFlood</a></td>
124 <td>Public slot handling a data floof from the device.</td>
125 </tr>
126 <tr>
127 <td><a href="#BaseDevice.hasDocumentationUrl">hasDocumentationUrl</a></td>
128 <td>Public method to check, if the device has a configured documentation URL.</td>
129 </tr>
130 <tr>
131 <td><a href="#BaseDevice.hasFirmwareUrl">hasFirmwareUrl</a></td>
132 <td>Public method to check, if the device has a configured firmware download URL.</td>
133 </tr>
134 <tr>
135 <td><a href="#BaseDevice.hasFlashMenuEntry">hasFlashMenuEntry</a></td>
136 <td>Public method to check, if the device has its own flash menu entry.</td>
137 </tr>
138 <tr>
139 <td><a href="#BaseDevice.hasTimeCommands">hasTimeCommands</a></td>
140 <td>Public method to check, if the device supports time commands.</td>
141 </tr>
142 <tr>
143 <td><a href="#BaseDevice.runScript">runScript</a></td>
144 <td>Public method to run the given Python script.</td>
145 </tr>
146 <tr>
147 <td><a href="#BaseDevice.selectDeviceDirectory">selectDeviceDirectory</a></td>
148 <td>Public method to select the device directory from a list of detected ones.</td>
149 </tr>
150 <tr>
151 <td><a href="#BaseDevice.sendCommands">sendCommands</a></td>
152 <td>Public method to send a list of commands to the device.</td>
153 </tr>
154 <tr>
155 <td><a href="#BaseDevice.setButtons">setButtons</a></td>
156 <td>Public method to enable the supported action buttons.</td>
157 </tr>
158 <tr>
159 <td><a href="#BaseDevice.setConnected">setConnected</a></td>
160 <td>Public method to set the connection state.</td>
161 </tr>
162 <tr>
163 <td><a href="#BaseDevice.setFileManager">setFileManager</a></td>
164 <td>Public method to set the File Manager status and dependent status.</td>
165 </tr>
166 <tr>
167 <td><a href="#BaseDevice.setPlotter">setPlotter</a></td>
168 <td>Public method to set the Plotter status and dependent status.</td>
169 </tr>
170 <tr>
171 <td><a href="#BaseDevice.setRepl">setRepl</a></td>
172 <td>Public method to set the REPL status and dependent status.</td>
173 </tr>
174 <tr>
175 <td><a href="#BaseDevice.supportsLocalFileAccess">supportsLocalFileAccess</a></td>
176 <td>Public method to indicate file access via a local directory.</td>
177 </tr>
178 </table>
179 <h3>Static Methods</h3>
180
181 <table>
182 <tr><td>None</td></tr>
183 </table>
184
185 <a NAME="BaseDevice.__init__" ID="BaseDevice.__init__"></a>
186 <h4>BaseDevice (Constructor)</h4>
187 <b>BaseDevice</b>(<i>microPythonWidget, deviceType, parent=None</i>)
188
189 <p>
190 Constructor
191 </p>
192 <dl>
193
194 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt>
195 <dd>
196 reference to the main MicroPython widget
197 </dd>
198 <dt><i>deviceType</i> (str)</dt>
199 <dd>
200 device type assigned to this device interface
201 </dd>
202 <dt><i>parent</i> (QObject)</dt>
203 <dd>
204 reference to the parent object
205 </dd>
206 </dl>
207 <a NAME="BaseDevice.addDeviceMenuEntries" ID="BaseDevice.addDeviceMenuEntries"></a>
208 <h4>BaseDevice.addDeviceMenuEntries</h4>
209 <b>addDeviceMenuEntries</b>(<i>menu</i>)
210
211 <p>
212 Public method to add device specific entries to the given menu.
213 </p>
214 <dl>
215
216 <dt><i>menu</i> (QMenu)</dt>
217 <dd>
218 reference to the context menu
219 </dd>
220 </dl>
221 <a NAME="BaseDevice.canRunScript" ID="BaseDevice.canRunScript"></a>
222 <h4>BaseDevice.canRunScript</h4>
223 <b>canRunScript</b>(<i></i>)
224
225 <p>
226 Public method to determine, if a script can be executed.
227 </p>
228 <dl>
229 <dt>Return:</dt>
230 <dd>
231 tuple containing a flag indicating it is safe to start a
232 Plotter and a reason why it cannot.
233 </dd>
234 </dl>
235 <dl>
236 <dt>Return Type:</dt>
237 <dd>
238 tuple of (bool, str)
239 </dd>
240 </dl>
241 <a NAME="BaseDevice.canStartFileManager" ID="BaseDevice.canStartFileManager"></a>
242 <h4>BaseDevice.canStartFileManager</h4>
243 <b>canStartFileManager</b>(<i></i>)
244
245 <p>
246 Public method to determine, if a File Manager can be started.
247 </p>
248 <dl>
249 <dt>Return:</dt>
250 <dd>
251 tuple containing a flag indicating it is safe to start a
252 File Manager and a reason why it cannot.
253 </dd>
254 </dl>
255 <dl>
256 <dt>Return Type:</dt>
257 <dd>
258 tuple of (bool, str)
259 </dd>
260 </dl>
261 <a NAME="BaseDevice.canStartPlotter" ID="BaseDevice.canStartPlotter"></a>
262 <h4>BaseDevice.canStartPlotter</h4>
263 <b>canStartPlotter</b>(<i></i>)
264
265 <p>
266 Public method to determine, if a Plotter can be started.
267 </p>
268 <dl>
269 <dt>Return:</dt>
270 <dd>
271 tuple containing a flag indicating it is safe to start a
272 Plotter and a reason why it cannot.
273 </dd>
274 </dl>
275 <dl>
276 <dt>Return Type:</dt>
277 <dd>
278 tuple of (bool, str)
279 </dd>
280 </dl>
281 <a NAME="BaseDevice.canStartRepl" ID="BaseDevice.canStartRepl"></a>
282 <h4>BaseDevice.canStartRepl</h4>
283 <b>canStartRepl</b>(<i></i>)
284
285 <p>
286 Public method to determine, if a REPL can be started.
287 </p>
288 <dl>
289 <dt>Return:</dt>
290 <dd>
291 tuple containing a flag indicating it is safe to start a REPL
292 and a reason why it cannot.
293 </dd>
294 </dl>
295 <dl>
296 <dt>Return Type:</dt>
297 <dd>
298 tuple of (bool, str)
299 </dd>
300 </dl>
301 <a NAME="BaseDevice.checkDeviceData" ID="BaseDevice.checkDeviceData"></a>
302 <h4>BaseDevice.checkDeviceData</h4>
303 <b>checkDeviceData</b>(<i></i>)
304
305 <p>
306 Public method to check the validity of the device data determined during
307 connecting the device.
308 </p>
309 <dl>
310 <dt>Return:</dt>
311 <dd>
312 flag indicating valid device data
313 </dd>
314 </dl>
315 <dl>
316 <dt>Return Type:</dt>
317 <dd>
318 bool
319 </dd>
320 </dl>
321 <a NAME="BaseDevice.deviceName" ID="BaseDevice.deviceName"></a>
322 <h4>BaseDevice.deviceName</h4>
323 <b>deviceName</b>(<i></i>)
324
325 <p>
326 Public method to get the name of the device.
327 </p>
328 <dl>
329 <dt>Return:</dt>
330 <dd>
331 name of the device
332 </dd>
333 </dl>
334 <dl>
335 <dt>Return Type:</dt>
336 <dd>
337 str
338 </dd>
339 </dl>
340 <a NAME="BaseDevice.downloadFirmware" ID="BaseDevice.downloadFirmware"></a>
341 <h4>BaseDevice.downloadFirmware</h4>
342 <b>downloadFirmware</b>(<i></i>)
343
344 <p>
345 Public method to download the device firmware.
346 </p>
347 <a NAME="BaseDevice.forceInterrupt" ID="BaseDevice.forceInterrupt"></a>
348 <h4>BaseDevice.forceInterrupt</h4>
349 <b>forceInterrupt</b>(<i></i>)
350
351 <p>
352 Public method to determine the need for an interrupt when opening the
353 serial connection.
354 </p>
355 <dl>
356 <dt>Return:</dt>
357 <dd>
358 flag indicating an interrupt is needed
359 </dd>
360 </dl>
361 <dl>
362 <dt>Return Type:</dt>
363 <dd>
364 bool
365 </dd>
366 </dl>
367 <a NAME="BaseDevice.getDeviceData" ID="BaseDevice.getDeviceData"></a>
368 <h4>BaseDevice.getDeviceData</h4>
369 <b>getDeviceData</b>(<i></i>)
370
371 <p>
372 Public method to get a copy of the determined device data.
373 </p>
374 <dl>
375 <dt>Return:</dt>
376 <dd>
377 dictionary containing the essential device data
378 </dd>
379 </dl>
380 <dl>
381 <dt>Return Type:</dt>
382 <dd>
383 dict
384 </dd>
385 </dl>
386 <a NAME="BaseDevice.getDeviceType" ID="BaseDevice.getDeviceType"></a>
387 <h4>BaseDevice.getDeviceType</h4>
388 <b>getDeviceType</b>(<i></i>)
389
390 <p>
391 Public method to get the device type.
392 </p>
393 <dl>
394 <dt>Return:</dt>
395 <dd>
396 type of the device
397 </dd>
398 </dl>
399 <dl>
400 <dt>Return Type:</dt>
401 <dd>
402 str
403 </dd>
404 </dl>
405 <a NAME="BaseDevice.getDocumentationUrl" ID="BaseDevice.getDocumentationUrl"></a>
406 <h4>BaseDevice.getDocumentationUrl</h4>
407 <b>getDocumentationUrl</b>(<i></i>)
408
409 <p>
410 Public method to get the device documentation URL.
411 </p>
412 <dl>
413 <dt>Return:</dt>
414 <dd>
415 documentation URL of the device
416 </dd>
417 </dl>
418 <dl>
419 <dt>Return Type:</dt>
420 <dd>
421 str
422 </dd>
423 </dl>
424 <a NAME="BaseDevice.getDownloadMenuEntries" ID="BaseDevice.getDownloadMenuEntries"></a>
425 <h4>BaseDevice.getDownloadMenuEntries</h4>
426 <b>getDownloadMenuEntries</b>(<i></i>)
427
428 <p>
429 Public method to retrieve the entries for the downloads menu.
430 </p>
431 <dl>
432 <dt>Return:</dt>
433 <dd>
434 list of tuples with menu text and URL to be opened for each
435 entry
436 </dd>
437 </dl>
438 <dl>
439 <dt>Return Type:</dt>
440 <dd>
441 list of tuple of (str, str)
442 </dd>
443 </dl>
444 <a NAME="BaseDevice.getFirmwareUrl" ID="BaseDevice.getFirmwareUrl"></a>
445 <h4>BaseDevice.getFirmwareUrl</h4>
446 <b>getFirmwareUrl</b>(<i></i>)
447
448 <p>
449 Public method to get the device firmware download URL.
450 </p>
451 <dl>
452 <dt>Return:</dt>
453 <dd>
454 firmware download URL of the device
455 </dd>
456 </dl>
457 <dl>
458 <dt>Return Type:</dt>
459 <dd>
460 str
461 </dd>
462 </dl>
463 <a NAME="BaseDevice.getWorkspace" ID="BaseDevice.getWorkspace"></a>
464 <h4>BaseDevice.getWorkspace</h4>
465 <b>getWorkspace</b>(<i></i>)
466
467 <p>
468 Public method to get the workspace directory.
469 </p>
470 <dl>
471 <dt>Return:</dt>
472 <dd>
473 workspace directory used for saving files
474 </dd>
475 </dl>
476 <dl>
477 <dt>Return Type:</dt>
478 <dd>
479 str
480 </dd>
481 </dl>
482 <a NAME="BaseDevice.handleDataFlood" ID="BaseDevice.handleDataFlood"></a>
483 <h4>BaseDevice.handleDataFlood</h4>
484 <b>handleDataFlood</b>(<i></i>)
485
486 <p>
487 Public slot handling a data floof from the device.
488 </p>
489 <a NAME="BaseDevice.hasDocumentationUrl" ID="BaseDevice.hasDocumentationUrl"></a>
490 <h4>BaseDevice.hasDocumentationUrl</h4>
491 <b>hasDocumentationUrl</b>(<i></i>)
492
493 <p>
494 Public method to check, if the device has a configured documentation
495 URL.
496 </p>
497 <dl>
498 <dt>Return:</dt>
499 <dd>
500 flag indicating a configured documentation URL
501 </dd>
502 </dl>
503 <dl>
504 <dt>Return Type:</dt>
505 <dd>
506 bool
507 </dd>
508 </dl>
509 <a NAME="BaseDevice.hasFirmwareUrl" ID="BaseDevice.hasFirmwareUrl"></a>
510 <h4>BaseDevice.hasFirmwareUrl</h4>
511 <b>hasFirmwareUrl</b>(<i></i>)
512
513 <p>
514 Public method to check, if the device has a configured firmware
515 download URL.
516 </p>
517 <dl>
518 <dt>Return:</dt>
519 <dd>
520 flag indicating a configured firmware download URL
521 </dd>
522 </dl>
523 <dl>
524 <dt>Return Type:</dt>
525 <dd>
526 bool
527 </dd>
528 </dl>
529 <a NAME="BaseDevice.hasFlashMenuEntry" ID="BaseDevice.hasFlashMenuEntry"></a>
530 <h4>BaseDevice.hasFlashMenuEntry</h4>
531 <b>hasFlashMenuEntry</b>(<i></i>)
532
533 <p>
534 Public method to check, if the device has its own flash menu entry.
535 </p>
536 <dl>
537 <dt>Return:</dt>
538 <dd>
539 flag indicating a specific flash menu entry
540 </dd>
541 </dl>
542 <dl>
543 <dt>Return Type:</dt>
544 <dd>
545 bool
546 </dd>
547 </dl>
548 <a NAME="BaseDevice.hasTimeCommands" ID="BaseDevice.hasTimeCommands"></a>
549 <h4>BaseDevice.hasTimeCommands</h4>
550 <b>hasTimeCommands</b>(<i></i>)
551
552 <p>
553 Public method to check, if the device supports time commands.
554 </p>
555 <p>
556 The default returns True.
557 </p>
558 <dl>
559 <dt>Return:</dt>
560 <dd>
561 flag indicating support for time commands
562 </dd>
563 </dl>
564 <dl>
565 <dt>Return Type:</dt>
566 <dd>
567 bool
568 </dd>
569 </dl>
570 <a NAME="BaseDevice.runScript" ID="BaseDevice.runScript"></a>
571 <h4>BaseDevice.runScript</h4>
572 <b>runScript</b>(<i>script</i>)
573
574 <p>
575 Public method to run the given Python script.
576 </p>
577 <dl>
578
579 <dt><i>script</i> (str)</dt>
580 <dd>
581 script to be executed
582 </dd>
583 </dl>
584 <a NAME="BaseDevice.selectDeviceDirectory" ID="BaseDevice.selectDeviceDirectory"></a>
585 <h4>BaseDevice.selectDeviceDirectory</h4>
586 <b>selectDeviceDirectory</b>(<i>deviceDirectories</i>)
587
588 <p>
589 Public method to select the device directory from a list of detected
590 ones.
591 </p>
592 <dl>
593
594 <dt><i>deviceDirectories</i> (list of str)</dt>
595 <dd>
596 list of directories to select from
597 </dd>
598 </dl>
599 <dl>
600 <dt>Return:</dt>
601 <dd>
602 selected directory or an empty string
603 </dd>
604 </dl>
605 <dl>
606 <dt>Return Type:</dt>
607 <dd>
608 str
609 </dd>
610 </dl>
611 <a NAME="BaseDevice.sendCommands" ID="BaseDevice.sendCommands"></a>
612 <h4>BaseDevice.sendCommands</h4>
613 <b>sendCommands</b>(<i>commandsList</i>)
614
615 <p>
616 Public method to send a list of commands to the device.
617 </p>
618 <dl>
619
620 <dt><i>commandsList</i> (list of str)</dt>
621 <dd>
622 list of commands to be sent to the device
623 </dd>
624 </dl>
625 <a NAME="BaseDevice.setButtons" ID="BaseDevice.setButtons"></a>
626 <h4>BaseDevice.setButtons</h4>
627 <b>setButtons</b>(<i></i>)
628
629 <p>
630 Public method to enable the supported action buttons.
631 </p>
632 <a NAME="BaseDevice.setConnected" ID="BaseDevice.setConnected"></a>
633 <h4>BaseDevice.setConnected</h4>
634 <b>setConnected</b>(<i>connected</i>)
635
636 <p>
637 Public method to set the connection state.
638 </p>
639 <p>
640 Note: This method can be overwritten to perform actions upon connect
641 or disconnect of the device.
642 </p>
643 <dl>
644
645 <dt><i>connected</i> (bool)</dt>
646 <dd>
647 connection state
648 </dd>
649 </dl>
650 <a NAME="BaseDevice.setFileManager" ID="BaseDevice.setFileManager"></a>
651 <h4>BaseDevice.setFileManager</h4>
652 <b>setFileManager</b>(<i>on</i>)
653
654 <p>
655 Public method to set the File Manager status and dependent status.
656 </p>
657 <dl>
658
659 <dt><i>on</i> (bool)</dt>
660 <dd>
661 flag indicating the active status
662 </dd>
663 </dl>
664 <a NAME="BaseDevice.setPlotter" ID="BaseDevice.setPlotter"></a>
665 <h4>BaseDevice.setPlotter</h4>
666 <b>setPlotter</b>(<i>on</i>)
667
668 <p>
669 Public method to set the Plotter status and dependent status.
670 </p>
671 <dl>
672
673 <dt><i>on</i> (bool)</dt>
674 <dd>
675 flag indicating the active status
676 </dd>
677 </dl>
678 <a NAME="BaseDevice.setRepl" ID="BaseDevice.setRepl"></a>
679 <h4>BaseDevice.setRepl</h4>
680 <b>setRepl</b>(<i>on</i>)
681
682 <p>
683 Public method to set the REPL status and dependent status.
684 </p>
685 <dl>
686
687 <dt><i>on</i> (bool)</dt>
688 <dd>
689 flag indicating the active status
690 </dd>
691 </dl>
692 <a NAME="BaseDevice.supportsLocalFileAccess" ID="BaseDevice.supportsLocalFileAccess"></a>
693 <h4>BaseDevice.supportsLocalFileAccess</h4>
694 <b>supportsLocalFileAccess</b>(<i></i>)
695
696 <p>
697 Public method to indicate file access via a local directory.
698 </p>
699 <dl>
700 <dt>Return:</dt>
701 <dd>
702 flag indicating file access via local directory
703 </dd>
704 </dl>
705 <dl>
706 <dt>Return Type:</dt>
707 <dd>
708 bool
709 </dd>
710 </dl>
711 <div align="right"><a href="#top">Up</a></div>
712 <hr />
713 </body></html>

eric ide

mercurial