5 <link rel="stylesheet" href="styles.css"> |
5 <link rel="stylesheet" href="styles.css"> |
6 </head> |
6 </head> |
7 <body> |
7 <body> |
8 <a NAME="top" ID="top"></a> |
8 <a NAME="top" ID="top"></a> |
9 <h1>eric7.MicroPython.MicroPythonSerialDeviceInterface</h1> |
9 <h1>eric7.MicroPython.MicroPythonSerialDeviceInterface</h1> |
10 |
|
11 <p> |
10 <p> |
12 Module implementing an interface to talk to a connected MicroPython device via |
11 Module implementing an interface to talk to a connected MicroPython device via |
13 a serial link. |
12 a serial link. |
14 </p> |
13 </p> |
|
14 |
15 <h3>Global Attributes</h3> |
15 <h3>Global Attributes</h3> |
16 |
|
17 <table> |
16 <table> |
18 <tr><td>None</td></tr> |
17 <tr><td>None</td></tr> |
19 </table> |
18 </table> |
|
19 |
20 <h3>Classes</h3> |
20 <h3>Classes</h3> |
21 |
21 <table> |
22 <table> |
|
23 |
|
24 <tr> |
22 <tr> |
25 <td><a href="#MicroPythonSerialDeviceInterface">MicroPythonSerialDeviceInterface</a></td> |
23 <td><a href="#MicroPythonSerialDeviceInterface">MicroPythonSerialDeviceInterface</a></td> |
26 <td>Class implementing an interface to talk to a connected MicroPython device via a serial link.</td> |
24 <td>Class implementing an interface to talk to a connected MicroPython device via a serial link.</td> |
27 </tr> |
25 </tr> |
28 </table> |
26 </table> |
|
27 |
29 <h3>Functions</h3> |
28 <h3>Functions</h3> |
30 |
|
31 <table> |
29 <table> |
32 <tr><td>None</td></tr> |
30 <tr><td>None</td></tr> |
33 </table> |
31 </table> |
|
32 |
34 <hr /> |
33 <hr /> |
35 <hr /> |
34 <hr /> |
36 <a NAME="MicroPythonSerialDeviceInterface" ID="MicroPythonSerialDeviceInterface"></a> |
35 <a NAME="MicroPythonSerialDeviceInterface" ID="MicroPythonSerialDeviceInterface"></a> |
37 <h2>MicroPythonSerialDeviceInterface</h2> |
36 <h2>MicroPythonSerialDeviceInterface</h2> |
38 |
|
39 <p> |
37 <p> |
40 Class implementing an interface to talk to a connected MicroPython device via |
38 Class implementing an interface to talk to a connected MicroPython device via |
41 a serial link. |
39 a serial link. |
42 </p> |
40 </p> |
|
41 |
43 <h3>Derived from</h3> |
42 <h3>Derived from</h3> |
44 MicroPythonDeviceInterface |
43 MicroPythonDeviceInterface |
45 <h3>Class Attributes</h3> |
44 <h3>Class Attributes</h3> |
46 |
|
47 <table> |
45 <table> |
48 <tr><td>None</td></tr> |
46 <tr><td>None</td></tr> |
49 </table> |
47 </table> |
|
48 |
50 <h3>Class Methods</h3> |
49 <h3>Class Methods</h3> |
51 |
|
52 <table> |
50 <table> |
53 <tr><td>None</td></tr> |
51 <tr><td>None</td></tr> |
54 </table> |
52 </table> |
|
53 |
55 <h3>Methods</h3> |
54 <h3>Methods</h3> |
56 |
55 <table> |
57 <table> |
|
58 |
|
59 <tr> |
56 <tr> |
60 <td><a href="#MicroPythonSerialDeviceInterface.__init__">MicroPythonSerialDeviceInterface</a></td> |
57 <td><a href="#MicroPythonSerialDeviceInterface.__init__">MicroPythonSerialDeviceInterface</a></td> |
61 <td>Constructor</td> |
58 <td>Constructor</td> |
62 </tr> |
59 </tr> |
63 <tr> |
60 <tr> |
127 <tr> |
124 <tr> |
128 <td><a href="#MicroPythonSerialDeviceInterface.write">write</a></td> |
125 <td><a href="#MicroPythonSerialDeviceInterface.write">write</a></td> |
129 <td>Public method to write data to the connected device.</td> |
126 <td>Public method to write data to the connected device.</td> |
130 </tr> |
127 </tr> |
131 </table> |
128 </table> |
|
129 |
132 <h3>Static Methods</h3> |
130 <h3>Static Methods</h3> |
133 |
|
134 <table> |
131 <table> |
135 <tr><td>None</td></tr> |
132 <tr><td>None</td></tr> |
136 </table> |
133 </table> |
|
134 |
137 |
135 |
138 <a NAME="MicroPythonSerialDeviceInterface.__init__" ID="MicroPythonSerialDeviceInterface.__init__"></a> |
136 <a NAME="MicroPythonSerialDeviceInterface.__init__" ID="MicroPythonSerialDeviceInterface.__init__"></a> |
139 <h4>MicroPythonSerialDeviceInterface (Constructor)</h4> |
137 <h4>MicroPythonSerialDeviceInterface (Constructor)</h4> |
140 <b>MicroPythonSerialDeviceInterface</b>(<i>parent=None</i>) |
138 <b>MicroPythonSerialDeviceInterface</b>(<i>parent=None</i>) |
141 |
|
142 <p> |
139 <p> |
143 Constructor |
140 Constructor |
144 </p> |
141 </p> |
|
142 |
145 <dl> |
143 <dl> |
146 |
144 |
147 <dt><i>parent</i> (QObject)</dt> |
145 <dt><i>parent</i> (QObject)</dt> |
148 <dd> |
146 <dd> |
149 reference to the parent object |
147 reference to the parent object |
150 </dd> |
148 </dd> |
151 </dl> |
149 </dl> |
152 <a NAME="MicroPythonSerialDeviceInterface.__executeAsyncPaste" ID="MicroPythonSerialDeviceInterface.__executeAsyncPaste"></a> |
150 <a NAME="MicroPythonSerialDeviceInterface.__executeAsyncPaste" ID="MicroPythonSerialDeviceInterface.__executeAsyncPaste"></a> |
153 <h4>MicroPythonSerialDeviceInterface.__executeAsyncPaste</h4> |
151 <h4>MicroPythonSerialDeviceInterface.__executeAsyncPaste</h4> |
154 <b>__executeAsyncPaste</b>(<i>commandsList</i>) |
152 <b>__executeAsyncPaste</b>(<i>commandsList</i>) |
155 |
|
156 <p> |
153 <p> |
157 Private method to execute a series of commands over a period of time |
154 Private method to execute a series of commands over a period of time |
158 without returning any result (asynchronous execution). |
155 without returning any result (asynchronous execution). |
159 </p> |
156 </p> |
|
157 |
160 <dl> |
158 <dl> |
161 |
159 |
162 <dt><i>commandsList</i> (list of str)</dt> |
160 <dt><i>commandsList</i> (list of str)</dt> |
163 <dd> |
161 <dd> |
164 list of commands to be execute on the device |
162 list of commands to be execute on the device |
165 </dd> |
163 </dd> |
166 </dl> |
164 </dl> |
167 <a NAME="MicroPythonSerialDeviceInterface.__executeAsyncRaw" ID="MicroPythonSerialDeviceInterface.__executeAsyncRaw"></a> |
165 <a NAME="MicroPythonSerialDeviceInterface.__executeAsyncRaw" ID="MicroPythonSerialDeviceInterface.__executeAsyncRaw"></a> |
168 <h4>MicroPythonSerialDeviceInterface.__executeAsyncRaw</h4> |
166 <h4>MicroPythonSerialDeviceInterface.__executeAsyncRaw</h4> |
169 <b>__executeAsyncRaw</b>(<i>commandsList</i>) |
167 <b>__executeAsyncRaw</b>(<i>commandsList</i>) |
170 |
|
171 <p> |
168 <p> |
172 Private method to execute a series of commands over a period of time |
169 Private method to execute a series of commands over a period of time |
173 without returning any result (asynchronous execution). |
170 without returning any result (asynchronous execution). |
174 </p> |
171 </p> |
|
172 |
175 <dl> |
173 <dl> |
176 |
174 |
177 <dt><i>commandsList</i> (list of bytes)</dt> |
175 <dt><i>commandsList</i> (list of bytes)</dt> |
178 <dd> |
176 <dd> |
179 list of commands to be execute on the device |
177 list of commands to be execute on the device |
180 </dd> |
178 </dd> |
181 </dl> |
179 </dl> |
182 <a NAME="MicroPythonSerialDeviceInterface.__execute_paste" ID="MicroPythonSerialDeviceInterface.__execute_paste"></a> |
180 <a NAME="MicroPythonSerialDeviceInterface.__execute_paste" ID="MicroPythonSerialDeviceInterface.__execute_paste"></a> |
183 <h4>MicroPythonSerialDeviceInterface.__execute_paste</h4> |
181 <h4>MicroPythonSerialDeviceInterface.__execute_paste</h4> |
184 <b>__execute_paste</b>(<i>commands, timeout=0</i>) |
182 <b>__execute_paste</b>(<i>commands, timeout=0</i>) |
185 |
|
186 <p> |
183 <p> |
187 Private method to send commands to the connected device using 'paste' mode |
184 Private method to send commands to the connected device using 'paste' mode |
188 and return the result. |
185 and return the result. |
189 </p> |
186 </p> |
190 <p> |
187 <p> |
191 If no serial connection is available, empty results will be returned. |
188 If no serial connection is available, empty results will be returned. |
192 </p> |
189 </p> |
|
190 |
193 <dl> |
191 <dl> |
194 |
192 |
195 <dt><i>commands</i> (str or list of str)</dt> |
193 <dt><i>commands</i> (str or list of str)</dt> |
196 <dd> |
194 <dd> |
197 list of commands to be executed |
195 list of commands to be executed |
215 </dd> |
213 </dd> |
216 </dl> |
214 </dl> |
217 <a NAME="MicroPythonSerialDeviceInterface.__execute_raw" ID="MicroPythonSerialDeviceInterface.__execute_raw"></a> |
215 <a NAME="MicroPythonSerialDeviceInterface.__execute_raw" ID="MicroPythonSerialDeviceInterface.__execute_raw"></a> |
218 <h4>MicroPythonSerialDeviceInterface.__execute_raw</h4> |
216 <h4>MicroPythonSerialDeviceInterface.__execute_raw</h4> |
219 <b>__execute_raw</b>(<i>commands, timeout=0</i>) |
217 <b>__execute_raw</b>(<i>commands, timeout=0</i>) |
220 |
|
221 <p> |
218 <p> |
222 Private method to send commands to the connected device using 'raw REPL' mode |
219 Private method to send commands to the connected device using 'raw REPL' mode |
223 and return the result. |
220 and return the result. |
224 </p> |
221 </p> |
225 <p> |
222 <p> |
226 If no serial connection is available, empty results will be returned. |
223 If no serial connection is available, empty results will be returned. |
227 </p> |
224 </p> |
|
225 |
228 <dl> |
226 <dl> |
229 |
227 |
230 <dt><i>commands</i> (str or list of str)</dt> |
228 <dt><i>commands</i> (str or list of str)</dt> |
231 <dd> |
229 <dd> |
232 list of commands to be executed |
230 list of commands to be executed |
250 </dd> |
248 </dd> |
251 </dl> |
249 </dl> |
252 <a NAME="MicroPythonSerialDeviceInterface.__pasteOff" ID="MicroPythonSerialDeviceInterface.__pasteOff"></a> |
250 <a NAME="MicroPythonSerialDeviceInterface.__pasteOff" ID="MicroPythonSerialDeviceInterface.__pasteOff"></a> |
253 <h4>MicroPythonSerialDeviceInterface.__pasteOff</h4> |
251 <h4>MicroPythonSerialDeviceInterface.__pasteOff</h4> |
254 <b>__pasteOff</b>(<i></i>) |
252 <b>__pasteOff</b>(<i></i>) |
255 |
|
256 <p> |
253 <p> |
257 Private method to switch 'paste' mode off. |
254 Private method to switch 'paste' mode off. |
258 </p> |
255 </p> |
|
256 |
259 <a NAME="MicroPythonSerialDeviceInterface.__pasteOn" ID="MicroPythonSerialDeviceInterface.__pasteOn"></a> |
257 <a NAME="MicroPythonSerialDeviceInterface.__pasteOn" ID="MicroPythonSerialDeviceInterface.__pasteOn"></a> |
260 <h4>MicroPythonSerialDeviceInterface.__pasteOn</h4> |
258 <h4>MicroPythonSerialDeviceInterface.__pasteOn</h4> |
261 <b>__pasteOn</b>(<i></i>) |
259 <b>__pasteOn</b>(<i></i>) |
262 |
|
263 <p> |
260 <p> |
264 Private method to switch the connected device to 'paste' mode. |
261 Private method to switch the connected device to 'paste' mode. |
265 </p> |
262 </p> |
266 <p> |
263 <p> |
267 Note: switching to paste mode is done with synchronous writes. |
264 Note: switching to paste mode is done with synchronous writes. |
268 </p> |
265 </p> |
|
266 |
269 <dl> |
267 <dl> |
270 <dt>Return:</dt> |
268 <dt>Return:</dt> |
271 <dd> |
269 <dd> |
272 flag indicating success |
270 flag indicating success |
273 </dd> |
271 </dd> |
279 </dd> |
277 </dd> |
280 </dl> |
278 </dl> |
281 <a NAME="MicroPythonSerialDeviceInterface.__rawOff" ID="MicroPythonSerialDeviceInterface.__rawOff"></a> |
279 <a NAME="MicroPythonSerialDeviceInterface.__rawOff" ID="MicroPythonSerialDeviceInterface.__rawOff"></a> |
282 <h4>MicroPythonSerialDeviceInterface.__rawOff</h4> |
280 <h4>MicroPythonSerialDeviceInterface.__rawOff</h4> |
283 <b>__rawOff</b>(<i></i>) |
281 <b>__rawOff</b>(<i></i>) |
284 |
|
285 <p> |
282 <p> |
286 Private method to switch 'raw' mode off. |
283 Private method to switch 'raw' mode off. |
287 </p> |
284 </p> |
|
285 |
288 <a NAME="MicroPythonSerialDeviceInterface.__rawOn" ID="MicroPythonSerialDeviceInterface.__rawOn"></a> |
286 <a NAME="MicroPythonSerialDeviceInterface.__rawOn" ID="MicroPythonSerialDeviceInterface.__rawOn"></a> |
289 <h4>MicroPythonSerialDeviceInterface.__rawOn</h4> |
287 <h4>MicroPythonSerialDeviceInterface.__rawOn</h4> |
290 <b>__rawOn</b>(<i></i>) |
288 <b>__rawOn</b>(<i></i>) |
291 |
|
292 <p> |
289 <p> |
293 Private method to switch the connected device to 'raw' mode. |
290 Private method to switch the connected device to 'raw' mode. |
294 </p> |
291 </p> |
295 <p> |
292 <p> |
296 Note: switching to raw mode is done with synchronous writes. |
293 Note: switching to raw mode is done with synchronous writes. |
297 </p> |
294 </p> |
|
295 |
298 <dl> |
296 <dl> |
299 <dt>Return:</dt> |
297 <dt>Return:</dt> |
300 <dd> |
298 <dd> |
301 flag indicating success |
299 flag indicating success |
302 </dd> |
300 </dd> |
308 </dd> |
306 </dd> |
309 </dl> |
307 </dl> |
310 <a NAME="MicroPythonSerialDeviceInterface.__readSerial" ID="MicroPythonSerialDeviceInterface.__readSerial"></a> |
308 <a NAME="MicroPythonSerialDeviceInterface.__readSerial" ID="MicroPythonSerialDeviceInterface.__readSerial"></a> |
311 <h4>MicroPythonSerialDeviceInterface.__readSerial</h4> |
309 <h4>MicroPythonSerialDeviceInterface.__readSerial</h4> |
312 <b>__readSerial</b>(<i></i>) |
310 <b>__readSerial</b>(<i></i>) |
313 |
|
314 <p> |
311 <p> |
315 Private slot to read all available serial data and emit it with the |
312 Private slot to read all available serial data and emit it with the |
316 "dataReceived" signal for further processing. |
313 "dataReceived" signal for further processing. |
317 </p> |
314 </p> |
|
315 |
318 <a NAME="MicroPythonSerialDeviceInterface.connectToDevice" ID="MicroPythonSerialDeviceInterface.connectToDevice"></a> |
316 <a NAME="MicroPythonSerialDeviceInterface.connectToDevice" ID="MicroPythonSerialDeviceInterface.connectToDevice"></a> |
319 <h4>MicroPythonSerialDeviceInterface.connectToDevice</h4> |
317 <h4>MicroPythonSerialDeviceInterface.connectToDevice</h4> |
320 <b>connectToDevice</b>(<i>connection</i>) |
318 <b>connectToDevice</b>(<i>connection</i>) |
321 |
|
322 <p> |
319 <p> |
323 Public method to connect to the device. |
320 Public method to connect to the device. |
324 </p> |
321 </p> |
|
322 |
325 <dl> |
323 <dl> |
326 |
324 |
327 <dt><i>connection</i> (str)</dt> |
325 <dt><i>connection</i> (str)</dt> |
328 <dd> |
326 <dd> |
329 name of the connection to be used |
327 name of the connection to be used |
342 </dd> |
340 </dd> |
343 </dl> |
341 </dl> |
344 <a NAME="MicroPythonSerialDeviceInterface.disconnectFromDevice" ID="MicroPythonSerialDeviceInterface.disconnectFromDevice"></a> |
342 <a NAME="MicroPythonSerialDeviceInterface.disconnectFromDevice" ID="MicroPythonSerialDeviceInterface.disconnectFromDevice"></a> |
345 <h4>MicroPythonSerialDeviceInterface.disconnectFromDevice</h4> |
343 <h4>MicroPythonSerialDeviceInterface.disconnectFromDevice</h4> |
346 <b>disconnectFromDevice</b>(<i></i>) |
344 <b>disconnectFromDevice</b>(<i></i>) |
347 |
|
348 <p> |
345 <p> |
349 Public slot to disconnect from the device. |
346 Public slot to disconnect from the device. |
350 </p> |
347 </p> |
|
348 |
351 <a NAME="MicroPythonSerialDeviceInterface.execute" ID="MicroPythonSerialDeviceInterface.execute"></a> |
349 <a NAME="MicroPythonSerialDeviceInterface.execute" ID="MicroPythonSerialDeviceInterface.execute"></a> |
352 <h4>MicroPythonSerialDeviceInterface.execute</h4> |
350 <h4>MicroPythonSerialDeviceInterface.execute</h4> |
353 <b>execute</b>(<i>commands, *, mode="raw", timeout=0</i>) |
351 <b>execute</b>(<i>commands, *, mode="raw", timeout=0</i>) |
354 |
|
355 <p> |
352 <p> |
356 Public method to send commands to the connected device and return the |
353 Public method to send commands to the connected device and return the |
357 result. |
354 result. |
358 </p> |
355 </p> |
359 <p> |
356 <p> |
360 If no serial connection is available, empty results will be returned. |
357 If no serial connection is available, empty results will be returned. |
361 </p> |
358 </p> |
|
359 |
362 <dl> |
360 <dl> |
363 |
361 |
364 <dt><i>commands</i> (str or list of str)</dt> |
362 <dt><i>commands</i> (str or list of str)</dt> |
365 <dd> |
363 <dd> |
366 list of commands to be executed |
364 list of commands to be executed |
396 </dd> |
394 </dd> |
397 </dl> |
395 </dl> |
398 <a NAME="MicroPythonSerialDeviceInterface.executeAsync" ID="MicroPythonSerialDeviceInterface.executeAsync"></a> |
396 <a NAME="MicroPythonSerialDeviceInterface.executeAsync" ID="MicroPythonSerialDeviceInterface.executeAsync"></a> |
399 <h4>MicroPythonSerialDeviceInterface.executeAsync</h4> |
397 <h4>MicroPythonSerialDeviceInterface.executeAsync</h4> |
400 <b>executeAsync</b>(<i>commandsList, submitMode</i>) |
398 <b>executeAsync</b>(<i>commandsList, submitMode</i>) |
401 |
|
402 <p> |
399 <p> |
403 Public method to execute a series of commands over a period of time |
400 Public method to execute a series of commands over a period of time |
404 without returning any result (asynchronous execution). |
401 without returning any result (asynchronous execution). |
405 </p> |
402 </p> |
|
403 |
406 <dl> |
404 <dl> |
407 |
405 |
408 <dt><i>commandsList</i> (list of str)</dt> |
406 <dt><i>commandsList</i> (list of str)</dt> |
409 <dd> |
407 <dd> |
410 list of commands to be execute on the device |
408 list of commands to be execute on the device |
422 </dd> |
420 </dd> |
423 </dl> |
421 </dl> |
424 <a NAME="MicroPythonSerialDeviceInterface.handlePreferencesChanged" ID="MicroPythonSerialDeviceInterface.handlePreferencesChanged"></a> |
422 <a NAME="MicroPythonSerialDeviceInterface.handlePreferencesChanged" ID="MicroPythonSerialDeviceInterface.handlePreferencesChanged"></a> |
425 <h4>MicroPythonSerialDeviceInterface.handlePreferencesChanged</h4> |
423 <h4>MicroPythonSerialDeviceInterface.handlePreferencesChanged</h4> |
426 <b>handlePreferencesChanged</b>(<i></i>) |
424 <b>handlePreferencesChanged</b>(<i></i>) |
427 |
|
428 <p> |
425 <p> |
429 Public slot to handle a change of the preferences. |
426 Public slot to handle a change of the preferences. |
430 </p> |
427 </p> |
|
428 |
431 <a NAME="MicroPythonSerialDeviceInterface.isConnected" ID="MicroPythonSerialDeviceInterface.isConnected"></a> |
429 <a NAME="MicroPythonSerialDeviceInterface.isConnected" ID="MicroPythonSerialDeviceInterface.isConnected"></a> |
432 <h4>MicroPythonSerialDeviceInterface.isConnected</h4> |
430 <h4>MicroPythonSerialDeviceInterface.isConnected</h4> |
433 <b>isConnected</b>(<i></i>) |
431 <b>isConnected</b>(<i></i>) |
434 |
|
435 <p> |
432 <p> |
436 Public method to get the connection status. |
433 Public method to get the connection status. |
437 </p> |
434 </p> |
|
435 |
438 <dl> |
436 <dl> |
439 <dt>Return:</dt> |
437 <dt>Return:</dt> |
440 <dd> |
438 <dd> |
441 flag indicating the connection status |
439 flag indicating the connection status |
442 </dd> |
440 </dd> |