|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.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><a NAME="top" ID="top"></a> |
|
22 <h1>eric6.MicroPython.MicroPythonSerialPort</h1> |
|
23 <p> |
|
24 Module implementing a QSerialPort with additional functionality for |
|
25 MicroPython devices. |
|
26 </p> |
|
27 <h3>Global Attributes</h3> |
|
28 <table> |
|
29 <tr><td>None</td></tr> |
|
30 </table> |
|
31 <h3>Classes</h3> |
|
32 <table> |
|
33 <tr> |
|
34 <td><a href="#MicroPythonSerialPort">MicroPythonSerialPort</a></td> |
|
35 <td>Class implementing a QSerialPort with additional functionality for MicroPython devices.</td> |
|
36 </tr> |
|
37 </table> |
|
38 <h3>Functions</h3> |
|
39 <table> |
|
40 <tr><td>None</td></tr> |
|
41 </table> |
|
42 <hr /><hr /> |
|
43 <a NAME="MicroPythonSerialPort" ID="MicroPythonSerialPort"></a> |
|
44 <h2>MicroPythonSerialPort</h2> |
|
45 <p> |
|
46 Class implementing a QSerialPort with additional functionality for |
|
47 MicroPython devices. |
|
48 </p> |
|
49 <h3>Derived from</h3> |
|
50 QSerialPort |
|
51 <h3>Class Attributes</h3> |
|
52 <table> |
|
53 <tr><td>None</td></tr> |
|
54 </table> |
|
55 <h3>Class Methods</h3> |
|
56 <table> |
|
57 <tr><td>None</td></tr> |
|
58 </table> |
|
59 <h3>Methods</h3> |
|
60 <table> |
|
61 <tr> |
|
62 <td><a href="#MicroPythonSerialPort.__init__">MicroPythonSerialPort</a></td> |
|
63 <td>Constructor</td> |
|
64 </tr><tr> |
|
65 <td><a href="#MicroPythonSerialPort.closeSerialLink">closeSerialLink</a></td> |
|
66 <td>Public method to close the open serial connection.</td> |
|
67 </tr><tr> |
|
68 <td><a href="#MicroPythonSerialPort.hasTimedOut">hasTimedOut</a></td> |
|
69 <td>Public method to check, if the last 'readUntil' has timed out.</td> |
|
70 </tr><tr> |
|
71 <td><a href="#MicroPythonSerialPort.isConnected">isConnected</a></td> |
|
72 <td>Public method to get the connection state.</td> |
|
73 </tr><tr> |
|
74 <td><a href="#MicroPythonSerialPort.openSerialLink">openSerialLink</a></td> |
|
75 <td>Public method to open a serial link to a given serial port.</td> |
|
76 </tr><tr> |
|
77 <td><a href="#MicroPythonSerialPort.readUntil">readUntil</a></td> |
|
78 <td>Public method to read data until an expected sequence is found (default: \n) or a specific size is exceeded.</td> |
|
79 </tr><tr> |
|
80 <td><a href="#MicroPythonSerialPort.setTimeout">setTimeout</a></td> |
|
81 <td>Public method to set the timeout for device operations.</td> |
|
82 </tr> |
|
83 </table> |
|
84 <h3>Static Methods</h3> |
|
85 <table> |
|
86 <tr><td>None</td></tr> |
|
87 </table> |
|
88 <a NAME="MicroPythonSerialPort.__init__" ID="MicroPythonSerialPort.__init__"></a> |
|
89 <h4>MicroPythonSerialPort (Constructor)</h4> |
|
90 <b>MicroPythonSerialPort</b>(<i>timeout=10000, parent=None</i>) |
|
91 <p> |
|
92 Constructor |
|
93 </p><dl> |
|
94 <dt><i>timeout</i> (int)</dt> |
|
95 <dd> |
|
96 timout in milliseconds to be set |
|
97 </dd><dt><i>parent</i> (QObject)</dt> |
|
98 <dd> |
|
99 reference to the parent object |
|
100 </dd> |
|
101 </dl><a NAME="MicroPythonSerialPort.closeSerialLink" ID="MicroPythonSerialPort.closeSerialLink"></a> |
|
102 <h4>MicroPythonSerialPort.closeSerialLink</h4> |
|
103 <b>closeSerialLink</b>(<i></i>) |
|
104 <p> |
|
105 Public method to close the open serial connection. |
|
106 </p><a NAME="MicroPythonSerialPort.hasTimedOut" ID="MicroPythonSerialPort.hasTimedOut"></a> |
|
107 <h4>MicroPythonSerialPort.hasTimedOut</h4> |
|
108 <b>hasTimedOut</b>(<i></i>) |
|
109 <p> |
|
110 Public method to check, if the last 'readUntil' has timed out. |
|
111 </p><dl> |
|
112 <dt>Returns:</dt> |
|
113 <dd> |
|
114 flag indicating a timeout |
|
115 @rtype bool |
|
116 </dd> |
|
117 </dl><a NAME="MicroPythonSerialPort.isConnected" ID="MicroPythonSerialPort.isConnected"></a> |
|
118 <h4>MicroPythonSerialPort.isConnected</h4> |
|
119 <b>isConnected</b>(<i></i>) |
|
120 <p> |
|
121 Public method to get the connection state. |
|
122 </p><dl> |
|
123 <dt>Returns:</dt> |
|
124 <dd> |
|
125 flag indicating the connection state |
|
126 </dd> |
|
127 </dl><dl> |
|
128 <dt>Return Type:</dt> |
|
129 <dd> |
|
130 bool |
|
131 </dd> |
|
132 </dl><a NAME="MicroPythonSerialPort.openSerialLink" ID="MicroPythonSerialPort.openSerialLink"></a> |
|
133 <h4>MicroPythonSerialPort.openSerialLink</h4> |
|
134 <b>openSerialLink</b>(<i>port</i>) |
|
135 <p> |
|
136 Public method to open a serial link to a given serial port. |
|
137 </p><dl> |
|
138 <dt><i>port</i> (str)</dt> |
|
139 <dd> |
|
140 port name to connect to |
|
141 </dd> |
|
142 </dl><dl> |
|
143 <dt>Returns:</dt> |
|
144 <dd> |
|
145 flag indicating success |
|
146 </dd> |
|
147 </dl><dl> |
|
148 <dt>Return Type:</dt> |
|
149 <dd> |
|
150 bool |
|
151 </dd> |
|
152 </dl><a NAME="MicroPythonSerialPort.readUntil" ID="MicroPythonSerialPort.readUntil"></a> |
|
153 <h4>MicroPythonSerialPort.readUntil</h4> |
|
154 <b>readUntil</b>(<i>expected=b"\n", size=None</i>) |
|
155 <p> |
|
156 Public method to read data until an expected sequence is found |
|
157 (default: \n) or a specific size is exceeded. |
|
158 </p><dl> |
|
159 <dt><i>expected</i> (bytes)</dt> |
|
160 <dd> |
|
161 expected bytes sequence |
|
162 </dd><dt><i>size</i> (int)</dt> |
|
163 <dd> |
|
164 maximum data to be read |
|
165 </dd> |
|
166 </dl><dl> |
|
167 <dt>Returns:</dt> |
|
168 <dd> |
|
169 bytes read from the device including the expected sequence |
|
170 </dd> |
|
171 </dl><dl> |
|
172 <dt>Return Type:</dt> |
|
173 <dd> |
|
174 bytes |
|
175 </dd> |
|
176 </dl><a NAME="MicroPythonSerialPort.setTimeout" ID="MicroPythonSerialPort.setTimeout"></a> |
|
177 <h4>MicroPythonSerialPort.setTimeout</h4> |
|
178 <b>setTimeout</b>(<i>timeout</i>) |
|
179 <p> |
|
180 Public method to set the timeout for device operations. |
|
181 </p><dl> |
|
182 <dt><i>timeout</i> (int)</dt> |
|
183 <dd> |
|
184 timout in milliseconds to be set |
|
185 </dd> |
|
186 </dl> |
|
187 <div align="right"><a href="#top">Up</a></div> |
|
188 <hr /> |
|
189 </body></html> |