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

branch
mpy_network
changeset 10015
9352f33732ae
child 10229
e50bbf250343
equal deleted inserted replaced
10014:951a8d558e23 10015:9352f33732ae
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.MicroPython.MicroPythonWebreplSocket</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.MicroPythonWebreplSocket</h1>
10
11 <p>
12 Module implementing a websocket class to be connect to the MicroPython webrepl
13 interface.
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="#MicroPythonWebreplSocket">MicroPythonWebreplSocket</a></td>
26 <td>Class implementing a websocket client to be connected to the MicroPython webrepl interface.</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="MicroPythonWebreplSocket" ID="MicroPythonWebreplSocket"></a>
37 <h2>MicroPythonWebreplSocket</h2>
38
39 <p>
40 Class implementing a websocket client to be connected to the MicroPython webrepl
41 interface.
42 </p>
43 <h3>Signals</h3>
44 <dl>
45
46 <dt>readyRead()</dt>
47 <dd>
48 emitted to signal the availability of data
49 </dd>
50 </dl>
51 <h3>Derived from</h3>
52 QWebSocket
53 <h3>Class Attributes</h3>
54
55 <table>
56 <tr><td>None</td></tr>
57 </table>
58 <h3>Class Methods</h3>
59
60 <table>
61 <tr><td>None</td></tr>
62 </table>
63 <h3>Methods</h3>
64
65 <table>
66
67 <tr>
68 <td><a href="#MicroPythonWebreplSocket.__init__">MicroPythonWebreplSocket</a></td>
69 <td>Constructor</td>
70 </tr>
71 <tr>
72 <td><a href="#MicroPythonWebreplSocket.__textDataReceived">__textDataReceived</a></td>
73 <td>Private slot handling a received text message.</td>
74 </tr>
75 <tr>
76 <td><a href="#MicroPythonWebreplSocket.connectToDevice">connectToDevice</a></td>
77 <td>Public method to connect to the given host and port.</td>
78 </tr>
79 <tr>
80 <td><a href="#MicroPythonWebreplSocket.disconnect">disconnect</a></td>
81 <td>Public method to disconnect the websocket.</td>
82 </tr>
83 <tr>
84 <td><a href="#MicroPythonWebreplSocket.hasTimedOut">hasTimedOut</a></td>
85 <td>Public method to check, if the last 'readUntil()' has timed out.</td>
86 </tr>
87 <tr>
88 <td><a href="#MicroPythonWebreplSocket.isConnected">isConnected</a></td>
89 <td>Public method to check the connected state of the websocket.</td>
90 </tr>
91 <tr>
92 <td><a href="#MicroPythonWebreplSocket.login">login</a></td>
93 <td>Public method to login to the webrepl console of the device.</td>
94 </tr>
95 <tr>
96 <td><a href="#MicroPythonWebreplSocket.readAll">readAll</a></td>
97 <td>Public method to read all available data.</td>
98 </tr>
99 <tr>
100 <td><a href="#MicroPythonWebreplSocket.readUntil">readUntil</a></td>
101 <td>Public method to read data until an expected sequence is found (default: \n) or a specific size is exceeded.</td>
102 </tr>
103 <tr>
104 <td><a href="#MicroPythonWebreplSocket.setTimeout">setTimeout</a></td>
105 <td>Public method to set the socket timeout value.</td>
106 </tr>
107 <tr>
108 <td><a href="#MicroPythonWebreplSocket.timeout">timeout</a></td>
109 <td></td>
110 </tr>
111 <tr>
112 <td><a href="#MicroPythonWebreplSocket.waitForConnected">waitForConnected</a></td>
113 <td>Public method to wait for the websocket being connected.</td>
114 </tr>
115 <tr>
116 <td><a href="#MicroPythonWebreplSocket.writeTextMessage">writeTextMessage</a></td>
117 <td>Public method write some text data to the webrepl server of the connected device.</td>
118 </tr>
119 </table>
120 <h3>Static Methods</h3>
121
122 <table>
123 <tr><td>None</td></tr>
124 </table>
125
126 <a NAME="MicroPythonWebreplSocket.__init__" ID="MicroPythonWebreplSocket.__init__"></a>
127 <h4>MicroPythonWebreplSocket (Constructor)</h4>
128 <b>MicroPythonWebreplSocket</b>(<i>timeout=10000, parent=None</i>)
129
130 <p>
131 Constructor
132 </p>
133 <dl>
134
135 <dt><i>timeout</i> (int)</dt>
136 <dd>
137 timout in milliseconds to be set
138 </dd>
139 <dt><i>parent</i> (QObject)</dt>
140 <dd>
141 reference to the parent object
142 </dd>
143 </dl>
144 <a NAME="MicroPythonWebreplSocket.__textDataReceived" ID="MicroPythonWebreplSocket.__textDataReceived"></a>
145 <h4>MicroPythonWebreplSocket.__textDataReceived</h4>
146 <b>__textDataReceived</b>(<i>strMessage</i>)
147
148 <p>
149 Private slot handling a received text message.
150 </p>
151 <dl>
152
153 <dt><i>strMessage</i> (str)</dt>
154 <dd>
155 received text message
156 </dd>
157 </dl>
158 <a NAME="MicroPythonWebreplSocket.connectToDevice" ID="MicroPythonWebreplSocket.connectToDevice"></a>
159 <h4>MicroPythonWebreplSocket.connectToDevice</h4>
160 <b>connectToDevice</b>(<i>host, port</i>)
161
162 <p>
163 Public method to connect to the given host and port.
164 </p>
165 <dl>
166
167 <dt><i>host</i> (str)</dt>
168 <dd>
169 host name or IP address
170 </dd>
171 <dt><i>port</i> (int)</dt>
172 <dd>
173 port number
174 </dd>
175 </dl>
176 <dl>
177 <dt>Return:</dt>
178 <dd>
179 flag indicating success
180 </dd>
181 </dl>
182 <dl>
183 <dt>Return Type:</dt>
184 <dd>
185 bool
186 </dd>
187 </dl>
188 <a NAME="MicroPythonWebreplSocket.disconnect" ID="MicroPythonWebreplSocket.disconnect"></a>
189 <h4>MicroPythonWebreplSocket.disconnect</h4>
190 <b>disconnect</b>(<i></i>)
191
192 <p>
193 Public method to disconnect the websocket.
194 </p>
195 <a NAME="MicroPythonWebreplSocket.hasTimedOut" ID="MicroPythonWebreplSocket.hasTimedOut"></a>
196 <h4>MicroPythonWebreplSocket.hasTimedOut</h4>
197 <b>hasTimedOut</b>(<i></i>)
198
199 <p>
200 Public method to check, if the last 'readUntil()' has timed out.
201 </p>
202 <dl>
203 <dt>Return:</dt>
204 <dd>
205 flag indicating a timeout
206 @rtype bool
207 </dd>
208 </dl>
209 <a NAME="MicroPythonWebreplSocket.isConnected" ID="MicroPythonWebreplSocket.isConnected"></a>
210 <h4>MicroPythonWebreplSocket.isConnected</h4>
211 <b>isConnected</b>(<i></i>)
212
213 <p>
214 Public method to check the connected state of the websocket.
215 </p>
216 <dl>
217 <dt>Return:</dt>
218 <dd>
219 flag indicating the connected state
220 </dd>
221 </dl>
222 <dl>
223 <dt>Return Type:</dt>
224 <dd>
225 bool
226 </dd>
227 </dl>
228 <a NAME="MicroPythonWebreplSocket.login" ID="MicroPythonWebreplSocket.login"></a>
229 <h4>MicroPythonWebreplSocket.login</h4>
230 <b>login</b>(<i>password</i>)
231
232 <p>
233 Public method to login to the webrepl console of the device.
234 </p>
235 <dl>
236
237 <dt><i>password</i> (str)</dt>
238 <dd>
239 password
240 </dd>
241 </dl>
242 <dl>
243 <dt>Return:</dt>
244 <dd>
245 flag indicating a successful login
246 </dd>
247 </dl>
248 <dl>
249 <dt>Return Type:</dt>
250 <dd>
251 bool
252 </dd>
253 </dl>
254 <a NAME="MicroPythonWebreplSocket.readAll" ID="MicroPythonWebreplSocket.readAll"></a>
255 <h4>MicroPythonWebreplSocket.readAll</h4>
256 <b>readAll</b>(<i>timeout=0</i>)
257
258 <p>
259 Public method to read all available data.
260 </p>
261 <dl>
262
263 <dt><i>timeout</i> (int (optional))</dt>
264 <dd>
265 timeout in milliseconds (0 for no timeout)
266 (defaults to 0)
267 </dd>
268 </dl>
269 <dl>
270 <dt>Return:</dt>
271 <dd>
272 received data
273 </dd>
274 </dl>
275 <dl>
276 <dt>Return Type:</dt>
277 <dd>
278 bytes
279 </dd>
280 </dl>
281 <a NAME="MicroPythonWebreplSocket.readUntil" ID="MicroPythonWebreplSocket.readUntil"></a>
282 <h4>MicroPythonWebreplSocket.readUntil</h4>
283 <b>readUntil</b>(<i>expected=b"\n", size=None, timeout=0</i>)
284
285 <p>
286 Public method to read data until an expected sequence is found
287 (default: \n) or a specific size is exceeded.
288 </p>
289 <dl>
290
291 <dt><i>expected</i> (bytes)</dt>
292 <dd>
293 expected bytes sequence
294 </dd>
295 <dt><i>size</i> (int (optional))</dt>
296 <dd>
297 maximum data to be read (defaults to None)
298 </dd>
299 <dt><i>timeout</i> (int (optional))</dt>
300 <dd>
301 timeout in milliseconds (0 for configured default)
302 (defaults to 0)
303 </dd>
304 </dl>
305 <dl>
306 <dt>Return:</dt>
307 <dd>
308 bytes read from the device including the expected sequence
309 </dd>
310 </dl>
311 <dl>
312 <dt>Return Type:</dt>
313 <dd>
314 bytes
315 </dd>
316 </dl>
317 <a NAME="MicroPythonWebreplSocket.setTimeout" ID="MicroPythonWebreplSocket.setTimeout"></a>
318 <h4>MicroPythonWebreplSocket.setTimeout</h4>
319 <b>setTimeout</b>(<i>timeout</i>)
320
321 <p>
322 Public method to set the socket timeout value.
323 </p>
324 <dl>
325
326 <dt><i>timeout</i> (int)</dt>
327 <dd>
328 timout in milliseconds to be set
329 </dd>
330 </dl>
331 <a NAME="MicroPythonWebreplSocket.timeout" ID="MicroPythonWebreplSocket.timeout"></a>
332 <h4>MicroPythonWebreplSocket.timeout</h4>
333 <b>timeout</b>(<i></i>)
334
335 <a NAME="MicroPythonWebreplSocket.waitForConnected" ID="MicroPythonWebreplSocket.waitForConnected"></a>
336 <h4>MicroPythonWebreplSocket.waitForConnected</h4>
337 <b>waitForConnected</b>(<i></i>)
338
339 <p>
340 Public method to wait for the websocket being connected.
341 </p>
342 <dl>
343 <dt>Return:</dt>
344 <dd>
345 flag indicating the connect result
346 </dd>
347 </dl>
348 <dl>
349 <dt>Return Type:</dt>
350 <dd>
351 bool
352 </dd>
353 </dl>
354 <a NAME="MicroPythonWebreplSocket.writeTextMessage" ID="MicroPythonWebreplSocket.writeTextMessage"></a>
355 <h4>MicroPythonWebreplSocket.writeTextMessage</h4>
356 <b>writeTextMessage</b>(<i>data</i>)
357
358 <p>
359 Public method write some text data to the webrepl server of the connected
360 device.
361 </p>
362 <dl>
363
364 <dt><i>data</i> (bytes)</dt>
365 <dd>
366 text data to be sent
367 </dd>
368 </dl>
369 <div align="right"><a href="#top">Up</a></div>
370 <hr />
371 </body></html>

eric ide

mercurial