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

branch
mpy_network
changeset 10015
9352f33732ae
child 10070
9f5758c0fec1
equal deleted inserted replaced
10014:951a8d558e23 10015:9352f33732ae
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.MicroPython.MicroPythonWebreplDeviceInterface</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.MicroPythonWebreplDeviceInterface</h1>
10
11 <p>
12 Module implementing an interface to talk to a connected MicroPython device via
13 a webrepl connection.
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="#MicroPythonWebreplDeviceInterface">MicroPythonWebreplDeviceInterface</a></td>
26 <td>Class implementing an interface to talk to a connected MicroPython device via a webrepl connection.</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="MicroPythonWebreplDeviceInterface" ID="MicroPythonWebreplDeviceInterface"></a>
37 <h2>MicroPythonWebreplDeviceInterface</h2>
38
39 <p>
40 Class implementing an interface to talk to a connected MicroPython device via
41 a webrepl connection.
42 </p>
43 <h3>Derived from</h3>
44 MicroPythonDeviceInterface
45 <h3>Class Attributes</h3>
46
47 <table>
48 <tr><td>None</td></tr>
49 </table>
50 <h3>Class Methods</h3>
51
52 <table>
53 <tr><td>None</td></tr>
54 </table>
55 <h3>Methods</h3>
56
57 <table>
58
59 <tr>
60 <td><a href="#MicroPythonWebreplDeviceInterface.__init__">MicroPythonWebreplDeviceInterface</a></td>
61 <td>Constructor</td>
62 </tr>
63 <tr>
64 <td><a href="#MicroPythonWebreplDeviceInterface.__pasteOff">__pasteOff</a></td>
65 <td>Private method to switch 'paste' mode off.</td>
66 </tr>
67 <tr>
68 <td><a href="#MicroPythonWebreplDeviceInterface.__pasteOn">__pasteOn</a></td>
69 <td>Private method to switch the connected device to 'paste' mode.</td>
70 </tr>
71 <tr>
72 <td><a href="#MicroPythonWebreplDeviceInterface.__readAll">__readAll</a></td>
73 <td>Private method to read all data and emit it for further processing.</td>
74 </tr>
75 <tr>
76 <td><a href="#MicroPythonWebreplDeviceInterface.__readSocket">__readSocket</a></td>
77 <td>Private slot to read all available data and emit it with the "dataReceived" signal for further processing.</td>
78 </tr>
79 <tr>
80 <td><a href="#MicroPythonWebreplDeviceInterface.connectToDevice">connectToDevice</a></td>
81 <td>Public slot to connect to the device.</td>
82 </tr>
83 <tr>
84 <td><a href="#MicroPythonWebreplDeviceInterface.disconnectFromDevice">disconnectFromDevice</a></td>
85 <td>Public slot to disconnect from the device.</td>
86 </tr>
87 <tr>
88 <td><a href="#MicroPythonWebreplDeviceInterface.execute">execute</a></td>
89 <td>Public method to send commands to the connected device and return the result.</td>
90 </tr>
91 <tr>
92 <td><a href="#MicroPythonWebreplDeviceInterface.executeAsync">executeAsync</a></td>
93 <td>Public method to execute a series of commands over a period of time without returning any result (asynchronous execution).</td>
94 </tr>
95 <tr>
96 <td><a href="#MicroPythonWebreplDeviceInterface.handlePreferencesChanged">handlePreferencesChanged</a></td>
97 <td>Public slot to handle a change of the preferences.</td>
98 </tr>
99 <tr>
100 <td><a href="#MicroPythonWebreplDeviceInterface.isConnected">isConnected</a></td>
101 <td>Public method to get the connection status.</td>
102 </tr>
103 <tr>
104 <td><a href="#MicroPythonWebreplDeviceInterface.probeDevice">probeDevice</a></td>
105 <td>Public method to check the device is responding.</td>
106 </tr>
107 <tr>
108 <td><a href="#MicroPythonWebreplDeviceInterface.write">write</a></td>
109 <td>Public method to write data to the connected device.</td>
110 </tr>
111 </table>
112 <h3>Static Methods</h3>
113
114 <table>
115 <tr><td>None</td></tr>
116 </table>
117
118 <a NAME="MicroPythonWebreplDeviceInterface.__init__" ID="MicroPythonWebreplDeviceInterface.__init__"></a>
119 <h4>MicroPythonWebreplDeviceInterface (Constructor)</h4>
120 <b>MicroPythonWebreplDeviceInterface</b>(<i>parent=None</i>)
121
122 <p>
123 Constructor
124 </p>
125 <dl>
126
127 <dt><i>parent</i> (QObject)</dt>
128 <dd>
129 reference to the parent object
130 </dd>
131 </dl>
132 <a NAME="MicroPythonWebreplDeviceInterface.__pasteOff" ID="MicroPythonWebreplDeviceInterface.__pasteOff"></a>
133 <h4>MicroPythonWebreplDeviceInterface.__pasteOff</h4>
134 <b>__pasteOff</b>(<i></i>)
135
136 <p>
137 Private method to switch 'paste' mode off.
138 </p>
139 <a NAME="MicroPythonWebreplDeviceInterface.__pasteOn" ID="MicroPythonWebreplDeviceInterface.__pasteOn"></a>
140 <h4>MicroPythonWebreplDeviceInterface.__pasteOn</h4>
141 <b>__pasteOn</b>(<i></i>)
142
143 <p>
144 Private method to switch the connected device to 'paste' mode.
145 </p>
146 <p>
147 Note: switching to paste mode is done with synchronous writes.
148 </p>
149 <dl>
150 <dt>Return:</dt>
151 <dd>
152 flag indicating success
153 </dd>
154 </dl>
155 <dl>
156 <dt>Return Type:</dt>
157 <dd>
158 bool
159 </dd>
160 </dl>
161 <a NAME="MicroPythonWebreplDeviceInterface.__readAll" ID="MicroPythonWebreplDeviceInterface.__readAll"></a>
162 <h4>MicroPythonWebreplDeviceInterface.__readAll</h4>
163 <b>__readAll</b>(<i></i>)
164
165 <p>
166 Private method to read all data and emit it for further processing.
167 </p>
168 <a NAME="MicroPythonWebreplDeviceInterface.__readSocket" ID="MicroPythonWebreplDeviceInterface.__readSocket"></a>
169 <h4>MicroPythonWebreplDeviceInterface.__readSocket</h4>
170 <b>__readSocket</b>(<i></i>)
171
172 <p>
173 Private slot to read all available data and emit it with the
174 "dataReceived" signal for further processing.
175 </p>
176 <a NAME="MicroPythonWebreplDeviceInterface.connectToDevice" ID="MicroPythonWebreplDeviceInterface.connectToDevice"></a>
177 <h4>MicroPythonWebreplDeviceInterface.connectToDevice</h4>
178 <b>connectToDevice</b>(<i>connection</i>)
179
180 <p>
181 Public slot to connect to the device.
182 </p>
183 <dl>
184
185 <dt><i>connection</i> (str)</dt>
186 <dd>
187 name of the connection to be used in the form of an URL string
188 (ws://password@host:port)
189 </dd>
190 </dl>
191 <dl>
192 <dt>Return:</dt>
193 <dd>
194 flag indicating success
195 </dd>
196 </dl>
197 <dl>
198 <dt>Return Type:</dt>
199 <dd>
200 bool
201 </dd>
202 </dl>
203 <a NAME="MicroPythonWebreplDeviceInterface.disconnectFromDevice" ID="MicroPythonWebreplDeviceInterface.disconnectFromDevice"></a>
204 <h4>MicroPythonWebreplDeviceInterface.disconnectFromDevice</h4>
205 <b>disconnectFromDevice</b>(<i></i>)
206
207 <p>
208 Public slot to disconnect from the device.
209 </p>
210 <a NAME="MicroPythonWebreplDeviceInterface.execute" ID="MicroPythonWebreplDeviceInterface.execute"></a>
211 <h4>MicroPythonWebreplDeviceInterface.execute</h4>
212 <b>execute</b>(<i>commands, *, mode="raw", timeout=0</i>)
213
214 <p>
215 Public method to send commands to the connected device and return the
216 result.
217 </p>
218 <dl>
219
220 <dt><i>commands</i> (str or list of str)</dt>
221 <dd>
222 list of commands to be executed
223 </dd>
224 <dt><i>mode=</i> (str)</dt>
225 <dd>
226 submit mode to be used (one of 'raw' or 'paste') (defaults to
227 'raw'). This is ignored because webrepl always uses 'paste' mode.
228 </dd>
229 <dt><i>timeout=</i> (int (optional))</dt>
230 <dd>
231 per command timeout in milliseconds (0 for configured default)
232 (defaults to 0)
233 </dd>
234 </dl>
235 <dl>
236 <dt>Return:</dt>
237 <dd>
238 tuple containing stdout and stderr output of the device
239 </dd>
240 </dl>
241 <dl>
242 <dt>Return Type:</dt>
243 <dd>
244 tuple of (bytes, bytes)
245 </dd>
246 </dl>
247 <a NAME="MicroPythonWebreplDeviceInterface.executeAsync" ID="MicroPythonWebreplDeviceInterface.executeAsync"></a>
248 <h4>MicroPythonWebreplDeviceInterface.executeAsync</h4>
249 <b>executeAsync</b>(<i>commandsList, submitMode</i>)
250
251 <p>
252 Public method to execute a series of commands over a period of time
253 without returning any result (asynchronous execution).
254 </p>
255 <dl>
256
257 <dt><i>commandsList</i> (list of str)</dt>
258 <dd>
259 list of commands to be execute on the device
260 </dd>
261 <dt><i>submitMode</i> (str (one of 'raw' or 'paste'))</dt>
262 <dd>
263 mode to be used to submit the commands
264 </dd>
265 </dl>
266 <a NAME="MicroPythonWebreplDeviceInterface.handlePreferencesChanged" ID="MicroPythonWebreplDeviceInterface.handlePreferencesChanged"></a>
267 <h4>MicroPythonWebreplDeviceInterface.handlePreferencesChanged</h4>
268 <b>handlePreferencesChanged</b>(<i></i>)
269
270 <p>
271 Public slot to handle a change of the preferences.
272 </p>
273 <a NAME="MicroPythonWebreplDeviceInterface.isConnected" ID="MicroPythonWebreplDeviceInterface.isConnected"></a>
274 <h4>MicroPythonWebreplDeviceInterface.isConnected</h4>
275 <b>isConnected</b>(<i></i>)
276
277 <p>
278 Public method to get the connection status.
279 </p>
280 <dl>
281 <dt>Return:</dt>
282 <dd>
283 flag indicating the connection status
284 </dd>
285 </dl>
286 <dl>
287 <dt>Return Type:</dt>
288 <dd>
289 bool
290 </dd>
291 </dl>
292 <a NAME="MicroPythonWebreplDeviceInterface.probeDevice" ID="MicroPythonWebreplDeviceInterface.probeDevice"></a>
293 <h4>MicroPythonWebreplDeviceInterface.probeDevice</h4>
294 <b>probeDevice</b>(<i></i>)
295
296 <p>
297 Public method to check the device is responding.
298 </p>
299 <p>
300 If the device has not been flashed with a MicroPython firmware, the
301 probe will fail.
302 </p>
303 <dl>
304 <dt>Return:</dt>
305 <dd>
306 flag indicating a communicating MicroPython device
307 </dd>
308 </dl>
309 <dl>
310 <dt>Return Type:</dt>
311 <dd>
312 bool
313 </dd>
314 </dl>
315 <a NAME="MicroPythonWebreplDeviceInterface.write" ID="MicroPythonWebreplDeviceInterface.write"></a>
316 <h4>MicroPythonWebreplDeviceInterface.write</h4>
317 <b>write</b>(<i>data</i>)
318
319 <p>
320 Public method to write data to the connected device.
321 </p>
322 <dl>
323
324 <dt><i>data</i> (bytes or bytearray)</dt>
325 <dd>
326 data to be written
327 </dd>
328 </dl>
329 <div align="right"><a href="#top">Up</a></div>
330 <hr />
331 </body></html>

eric ide

mercurial