Dopasowany do naszego firmware'u
Dependencies: ArduinoAPI
Fork of WeeESP8266 by
ESP8266.h@4:c8e2381d34d2, 2015-02-06 (annotated)
- Committer:
- itead
- Date:
- Fri Feb 06 04:50:49 2015 +0000
- Revision:
- 4:c8e2381d34d2
- Parent:
- 3:9f745022331a
- Child:
- 5:5fa655d7212c
API Definition Okay!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
itead | 1:edc634cad906 | 1 | /** |
itead | 2:fb209f93f3f1 | 2 | * @file ESP8266.h |
itead | 2:fb209f93f3f1 | 3 | * @brief The definition of class ESP8266. |
itead | 1:edc634cad906 | 4 | * @author Wu Pengfei<pengfei.wu@itead.cc> |
itead | 1:edc634cad906 | 5 | * @date 2015.02 |
itead | 1:edc634cad906 | 6 | * |
itead | 1:edc634cad906 | 7 | * @par Copyright: |
itead | 1:edc634cad906 | 8 | * Copyright (c) 2015 ITEAD Intelligent Systems Co., Ltd. \n\n |
itead | 1:edc634cad906 | 9 | * This program is free software; you can redistribute it and/or |
itead | 1:edc634cad906 | 10 | * modify it under the terms of the GNU General Public License as |
itead | 1:edc634cad906 | 11 | * published by the Free Software Foundation; either version 2 of |
itead | 1:edc634cad906 | 12 | * the License, or (at your option) any later version. \n\n |
itead | 1:edc634cad906 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
itead | 1:edc634cad906 | 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
itead | 1:edc634cad906 | 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
itead | 1:edc634cad906 | 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
itead | 1:edc634cad906 | 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
itead | 1:edc634cad906 | 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
itead | 1:edc634cad906 | 19 | * THE SOFTWARE. |
itead | 1:edc634cad906 | 20 | */ |
itead | 2:fb209f93f3f1 | 21 | #ifndef __ESP8266_H__ |
itead | 2:fb209f93f3f1 | 22 | #define __ESP8266_H__ |
itead | 0:d3b93948c925 | 23 | |
itead | 1:edc634cad906 | 24 | #include "ArduinoAPI.h" |
itead | 0:d3b93948c925 | 25 | |
itead | 1:edc634cad906 | 26 | /** |
itead | 1:edc634cad906 | 27 | * Provide an easy-to-use way to manipulate ESP8266. |
itead | 1:edc634cad906 | 28 | */ |
itead | 2:fb209f93f3f1 | 29 | class ESP8266 { |
itead | 1:edc634cad906 | 30 | public: |
itead | 1:edc634cad906 | 31 | |
itead | 3:9f745022331a | 32 | /** |
itead | 3:9f745022331a | 33 | * Constuctor. |
itead | 3:9f745022331a | 34 | * |
itead | 3:9f745022331a | 35 | * @param uart - an reference of ArduinoSerial object with baud 9600. |
itead | 3:9f745022331a | 36 | */ |
itead | 3:9f745022331a | 37 | ESP8266(ArduinoSerial &uart); /* baud rate is 9600 */ |
itead | 1:edc634cad906 | 38 | |
itead | 1:edc634cad906 | 39 | /** |
itead | 3:9f745022331a | 40 | * Verify ESP8266 whether live or not. |
itead | 1:edc634cad906 | 41 | * |
itead | 1:edc634cad906 | 42 | * Actually, this method will send command "AT" to ESP8266 and waiting for "OK". |
itead | 1:edc634cad906 | 43 | * |
itead | 1:edc634cad906 | 44 | * @retval true - alive. |
itead | 1:edc634cad906 | 45 | * @retval false - dead. |
itead | 1:edc634cad906 | 46 | */ |
itead | 1:edc634cad906 | 47 | bool kick(void); |
itead | 1:edc634cad906 | 48 | |
itead | 1:edc634cad906 | 49 | /** |
itead | 1:edc634cad906 | 50 | * Restart ESP8266 by "AT+RST". |
itead | 1:edc634cad906 | 51 | * |
itead | 1:edc634cad906 | 52 | * This method will take 3 seconds or more. |
itead | 1:edc634cad906 | 53 | * |
itead | 1:edc634cad906 | 54 | * @retval true - success. |
itead | 1:edc634cad906 | 55 | * @retval false - failure. |
itead | 1:edc634cad906 | 56 | */ |
itead | 1:edc634cad906 | 57 | bool restart(void); |
itead | 1:edc634cad906 | 58 | |
itead | 1:edc634cad906 | 59 | /** |
itead | 1:edc634cad906 | 60 | * Get the version of AT Command Set. |
itead | 1:edc634cad906 | 61 | * |
itead | 1:edc634cad906 | 62 | * @return the string of version. |
itead | 1:edc634cad906 | 63 | */ |
itead | 1:edc634cad906 | 64 | String getVersion(void); |
itead | 1:edc634cad906 | 65 | |
itead | 1:edc634cad906 | 66 | /** |
itead | 1:edc634cad906 | 67 | * Set operation mode to staion. |
itead | 1:edc634cad906 | 68 | * |
itead | 1:edc634cad906 | 69 | * @retval true - success. |
itead | 1:edc634cad906 | 70 | * @retval false - failure. |
itead | 1:edc634cad906 | 71 | */ |
itead | 1:edc634cad906 | 72 | bool setOprToStation(void); |
itead | 1:edc634cad906 | 73 | |
itead | 1:edc634cad906 | 74 | /** |
itead | 1:edc634cad906 | 75 | * Set operation mode to softap. |
itead | 1:edc634cad906 | 76 | * |
itead | 1:edc634cad906 | 77 | * @retval true - success. |
itead | 1:edc634cad906 | 78 | * @retval false - failure. |
itead | 1:edc634cad906 | 79 | */ |
itead | 1:edc634cad906 | 80 | bool setOprToSoftAP(void); |
itead | 1:edc634cad906 | 81 | |
itead | 1:edc634cad906 | 82 | /** |
itead | 1:edc634cad906 | 83 | * Set operation mode to station + softap. |
itead | 1:edc634cad906 | 84 | * |
itead | 1:edc634cad906 | 85 | * @retval true - success. |
itead | 1:edc634cad906 | 86 | * @retval false - failure. |
itead | 1:edc634cad906 | 87 | */ |
itead | 1:edc634cad906 | 88 | bool setOprToStationSoftAP(void); |
itead | 1:edc634cad906 | 89 | |
itead | 1:edc634cad906 | 90 | /** |
itead | 1:edc634cad906 | 91 | * Search available AP list and return it. |
itead | 1:edc634cad906 | 92 | * |
itead | 1:edc634cad906 | 93 | * @return the list of available APs. |
itead | 1:edc634cad906 | 94 | * @note This method will occupy a lot of memeory(hundreds of Bytes to a couple of KBytes). |
itead | 1:edc634cad906 | 95 | * Do not call this method unless you must and ensure that your board has enough memery left. |
itead | 1:edc634cad906 | 96 | */ |
itead | 1:edc634cad906 | 97 | String getAPList(void); |
itead | 1:edc634cad906 | 98 | |
itead | 1:edc634cad906 | 99 | /** |
itead | 1:edc634cad906 | 100 | * Join in AP. |
itead | 1:edc634cad906 | 101 | * |
itead | 1:edc634cad906 | 102 | * @param ssid - SSID of AP to join in. |
itead | 1:edc634cad906 | 103 | * @param pwd - Password of AP to join in. |
itead | 1:edc634cad906 | 104 | * @retval true - success. |
itead | 1:edc634cad906 | 105 | * @retval false - failure. |
itead | 1:edc634cad906 | 106 | * @note This method will take a couple of seconds. |
itead | 1:edc634cad906 | 107 | */ |
itead | 1:edc634cad906 | 108 | bool joinAP(String ssid, String pwd); |
itead | 1:edc634cad906 | 109 | |
itead | 1:edc634cad906 | 110 | /** |
itead | 1:edc634cad906 | 111 | * Leave AP joined before. |
itead | 1:edc634cad906 | 112 | * |
itead | 1:edc634cad906 | 113 | * @retval true - success. |
itead | 1:edc634cad906 | 114 | * @retval false - failure. |
itead | 1:edc634cad906 | 115 | */ |
itead | 1:edc634cad906 | 116 | bool leaveAP(void); |
itead | 1:edc634cad906 | 117 | |
itead | 1:edc634cad906 | 118 | /** |
itead | 1:edc634cad906 | 119 | * Set SoftAP parameters. |
itead | 1:edc634cad906 | 120 | * |
itead | 1:edc634cad906 | 121 | * @param ssid - SSID of SoftAP. |
itead | 1:edc634cad906 | 122 | * @param pwd - PASSWORD of SoftAP. |
itead | 1:edc634cad906 | 123 | * @param chl - the channel (1 - 13, default: 7). |
itead | 1:edc634cad906 | 124 | * @param ecn - the way of encrypstion (0 - OPEN, 1 - WEP, |
itead | 1:edc634cad906 | 125 | * 2 - WPA_PSK, 3 - WPA2_PSK, 4 - WPA_WPA2_PSK, default: 0). |
itead | 1:edc634cad906 | 126 | * @note This method should not be called when station mode. |
itead | 1:edc634cad906 | 127 | */ |
itead | 1:edc634cad906 | 128 | bool setSoftAPParam(String ssid, String pwd, uint8_t chl = 7, uint8_t ecn = 0); |
itead | 1:edc634cad906 | 129 | |
itead | 1:edc634cad906 | 130 | /** |
itead | 1:edc634cad906 | 131 | * Get the IP list of devices connected to SoftAP. |
itead | 1:edc634cad906 | 132 | * |
itead | 1:edc634cad906 | 133 | * @return the list of IP. |
itead | 1:edc634cad906 | 134 | * @note This method should not be called when station mode. |
itead | 1:edc634cad906 | 135 | */ |
itead | 3:9f745022331a | 136 | String getJoinedDeviceIP(void); |
itead | 3:9f745022331a | 137 | |
itead | 3:9f745022331a | 138 | /** |
itead | 3:9f745022331a | 139 | * Get the current status of connection(UDP and TCP). |
itead | 3:9f745022331a | 140 | * |
itead | 3:9f745022331a | 141 | * @return the status. |
itead | 3:9f745022331a | 142 | */ |
itead | 3:9f745022331a | 143 | String getIPStatus(void); |
itead | 3:9f745022331a | 144 | |
itead | 3:9f745022331a | 145 | /** |
itead | 3:9f745022331a | 146 | * Get the IP address of ESP8266. |
itead | 3:9f745022331a | 147 | * |
itead | 3:9f745022331a | 148 | * @return the IP list. |
itead | 3:9f745022331a | 149 | */ |
itead | 3:9f745022331a | 150 | String getLocalIP(void); |
itead | 3:9f745022331a | 151 | |
itead | 3:9f745022331a | 152 | /** |
itead | 3:9f745022331a | 153 | * Enable IP MUX(multiple connection mode). |
itead | 3:9f745022331a | 154 | * |
itead | 3:9f745022331a | 155 | * In multiple connection mode, a couple of TCP and UDP communication can be builded. |
itead | 3:9f745022331a | 156 | * They can be distinguished by the identifier of TCP or UDP named mux_id. |
itead | 3:9f745022331a | 157 | * |
itead | 3:9f745022331a | 158 | * @retval true - success. |
itead | 3:9f745022331a | 159 | * @retval false - failure. |
itead | 3:9f745022331a | 160 | */ |
itead | 3:9f745022331a | 161 | bool enableMUX(void); |
itead | 3:9f745022331a | 162 | |
itead | 3:9f745022331a | 163 | /** |
itead | 3:9f745022331a | 164 | * Disable IP MUX(single connection mode). |
itead | 3:9f745022331a | 165 | * |
itead | 3:9f745022331a | 166 | * In single connection mode, only one TCP or UDP communication can be builded. |
itead | 3:9f745022331a | 167 | * |
itead | 3:9f745022331a | 168 | * @retval true - success. |
itead | 3:9f745022331a | 169 | * @retval false - failure. |
itead | 3:9f745022331a | 170 | */ |
itead | 3:9f745022331a | 171 | bool disableMUX(void); |
itead | 3:9f745022331a | 172 | |
itead | 3:9f745022331a | 173 | |
itead | 3:9f745022331a | 174 | /** |
itead | 3:9f745022331a | 175 | * Create TCP connection in single mode. |
itead | 3:9f745022331a | 176 | * |
itead | 3:9f745022331a | 177 | * @param addr - the IP or domain name of the target host. |
itead | 3:9f745022331a | 178 | * @param port - the port number of the target host. |
itead | 3:9f745022331a | 179 | * @retval true - success. |
itead | 3:9f745022331a | 180 | * @retval false - failure. |
itead | 3:9f745022331a | 181 | */ |
itead | 3:9f745022331a | 182 | bool createTCP(String addr, uint32_t port); |
itead | 3:9f745022331a | 183 | |
itead | 3:9f745022331a | 184 | /** |
itead | 3:9f745022331a | 185 | * Release TCP connection in single mode. |
itead | 3:9f745022331a | 186 | * |
itead | 3:9f745022331a | 187 | * @retval true - success. |
itead | 3:9f745022331a | 188 | * @retval false - failure. |
itead | 3:9f745022331a | 189 | */ |
itead | 3:9f745022331a | 190 | bool releaseTCP(void); |
itead | 3:9f745022331a | 191 | |
itead | 3:9f745022331a | 192 | /** |
itead | 3:9f745022331a | 193 | * Register UDP port number in single mode. |
itead | 3:9f745022331a | 194 | * |
itead | 3:9f745022331a | 195 | * @param addr - the IP or domain name of the target host. |
itead | 3:9f745022331a | 196 | * @param port - the port number of the target host. |
itead | 3:9f745022331a | 197 | * @retval true - success. |
itead | 3:9f745022331a | 198 | * @retval false - failure. |
itead | 3:9f745022331a | 199 | */ |
itead | 3:9f745022331a | 200 | bool registerUDP(String addr, uint32_t port); |
itead | 3:9f745022331a | 201 | |
itead | 3:9f745022331a | 202 | /** |
itead | 3:9f745022331a | 203 | * Unregister UDP port number in single mode. |
itead | 3:9f745022331a | 204 | * |
itead | 3:9f745022331a | 205 | * @retval true - success. |
itead | 3:9f745022331a | 206 | * @retval false - failure. |
itead | 3:9f745022331a | 207 | */ |
itead | 3:9f745022331a | 208 | bool unregisterUDP(void); |
itead | 4:c8e2381d34d2 | 209 | |
itead | 3:9f745022331a | 210 | /** |
itead | 3:9f745022331a | 211 | * Create TCP connection in multiple mode. |
itead | 3:9f745022331a | 212 | * |
itead | 3:9f745022331a | 213 | * @param mux_id - the identifier of this TCP(available value: 0 - 4). |
itead | 3:9f745022331a | 214 | * @param addr - the IP or domain name of the target host. |
itead | 3:9f745022331a | 215 | * @param port - the port number of the target host. |
itead | 3:9f745022331a | 216 | * @retval true - success. |
itead | 3:9f745022331a | 217 | * @retval false - failure. |
itead | 3:9f745022331a | 218 | */ |
itead | 3:9f745022331a | 219 | bool createTCP(uint8_t mux_id, String addr, uint32_t port); |
itead | 3:9f745022331a | 220 | |
itead | 3:9f745022331a | 221 | /** |
itead | 3:9f745022331a | 222 | * Release TCP connection in multiple mode. |
itead | 3:9f745022331a | 223 | * |
itead | 3:9f745022331a | 224 | * @param mux_id - the identifier of this TCP(available value: 0 - 4). |
itead | 3:9f745022331a | 225 | * @retval true - success. |
itead | 3:9f745022331a | 226 | * @retval false - failure. |
itead | 3:9f745022331a | 227 | */ |
itead | 3:9f745022331a | 228 | bool releaseTCP(uint8_t mux_id); |
itead | 3:9f745022331a | 229 | |
itead | 3:9f745022331a | 230 | /** |
itead | 3:9f745022331a | 231 | * Register UDP port number in multiple mode. |
itead | 3:9f745022331a | 232 | * |
itead | 3:9f745022331a | 233 | * @param mux_id - the identifier of this TCP(available value: 0 - 4). |
itead | 3:9f745022331a | 234 | * @param addr - the IP or domain name of the target host. |
itead | 3:9f745022331a | 235 | * @param port - the port number of the target host. |
itead | 3:9f745022331a | 236 | * @retval true - success. |
itead | 3:9f745022331a | 237 | * @retval false - failure. |
itead | 3:9f745022331a | 238 | */ |
itead | 3:9f745022331a | 239 | bool registerUDP(uint8_t mux_id, String addr, uint32_t port); |
itead | 3:9f745022331a | 240 | |
itead | 3:9f745022331a | 241 | /** |
itead | 3:9f745022331a | 242 | * Unregister UDP port number in multiple mode. |
itead | 3:9f745022331a | 243 | * |
itead | 3:9f745022331a | 244 | * @param mux_id - the identifier of this TCP(available value: 0 - 4). |
itead | 3:9f745022331a | 245 | * @retval true - success. |
itead | 3:9f745022331a | 246 | * @retval false - failure. |
itead | 3:9f745022331a | 247 | */ |
itead | 3:9f745022331a | 248 | bool unregisterUDP(uint8_t mux_id); |
itead | 4:c8e2381d34d2 | 249 | |
itead | 4:c8e2381d34d2 | 250 | |
itead | 4:c8e2381d34d2 | 251 | /** |
itead | 4:c8e2381d34d2 | 252 | * Set the timeout of TCP Server. |
itead | 4:c8e2381d34d2 | 253 | * |
itead | 4:c8e2381d34d2 | 254 | * @param timeout - the duration for timeout by second(0 ~ 28800, default:180). |
itead | 4:c8e2381d34d2 | 255 | * @retval true - success. |
itead | 4:c8e2381d34d2 | 256 | * @retval false - failure. |
itead | 4:c8e2381d34d2 | 257 | */ |
itead | 4:c8e2381d34d2 | 258 | bool setTCPServerTimeout(uint32_t timeout = 180); |
itead | 3:9f745022331a | 259 | |
itead | 3:9f745022331a | 260 | /** |
itead | 4:c8e2381d34d2 | 261 | * Start TCP Server(Only in multiple mode). |
itead | 4:c8e2381d34d2 | 262 | * |
itead | 4:c8e2381d34d2 | 263 | * After started, user should call method: getIPStatus to know the status of TCP connections. |
itead | 4:c8e2381d34d2 | 264 | * The methods of receiving data can be called for user's any purpose. After communication, |
itead | 4:c8e2381d34d2 | 265 | * release the TCP connection is needed by calling method: releaseTCP with mux_id. |
itead | 4:c8e2381d34d2 | 266 | * |
itead | 4:c8e2381d34d2 | 267 | * @param port - the port number to listen(default: 333). |
itead | 4:c8e2381d34d2 | 268 | * @retval true - success. |
itead | 4:c8e2381d34d2 | 269 | * @retval false - failure. |
itead | 4:c8e2381d34d2 | 270 | * |
itead | 4:c8e2381d34d2 | 271 | * @see String getIPStatus(void); |
itead | 4:c8e2381d34d2 | 272 | * @see uint32_t recv(uint8_t *coming_mux_id, uint8_t *buffer, uint32_t len, uint32_t timeout); |
itead | 4:c8e2381d34d2 | 273 | * @see bool releaseTCP(uint8_t mux_id); |
itead | 4:c8e2381d34d2 | 274 | */ |
itead | 4:c8e2381d34d2 | 275 | bool startTCPServer(uint32_t port = 333); |
itead | 4:c8e2381d34d2 | 276 | |
itead | 4:c8e2381d34d2 | 277 | /** |
itead | 4:c8e2381d34d2 | 278 | * Stop TCP Server(Only in multiple mode). |
itead | 4:c8e2381d34d2 | 279 | * |
itead | 4:c8e2381d34d2 | 280 | * @retval true - success. |
itead | 4:c8e2381d34d2 | 281 | * @retval false - failure. |
itead | 4:c8e2381d34d2 | 282 | */ |
itead | 4:c8e2381d34d2 | 283 | bool stopTCPServer(void); |
itead | 4:c8e2381d34d2 | 284 | |
itead | 4:c8e2381d34d2 | 285 | /** |
itead | 4:c8e2381d34d2 | 286 | * Send data based on TCP or UDP builded already in single mode. |
itead | 4:c8e2381d34d2 | 287 | * |
itead | 4:c8e2381d34d2 | 288 | * @param buffer - the buffer of data to send. |
itead | 4:c8e2381d34d2 | 289 | * @param len - the length of data to send. |
itead | 4:c8e2381d34d2 | 290 | * @retval true - success. |
itead | 4:c8e2381d34d2 | 291 | * @retval false - failure. |
itead | 4:c8e2381d34d2 | 292 | */ |
itead | 4:c8e2381d34d2 | 293 | bool send(const uint8_t *buffer, uint32_t len); |
itead | 4:c8e2381d34d2 | 294 | |
itead | 4:c8e2381d34d2 | 295 | /** |
itead | 3:9f745022331a | 296 | * Send data based on one of TCP or UDP builded already in multiple mode. |
itead | 3:9f745022331a | 297 | * |
itead | 3:9f745022331a | 298 | * @param mux_id - the identifier of this TCP(available value: 0 - 4). |
itead | 3:9f745022331a | 299 | * @param buffer - the buffer of data to send. |
itead | 3:9f745022331a | 300 | * @param len - the length of data to send. |
itead | 3:9f745022331a | 301 | * @retval true - success. |
itead | 3:9f745022331a | 302 | * @retval false - failure. |
itead | 3:9f745022331a | 303 | */ |
itead | 3:9f745022331a | 304 | bool send(uint8_t mux_id, const char *buffer, uint32_t len); |
itead | 3:9f745022331a | 305 | |
itead | 3:9f745022331a | 306 | /** |
itead | 4:c8e2381d34d2 | 307 | * Receive data from TCP or UDP builded already in single mode. |
itead | 4:c8e2381d34d2 | 308 | * |
itead | 4:c8e2381d34d2 | 309 | * @param buffer - the buffer for storing data. |
itead | 4:c8e2381d34d2 | 310 | * @param len - the length of the buffer. |
itead | 4:c8e2381d34d2 | 311 | * @param timeout - the time waiting data. |
itead | 4:c8e2381d34d2 | 312 | * @return the length of data received actually. |
itead | 4:c8e2381d34d2 | 313 | */ |
itead | 4:c8e2381d34d2 | 314 | uint32_t recv(uint8_t *buffer, uint32_t len, uint32_t timeout = 1000); |
itead | 4:c8e2381d34d2 | 315 | |
itead | 4:c8e2381d34d2 | 316 | /** |
itead | 3:9f745022331a | 317 | * Receive data from one of TCP or UDP builded already in multiple mode. |
itead | 3:9f745022331a | 318 | * |
itead | 3:9f745022331a | 319 | * @param mux_id - the identifier of this TCP(available value: 0 - 4). |
itead | 3:9f745022331a | 320 | * @param buffer - the buffer for storing data. |
itead | 3:9f745022331a | 321 | * @param len - the length of the buffer. |
itead | 3:9f745022331a | 322 | * @param timeout - the time waiting data. |
itead | 3:9f745022331a | 323 | * @return the length of data received actually. |
itead | 3:9f745022331a | 324 | */ |
itead | 3:9f745022331a | 325 | uint32_t recv(uint8_t mux_id, uint8_t *buffer, uint32_t len, uint32_t timeout = 1000); |
itead | 3:9f745022331a | 326 | |
itead | 3:9f745022331a | 327 | /** |
itead | 3:9f745022331a | 328 | * Receive data from all of TCP or UDP builded already in multiple mode. |
itead | 3:9f745022331a | 329 | * |
itead | 3:9f745022331a | 330 | * After return, coming_mux_id store the id of TCP or UDP from which data coming. |
itead | 3:9f745022331a | 331 | * User should read the value of coming_mux_id and decide what next to do. |
itead | 3:9f745022331a | 332 | * |
itead | 3:9f745022331a | 333 | * @param coming_mux_id - the identifier of TCP or UDP. |
itead | 3:9f745022331a | 334 | * @param buffer - the buffer for storing data. |
itead | 3:9f745022331a | 335 | * @param len - the length of the buffer. |
itead | 3:9f745022331a | 336 | * @param timeout - the time waiting data. |
itead | 3:9f745022331a | 337 | * @return the length of data received actually. |
itead | 3:9f745022331a | 338 | */ |
itead | 3:9f745022331a | 339 | uint32_t recv(uint8_t *coming_mux_id, uint8_t *buffer, uint32_t len, uint32_t timeout = 1000); |
itead | 4:c8e2381d34d2 | 340 | |
itead | 1:edc634cad906 | 341 | private: |
itead | 3:9f745022331a | 342 | ArduinoSerial *m_puart; /* The UART to communicate with ESP8266 */ |
itead | 1:edc634cad906 | 343 | |
itead | 1:edc634cad906 | 344 | }; |
itead | 0:d3b93948c925 | 345 | |
itead | 2:fb209f93f3f1 | 346 | #endif /* #ifndef __ESP8266_H__ */ |