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.MicroPythonWebreplDeviceInterface</h1> |
9 <h1>eric7.MicroPython.MicroPythonWebreplDeviceInterface</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 webrepl connection. |
12 a webrepl connection. |
14 </p> |
13 </p> |
|
14 |
15 <h3>Global Attributes</h3> |
15 <h3>Global Attributes</h3> |
16 |
16 <table> |
17 <table> |
17 <tr><td>None</td></tr> |
18 <tr><td>None</td></tr> |
18 </table> |
19 </table> |
19 |
20 <h3>Classes</h3> |
20 <h3>Classes</h3> |
21 |
21 <table> |
22 <table> |
|
23 |
|
24 <tr> |
22 <tr> |
25 <td><a href="#MicroPythonWebreplDeviceInterface">MicroPythonWebreplDeviceInterface</a></td> |
23 <td><a href="#MicroPythonWebreplDeviceInterface">MicroPythonWebreplDeviceInterface</a></td> |
26 <td>Class implementing an interface to talk to a connected MicroPython device via a webrepl connection.</td> |
24 <td>Class implementing an interface to talk to a connected MicroPython device via a webrepl connection.</td> |
27 </tr> |
25 </tr> |
28 </table> |
26 </table> |
|
27 |
29 <h3>Functions</h3> |
28 <h3>Functions</h3> |
30 |
29 <table> |
31 <table> |
30 <tr><td>None</td></tr> |
32 <tr><td>None</td></tr> |
31 </table> |
33 </table> |
32 |
34 <hr /> |
33 <hr /> |
35 <hr /> |
34 <hr /> |
36 <a NAME="MicroPythonWebreplDeviceInterface" ID="MicroPythonWebreplDeviceInterface"></a> |
35 <a NAME="MicroPythonWebreplDeviceInterface" ID="MicroPythonWebreplDeviceInterface"></a> |
37 <h2>MicroPythonWebreplDeviceInterface</h2> |
36 <h2>MicroPythonWebreplDeviceInterface</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 webrepl connection. |
39 a webrepl connection. |
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 |
45 <table> |
47 <table> |
46 <tr><td>None</td></tr> |
48 <tr><td>None</td></tr> |
47 </table> |
49 </table> |
48 |
50 <h3>Class Methods</h3> |
49 <h3>Class Methods</h3> |
51 |
50 <table> |
52 <table> |
51 <tr><td>None</td></tr> |
53 <tr><td>None</td></tr> |
52 </table> |
54 </table> |
53 |
55 <h3>Methods</h3> |
54 <h3>Methods</h3> |
56 |
55 <table> |
57 <table> |
|
58 |
|
59 <tr> |
56 <tr> |
60 <td><a href="#MicroPythonWebreplDeviceInterface.__init__">MicroPythonWebreplDeviceInterface</a></td> |
57 <td><a href="#MicroPythonWebreplDeviceInterface.__init__">MicroPythonWebreplDeviceInterface</a></td> |
61 <td>Constructor</td> |
58 <td>Constructor</td> |
62 </tr> |
59 </tr> |
63 <tr> |
60 <tr> |
107 <tr> |
104 <tr> |
108 <td><a href="#MicroPythonWebreplDeviceInterface.write">write</a></td> |
105 <td><a href="#MicroPythonWebreplDeviceInterface.write">write</a></td> |
109 <td>Public method to write data to the connected device.</td> |
106 <td>Public method to write data to the connected device.</td> |
110 </tr> |
107 </tr> |
111 </table> |
108 </table> |
|
109 |
112 <h3>Static Methods</h3> |
110 <h3>Static Methods</h3> |
113 |
111 <table> |
114 <table> |
112 <tr><td>None</td></tr> |
115 <tr><td>None</td></tr> |
113 </table> |
116 </table> |
114 |
117 |
115 |
118 <a NAME="MicroPythonWebreplDeviceInterface.__init__" ID="MicroPythonWebreplDeviceInterface.__init__"></a> |
116 <a NAME="MicroPythonWebreplDeviceInterface.__init__" ID="MicroPythonWebreplDeviceInterface.__init__"></a> |
119 <h4>MicroPythonWebreplDeviceInterface (Constructor)</h4> |
117 <h4>MicroPythonWebreplDeviceInterface (Constructor)</h4> |
120 <b>MicroPythonWebreplDeviceInterface</b>(<i>parent=None</i>) |
118 <b>MicroPythonWebreplDeviceInterface</b>(<i>parent=None</i>) |
121 |
|
122 <p> |
119 <p> |
123 Constructor |
120 Constructor |
124 </p> |
121 </p> |
|
122 |
125 <dl> |
123 <dl> |
126 |
124 |
127 <dt><i>parent</i> (QObject)</dt> |
125 <dt><i>parent</i> (QObject)</dt> |
128 <dd> |
126 <dd> |
129 reference to the parent object |
127 reference to the parent object |
130 </dd> |
128 </dd> |
131 </dl> |
129 </dl> |
132 <a NAME="MicroPythonWebreplDeviceInterface.__pasteOff" ID="MicroPythonWebreplDeviceInterface.__pasteOff"></a> |
130 <a NAME="MicroPythonWebreplDeviceInterface.__pasteOff" ID="MicroPythonWebreplDeviceInterface.__pasteOff"></a> |
133 <h4>MicroPythonWebreplDeviceInterface.__pasteOff</h4> |
131 <h4>MicroPythonWebreplDeviceInterface.__pasteOff</h4> |
134 <b>__pasteOff</b>(<i></i>) |
132 <b>__pasteOff</b>(<i></i>) |
135 |
|
136 <p> |
133 <p> |
137 Private method to switch 'paste' mode off. |
134 Private method to switch 'paste' mode off. |
138 </p> |
135 </p> |
|
136 |
139 <a NAME="MicroPythonWebreplDeviceInterface.__pasteOn" ID="MicroPythonWebreplDeviceInterface.__pasteOn"></a> |
137 <a NAME="MicroPythonWebreplDeviceInterface.__pasteOn" ID="MicroPythonWebreplDeviceInterface.__pasteOn"></a> |
140 <h4>MicroPythonWebreplDeviceInterface.__pasteOn</h4> |
138 <h4>MicroPythonWebreplDeviceInterface.__pasteOn</h4> |
141 <b>__pasteOn</b>(<i></i>) |
139 <b>__pasteOn</b>(<i></i>) |
142 |
|
143 <p> |
140 <p> |
144 Private method to switch the connected device to 'paste' mode. |
141 Private method to switch the connected device to 'paste' mode. |
145 </p> |
142 </p> |
146 <p> |
143 <p> |
147 Note: switching to paste mode is done with synchronous writes. |
144 Note: switching to paste mode is done with synchronous writes. |
148 </p> |
145 </p> |
|
146 |
149 <dl> |
147 <dl> |
150 <dt>Return:</dt> |
148 <dt>Return:</dt> |
151 <dd> |
149 <dd> |
152 flag indicating success |
150 flag indicating success |
153 </dd> |
151 </dd> |
159 </dd> |
157 </dd> |
160 </dl> |
158 </dl> |
161 <a NAME="MicroPythonWebreplDeviceInterface.__readAll" ID="MicroPythonWebreplDeviceInterface.__readAll"></a> |
159 <a NAME="MicroPythonWebreplDeviceInterface.__readAll" ID="MicroPythonWebreplDeviceInterface.__readAll"></a> |
162 <h4>MicroPythonWebreplDeviceInterface.__readAll</h4> |
160 <h4>MicroPythonWebreplDeviceInterface.__readAll</h4> |
163 <b>__readAll</b>(<i></i>) |
161 <b>__readAll</b>(<i></i>) |
164 |
|
165 <p> |
162 <p> |
166 Private method to read all data and emit it for further processing. |
163 Private method to read all data and emit it for further processing. |
167 </p> |
164 </p> |
|
165 |
168 <a NAME="MicroPythonWebreplDeviceInterface.__readSocket" ID="MicroPythonWebreplDeviceInterface.__readSocket"></a> |
166 <a NAME="MicroPythonWebreplDeviceInterface.__readSocket" ID="MicroPythonWebreplDeviceInterface.__readSocket"></a> |
169 <h4>MicroPythonWebreplDeviceInterface.__readSocket</h4> |
167 <h4>MicroPythonWebreplDeviceInterface.__readSocket</h4> |
170 <b>__readSocket</b>(<i></i>) |
168 <b>__readSocket</b>(<i></i>) |
171 |
|
172 <p> |
169 <p> |
173 Private slot to read all available data and emit it with the |
170 Private slot to read all available data and emit it with the |
174 "dataReceived" signal for further processing. |
171 "dataReceived" signal for further processing. |
175 </p> |
172 </p> |
|
173 |
176 <a NAME="MicroPythonWebreplDeviceInterface.connectToDevice" ID="MicroPythonWebreplDeviceInterface.connectToDevice"></a> |
174 <a NAME="MicroPythonWebreplDeviceInterface.connectToDevice" ID="MicroPythonWebreplDeviceInterface.connectToDevice"></a> |
177 <h4>MicroPythonWebreplDeviceInterface.connectToDevice</h4> |
175 <h4>MicroPythonWebreplDeviceInterface.connectToDevice</h4> |
178 <b>connectToDevice</b>(<i>connection</i>) |
176 <b>connectToDevice</b>(<i>connection</i>) |
179 |
|
180 <p> |
177 <p> |
181 Public method to connect to the device. |
178 Public method to connect to the device. |
182 </p> |
179 </p> |
|
180 |
183 <dl> |
181 <dl> |
184 |
182 |
185 <dt><i>connection</i> (str)</dt> |
183 <dt><i>connection</i> (str)</dt> |
186 <dd> |
184 <dd> |
187 name of the connection to be used in the form of an URL string |
185 name of the connection to be used in the form of an URL string |
201 </dd> |
199 </dd> |
202 </dl> |
200 </dl> |
203 <a NAME="MicroPythonWebreplDeviceInterface.disconnectFromDevice" ID="MicroPythonWebreplDeviceInterface.disconnectFromDevice"></a> |
201 <a NAME="MicroPythonWebreplDeviceInterface.disconnectFromDevice" ID="MicroPythonWebreplDeviceInterface.disconnectFromDevice"></a> |
204 <h4>MicroPythonWebreplDeviceInterface.disconnectFromDevice</h4> |
202 <h4>MicroPythonWebreplDeviceInterface.disconnectFromDevice</h4> |
205 <b>disconnectFromDevice</b>(<i></i>) |
203 <b>disconnectFromDevice</b>(<i></i>) |
206 |
|
207 <p> |
204 <p> |
208 Public slot to disconnect from the device. |
205 Public slot to disconnect from the device. |
209 </p> |
206 </p> |
|
207 |
210 <a NAME="MicroPythonWebreplDeviceInterface.execute" ID="MicroPythonWebreplDeviceInterface.execute"></a> |
208 <a NAME="MicroPythonWebreplDeviceInterface.execute" ID="MicroPythonWebreplDeviceInterface.execute"></a> |
211 <h4>MicroPythonWebreplDeviceInterface.execute</h4> |
209 <h4>MicroPythonWebreplDeviceInterface.execute</h4> |
212 <b>execute</b>(<i>commands, *, mode="raw", timeout=0</i>) |
210 <b>execute</b>(<i>commands, *, mode="raw", timeout=0</i>) |
213 |
|
214 <p> |
211 <p> |
215 Public method to send commands to the connected device and return the |
212 Public method to send commands to the connected device and return the |
216 result. |
213 result. |
217 </p> |
214 </p> |
|
215 |
218 <dl> |
216 <dl> |
219 |
217 |
220 <dt><i>commands</i> (str or list of str)</dt> |
218 <dt><i>commands</i> (str or list of str)</dt> |
221 <dd> |
219 <dd> |
222 list of commands to be executed |
220 list of commands to be executed |
245 </dd> |
243 </dd> |
246 </dl> |
244 </dl> |
247 <a NAME="MicroPythonWebreplDeviceInterface.executeAsync" ID="MicroPythonWebreplDeviceInterface.executeAsync"></a> |
245 <a NAME="MicroPythonWebreplDeviceInterface.executeAsync" ID="MicroPythonWebreplDeviceInterface.executeAsync"></a> |
248 <h4>MicroPythonWebreplDeviceInterface.executeAsync</h4> |
246 <h4>MicroPythonWebreplDeviceInterface.executeAsync</h4> |
249 <b>executeAsync</b>(<i>commandsList, submitMode</i>) |
247 <b>executeAsync</b>(<i>commandsList, submitMode</i>) |
250 |
|
251 <p> |
248 <p> |
252 Public method to execute a series of commands over a period of time |
249 Public method to execute a series of commands over a period of time |
253 without returning any result (asynchronous execution). |
250 without returning any result (asynchronous execution). |
254 </p> |
251 </p> |
|
252 |
255 <dl> |
253 <dl> |
256 |
254 |
257 <dt><i>commandsList</i> (list of str)</dt> |
255 <dt><i>commandsList</i> (list of str)</dt> |
258 <dd> |
256 <dd> |
259 list of commands to be execute on the device |
257 list of commands to be execute on the device |
264 </dd> |
262 </dd> |
265 </dl> |
263 </dl> |
266 <a NAME="MicroPythonWebreplDeviceInterface.handlePreferencesChanged" ID="MicroPythonWebreplDeviceInterface.handlePreferencesChanged"></a> |
264 <a NAME="MicroPythonWebreplDeviceInterface.handlePreferencesChanged" ID="MicroPythonWebreplDeviceInterface.handlePreferencesChanged"></a> |
267 <h4>MicroPythonWebreplDeviceInterface.handlePreferencesChanged</h4> |
265 <h4>MicroPythonWebreplDeviceInterface.handlePreferencesChanged</h4> |
268 <b>handlePreferencesChanged</b>(<i></i>) |
266 <b>handlePreferencesChanged</b>(<i></i>) |
269 |
|
270 <p> |
267 <p> |
271 Public slot to handle a change of the preferences. |
268 Public slot to handle a change of the preferences. |
272 </p> |
269 </p> |
|
270 |
273 <a NAME="MicroPythonWebreplDeviceInterface.isConnected" ID="MicroPythonWebreplDeviceInterface.isConnected"></a> |
271 <a NAME="MicroPythonWebreplDeviceInterface.isConnected" ID="MicroPythonWebreplDeviceInterface.isConnected"></a> |
274 <h4>MicroPythonWebreplDeviceInterface.isConnected</h4> |
272 <h4>MicroPythonWebreplDeviceInterface.isConnected</h4> |
275 <b>isConnected</b>(<i></i>) |
273 <b>isConnected</b>(<i></i>) |
276 |
|
277 <p> |
274 <p> |
278 Public method to get the connection status. |
275 Public method to get the connection status. |
279 </p> |
276 </p> |
|
277 |
280 <dl> |
278 <dl> |
281 <dt>Return:</dt> |
279 <dt>Return:</dt> |
282 <dd> |
280 <dd> |
283 flag indicating the connection status |
281 flag indicating the connection status |
284 </dd> |
282 </dd> |
290 </dd> |
288 </dd> |
291 </dl> |
289 </dl> |
292 <a NAME="MicroPythonWebreplDeviceInterface.probeDevice" ID="MicroPythonWebreplDeviceInterface.probeDevice"></a> |
290 <a NAME="MicroPythonWebreplDeviceInterface.probeDevice" ID="MicroPythonWebreplDeviceInterface.probeDevice"></a> |
293 <h4>MicroPythonWebreplDeviceInterface.probeDevice</h4> |
291 <h4>MicroPythonWebreplDeviceInterface.probeDevice</h4> |
294 <b>probeDevice</b>(<i></i>) |
292 <b>probeDevice</b>(<i></i>) |
295 |
|
296 <p> |
293 <p> |
297 Public method to check the device is responding. |
294 Public method to check the device is responding. |
298 </p> |
295 </p> |
299 <p> |
296 <p> |
300 If the device has not been flashed with a MicroPython firmware, the |
297 If the device has not been flashed with a MicroPython firmware, the |
301 probe will fail. |
298 probe will fail. |
302 </p> |
299 </p> |
|
300 |
303 <dl> |
301 <dl> |
304 <dt>Return:</dt> |
302 <dt>Return:</dt> |
305 <dd> |
303 <dd> |
306 flag indicating a communicating MicroPython device |
304 flag indicating a communicating MicroPython device |
307 </dd> |
305 </dd> |
313 </dd> |
311 </dd> |
314 </dl> |
312 </dl> |
315 <a NAME="MicroPythonWebreplDeviceInterface.write" ID="MicroPythonWebreplDeviceInterface.write"></a> |
313 <a NAME="MicroPythonWebreplDeviceInterface.write" ID="MicroPythonWebreplDeviceInterface.write"></a> |
316 <h4>MicroPythonWebreplDeviceInterface.write</h4> |
314 <h4>MicroPythonWebreplDeviceInterface.write</h4> |
317 <b>write</b>(<i>data</i>) |
315 <b>write</b>(<i>data</i>) |
318 |
|
319 <p> |
316 <p> |
320 Public method to write data to the connected device. |
317 Public method to write data to the connected device. |
321 </p> |
318 </p> |
|
319 |
322 <dl> |
320 <dl> |
323 |
321 |
324 <dt><i>data</i> (bytes or bytearray)</dt> |
322 <dt><i>data</i> (bytes or bytearray)</dt> |
325 <dd> |
323 <dd> |
326 data to be written |
324 data to be written |