|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.MicroPython.MicroPythonSerialPort</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body> |
|
22 <a NAME="top" ID="top"></a> |
|
23 <h1>eric7.MicroPython.MicroPythonSerialPort</h1> |
|
24 |
|
25 <p> |
|
26 Module implementing a QSerialPort with additional functionality for |
|
27 MicroPython devices. |
|
28 </p> |
|
29 <h3>Global Attributes</h3> |
|
30 |
|
31 <table> |
|
32 <tr><td>None</td></tr> |
|
33 </table> |
|
34 <h3>Classes</h3> |
|
35 |
|
36 <table> |
|
37 |
|
38 <tr> |
|
39 <td><a href="#MicroPythonSerialPort">MicroPythonSerialPort</a></td> |
|
40 <td>Class implementing a QSerialPort with additional functionality for MicroPython devices.</td> |
|
41 </tr> |
|
42 </table> |
|
43 <h3>Functions</h3> |
|
44 |
|
45 <table> |
|
46 <tr><td>None</td></tr> |
|
47 </table> |
|
48 <hr /> |
|
49 <hr /> |
|
50 <a NAME="MicroPythonSerialPort" ID="MicroPythonSerialPort"></a> |
|
51 <h2>MicroPythonSerialPort</h2> |
|
52 |
|
53 <p> |
|
54 Class implementing a QSerialPort with additional functionality for |
|
55 MicroPython devices. |
|
56 </p> |
|
57 <h3>Derived from</h3> |
|
58 QSerialPort |
|
59 <h3>Class Attributes</h3> |
|
60 |
|
61 <table> |
|
62 <tr><td>None</td></tr> |
|
63 </table> |
|
64 <h3>Class Methods</h3> |
|
65 |
|
66 <table> |
|
67 <tr><td>None</td></tr> |
|
68 </table> |
|
69 <h3>Methods</h3> |
|
70 |
|
71 <table> |
|
72 |
|
73 <tr> |
|
74 <td><a href="#MicroPythonSerialPort.__init__">MicroPythonSerialPort</a></td> |
|
75 <td>Constructor</td> |
|
76 </tr> |
|
77 <tr> |
|
78 <td><a href="#MicroPythonSerialPort.closeSerialLink">closeSerialLink</a></td> |
|
79 <td>Public method to close the open serial connection.</td> |
|
80 </tr> |
|
81 <tr> |
|
82 <td><a href="#MicroPythonSerialPort.hasTimedOut">hasTimedOut</a></td> |
|
83 <td>Public method to check, if the last 'readUntil' has timed out.</td> |
|
84 </tr> |
|
85 <tr> |
|
86 <td><a href="#MicroPythonSerialPort.isConnected">isConnected</a></td> |
|
87 <td>Public method to get the connection state.</td> |
|
88 </tr> |
|
89 <tr> |
|
90 <td><a href="#MicroPythonSerialPort.openSerialLink">openSerialLink</a></td> |
|
91 <td>Public method to open a serial link to a given serial port.</td> |
|
92 </tr> |
|
93 <tr> |
|
94 <td><a href="#MicroPythonSerialPort.readUntil">readUntil</a></td> |
|
95 <td>Public method to read data until an expected sequence is found (default: \n) or a specific size is exceeded.</td> |
|
96 </tr> |
|
97 <tr> |
|
98 <td><a href="#MicroPythonSerialPort.setTimeout">setTimeout</a></td> |
|
99 <td>Public method to set the timeout for device operations.</td> |
|
100 </tr> |
|
101 </table> |
|
102 <h3>Static Methods</h3> |
|
103 |
|
104 <table> |
|
105 <tr><td>None</td></tr> |
|
106 </table> |
|
107 |
|
108 <a NAME="MicroPythonSerialPort.__init__" ID="MicroPythonSerialPort.__init__"></a> |
|
109 <h4>MicroPythonSerialPort (Constructor)</h4> |
|
110 <b>MicroPythonSerialPort</b>(<i>timeout=10000, parent=None</i>) |
|
111 |
|
112 <p> |
|
113 Constructor |
|
114 </p> |
|
115 <dl> |
|
116 |
|
117 <dt><i>timeout</i> (int)</dt> |
|
118 <dd> |
|
119 timout in milliseconds to be set |
|
120 </dd> |
|
121 <dt><i>parent</i> (QObject)</dt> |
|
122 <dd> |
|
123 reference to the parent object |
|
124 </dd> |
|
125 </dl> |
|
126 <a NAME="MicroPythonSerialPort.closeSerialLink" ID="MicroPythonSerialPort.closeSerialLink"></a> |
|
127 <h4>MicroPythonSerialPort.closeSerialLink</h4> |
|
128 <b>closeSerialLink</b>(<i></i>) |
|
129 |
|
130 <p> |
|
131 Public method to close the open serial connection. |
|
132 </p> |
|
133 <a NAME="MicroPythonSerialPort.hasTimedOut" ID="MicroPythonSerialPort.hasTimedOut"></a> |
|
134 <h4>MicroPythonSerialPort.hasTimedOut</h4> |
|
135 <b>hasTimedOut</b>(<i></i>) |
|
136 |
|
137 <p> |
|
138 Public method to check, if the last 'readUntil' has timed out. |
|
139 </p> |
|
140 <dl> |
|
141 <dt>Return:</dt> |
|
142 <dd> |
|
143 flag indicating a timeout |
|
144 @rtype bool |
|
145 </dd> |
|
146 </dl> |
|
147 <a NAME="MicroPythonSerialPort.isConnected" ID="MicroPythonSerialPort.isConnected"></a> |
|
148 <h4>MicroPythonSerialPort.isConnected</h4> |
|
149 <b>isConnected</b>(<i></i>) |
|
150 |
|
151 <p> |
|
152 Public method to get the connection state. |
|
153 </p> |
|
154 <dl> |
|
155 <dt>Return:</dt> |
|
156 <dd> |
|
157 flag indicating the connection state |
|
158 </dd> |
|
159 </dl> |
|
160 <dl> |
|
161 <dt>Return Type:</dt> |
|
162 <dd> |
|
163 bool |
|
164 </dd> |
|
165 </dl> |
|
166 <a NAME="MicroPythonSerialPort.openSerialLink" ID="MicroPythonSerialPort.openSerialLink"></a> |
|
167 <h4>MicroPythonSerialPort.openSerialLink</h4> |
|
168 <b>openSerialLink</b>(<i>port</i>) |
|
169 |
|
170 <p> |
|
171 Public method to open a serial link to a given serial port. |
|
172 </p> |
|
173 <dl> |
|
174 |
|
175 <dt><i>port</i> (str)</dt> |
|
176 <dd> |
|
177 port name to connect to |
|
178 </dd> |
|
179 </dl> |
|
180 <dl> |
|
181 <dt>Return:</dt> |
|
182 <dd> |
|
183 flag indicating success |
|
184 </dd> |
|
185 </dl> |
|
186 <dl> |
|
187 <dt>Return Type:</dt> |
|
188 <dd> |
|
189 bool |
|
190 </dd> |
|
191 </dl> |
|
192 <a NAME="MicroPythonSerialPort.readUntil" ID="MicroPythonSerialPort.readUntil"></a> |
|
193 <h4>MicroPythonSerialPort.readUntil</h4> |
|
194 <b>readUntil</b>(<i>expected=b"\n", size=None</i>) |
|
195 |
|
196 <p> |
|
197 Public method to read data until an expected sequence is found |
|
198 (default: \n) or a specific size is exceeded. |
|
199 </p> |
|
200 <dl> |
|
201 |
|
202 <dt><i>expected</i> (bytes)</dt> |
|
203 <dd> |
|
204 expected bytes sequence |
|
205 </dd> |
|
206 <dt><i>size</i> (int)</dt> |
|
207 <dd> |
|
208 maximum data to be read |
|
209 </dd> |
|
210 </dl> |
|
211 <dl> |
|
212 <dt>Return:</dt> |
|
213 <dd> |
|
214 bytes read from the device including the expected sequence |
|
215 </dd> |
|
216 </dl> |
|
217 <dl> |
|
218 <dt>Return Type:</dt> |
|
219 <dd> |
|
220 bytes |
|
221 </dd> |
|
222 </dl> |
|
223 <a NAME="MicroPythonSerialPort.setTimeout" ID="MicroPythonSerialPort.setTimeout"></a> |
|
224 <h4>MicroPythonSerialPort.setTimeout</h4> |
|
225 <b>setTimeout</b>(<i>timeout</i>) |
|
226 |
|
227 <p> |
|
228 Public method to set the timeout for device operations. |
|
229 </p> |
|
230 <dl> |
|
231 |
|
232 <dt><i>timeout</i> (int)</dt> |
|
233 <dd> |
|
234 timout in milliseconds to be set |
|
235 </dd> |
|
236 </dl> |
|
237 <div align="right"><a href="#top">Up</a></div> |
|
238 <hr /> |
|
239 </body></html> |