Dopasowany do naszego firmware'u

Dependencies:   ArduinoAPI

Fork of WeeESP8266 by ITEAD STUDIO

Committer:
jakpor
Date:
Mon Apr 27 18:37:27 2015 +0000
Revision:
22:27be62d9d01f
Parent:
21:d1a7f48ab3ba
Wifi - 90% skuteczno?ci

Who changed what in which revision?

UserRevisionLine numberNew 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
jakpor 22:27be62d9d01f 39 // funkcja do czyszczenia bufora (flush tylko zwalnia pamięć, a dużo zer ją wyzeruje)
jakpor 22:27be62d9d01f 40 void clear_serial();
jakpor 22:27be62d9d01f 41
itead 1:edc634cad906 42 /**
itead 3:9f745022331a 43 * Verify ESP8266 whether live or not.
itead 1:edc634cad906 44 *
itead 1:edc634cad906 45 * Actually, this method will send command "AT" to ESP8266 and waiting for "OK".
itead 1:edc634cad906 46 *
itead 1:edc634cad906 47 * @retval true - alive.
itead 1:edc634cad906 48 * @retval false - dead.
jakpor 22:27be62d9d01f 49 */
itead 1:edc634cad906 50 bool kick(void);
itead 1:edc634cad906 51
itead 1:edc634cad906 52 /**
itead 1:edc634cad906 53 * Restart ESP8266 by "AT+RST".
itead 1:edc634cad906 54 *
itead 1:edc634cad906 55 * This method will take 3 seconds or more.
itead 1:edc634cad906 56 *
itead 1:edc634cad906 57 * @retval true - success.
itead 1:edc634cad906 58 * @retval false - failure.
itead 1:edc634cad906 59 */
itead 1:edc634cad906 60 bool restart(void);
itead 1:edc634cad906 61
itead 1:edc634cad906 62 /**
itead 1:edc634cad906 63 * Get the version of AT Command Set.
itead 1:edc634cad906 64 *
itead 1:edc634cad906 65 * @return the string of version.
itead 1:edc634cad906 66 */
itead 1:edc634cad906 67 String getVersion(void);
itead 1:edc634cad906 68
itead 1:edc634cad906 69 /**
itead 1:edc634cad906 70 * Set operation mode to staion.
itead 1:edc634cad906 71 *
itead 1:edc634cad906 72 * @retval true - success.
itead 1:edc634cad906 73 * @retval false - failure.
itead 1:edc634cad906 74 */
itead 1:edc634cad906 75 bool setOprToStation(void);
itead 1:edc634cad906 76
itead 1:edc634cad906 77 /**
itead 1:edc634cad906 78 * Set operation mode to softap.
itead 1:edc634cad906 79 *
itead 1:edc634cad906 80 * @retval true - success.
itead 1:edc634cad906 81 * @retval false - failure.
itead 1:edc634cad906 82 */
itead 1:edc634cad906 83 bool setOprToSoftAP(void);
itead 1:edc634cad906 84
itead 1:edc634cad906 85 /**
itead 1:edc634cad906 86 * Set operation mode to station + softap.
itead 1:edc634cad906 87 *
itead 1:edc634cad906 88 * @retval true - success.
itead 1:edc634cad906 89 * @retval false - failure.
itead 1:edc634cad906 90 */
itead 1:edc634cad906 91 bool setOprToStationSoftAP(void);
itead 1:edc634cad906 92
itead 1:edc634cad906 93 /**
itead 1:edc634cad906 94 * Search available AP list and return it.
itead 1:edc634cad906 95 *
itead 1:edc634cad906 96 * @return the list of available APs.
itead 1:edc634cad906 97 * @note This method will occupy a lot of memeory(hundreds of Bytes to a couple of KBytes).
itead 1:edc634cad906 98 * Do not call this method unless you must and ensure that your board has enough memery left.
itead 1:edc634cad906 99 */
itead 1:edc634cad906 100 String getAPList(void);
itead 1:edc634cad906 101
itead 1:edc634cad906 102 /**
itead 1:edc634cad906 103 * Join in AP.
itead 1:edc634cad906 104 *
itead 1:edc634cad906 105 * @param ssid - SSID of AP to join in.
itead 1:edc634cad906 106 * @param pwd - Password of AP to join in.
itead 1:edc634cad906 107 * @retval true - success.
itead 1:edc634cad906 108 * @retval false - failure.
itead 1:edc634cad906 109 * @note This method will take a couple of seconds.
itead 1:edc634cad906 110 */
itead 1:edc634cad906 111 bool joinAP(String ssid, String pwd);
itead 1:edc634cad906 112
itead 1:edc634cad906 113 /**
itead 1:edc634cad906 114 * Leave AP joined before.
itead 1:edc634cad906 115 *
itead 1:edc634cad906 116 * @retval true - success.
itead 1:edc634cad906 117 * @retval false - failure.
itead 1:edc634cad906 118 */
itead 1:edc634cad906 119 bool leaveAP(void);
itead 1:edc634cad906 120
itead 1:edc634cad906 121 /**
itead 1:edc634cad906 122 * Set SoftAP parameters.
itead 1:edc634cad906 123 *
itead 1:edc634cad906 124 * @param ssid - SSID of SoftAP.
itead 1:edc634cad906 125 * @param pwd - PASSWORD of SoftAP.
itead 1:edc634cad906 126 * @param chl - the channel (1 - 13, default: 7).
itead 1:edc634cad906 127 * @param ecn - the way of encrypstion (0 - OPEN, 1 - WEP,
itead 21:d1a7f48ab3ba 128 * 2 - WPA_PSK, 3 - WPA2_PSK, 4 - WPA_WPA2_PSK, default: 4).
itead 1:edc634cad906 129 * @note This method should not be called when station mode.
itead 1:edc634cad906 130 */
itead 6:18eb2d9fb2ac 131 bool setSoftAPParam(String ssid, String pwd, uint8_t chl = 7, uint8_t ecn = 4);
itead 1:edc634cad906 132
itead 1:edc634cad906 133 /**
itead 1:edc634cad906 134 * Get the IP list of devices connected to SoftAP.
itead 1:edc634cad906 135 *
itead 1:edc634cad906 136 * @return the list of IP.
itead 1:edc634cad906 137 * @note This method should not be called when station mode.
itead 1:edc634cad906 138 */
itead 3:9f745022331a 139 String getJoinedDeviceIP(void);
itead 3:9f745022331a 140
itead 3:9f745022331a 141 /**
itead 3:9f745022331a 142 * Get the current status of connection(UDP and TCP).
itead 3:9f745022331a 143 *
itead 3:9f745022331a 144 * @return the status.
jakpor 22:27be62d9d01f 145 true - connected
jakpor 22:27be62d9d01f 146 false - disconnected
itead 3:9f745022331a 147 */
jakpor 22:27be62d9d01f 148 int getIPStatus(void);
itead 3:9f745022331a 149
itead 3:9f745022331a 150 /**
itead 3:9f745022331a 151 * Get the IP address of ESP8266.
itead 3:9f745022331a 152 *
itead 3:9f745022331a 153 * @return the IP list.
itead 3:9f745022331a 154 */
itead 3:9f745022331a 155 String getLocalIP(void);
itead 3:9f745022331a 156
itead 3:9f745022331a 157 /**
itead 3:9f745022331a 158 * Enable IP MUX(multiple connection mode).
itead 3:9f745022331a 159 *
itead 3:9f745022331a 160 * In multiple connection mode, a couple of TCP and UDP communication can be builded.
itead 3:9f745022331a 161 * They can be distinguished by the identifier of TCP or UDP named mux_id.
itead 3:9f745022331a 162 *
itead 3:9f745022331a 163 * @retval true - success.
itead 3:9f745022331a 164 * @retval false - failure.
itead 3:9f745022331a 165 */
itead 3:9f745022331a 166 bool enableMUX(void);
itead 3:9f745022331a 167
itead 3:9f745022331a 168 /**
itead 3:9f745022331a 169 * Disable IP MUX(single connection mode).
itead 3:9f745022331a 170 *
itead 3:9f745022331a 171 * In single connection mode, only one TCP or UDP communication can be builded.
itead 3:9f745022331a 172 *
itead 3:9f745022331a 173 * @retval true - success.
itead 3:9f745022331a 174 * @retval false - failure.
itead 3:9f745022331a 175 */
itead 3:9f745022331a 176 bool disableMUX(void);
itead 3:9f745022331a 177
itead 3:9f745022331a 178
itead 3:9f745022331a 179 /**
itead 3:9f745022331a 180 * Create TCP connection in single mode.
itead 3:9f745022331a 181 *
itead 3:9f745022331a 182 * @param addr - the IP or domain name of the target host.
itead 3:9f745022331a 183 * @param port - the port number of the target host.
itead 3:9f745022331a 184 * @retval true - success.
itead 3:9f745022331a 185 * @retval false - failure.
itead 3:9f745022331a 186 */
itead 3:9f745022331a 187 bool createTCP(String addr, uint32_t port);
itead 3:9f745022331a 188
itead 3:9f745022331a 189 /**
itead 3:9f745022331a 190 * Release TCP connection in single mode.
itead 3:9f745022331a 191 *
itead 3:9f745022331a 192 * @retval true - success.
itead 3:9f745022331a 193 * @retval false - failure.
itead 3:9f745022331a 194 */
itead 3:9f745022331a 195 bool releaseTCP(void);
itead 3:9f745022331a 196
itead 3:9f745022331a 197 /**
itead 3:9f745022331a 198 * Register UDP port number in single mode.
itead 3:9f745022331a 199 *
itead 3:9f745022331a 200 * @param addr - the IP or domain name of the target host.
itead 3:9f745022331a 201 * @param port - the port number of the target host.
itead 3:9f745022331a 202 * @retval true - success.
itead 3:9f745022331a 203 * @retval false - failure.
itead 3:9f745022331a 204 */
itead 3:9f745022331a 205 bool registerUDP(String addr, uint32_t port);
itead 3:9f745022331a 206
itead 3:9f745022331a 207 /**
itead 3:9f745022331a 208 * Unregister UDP port number in single mode.
itead 3:9f745022331a 209 *
itead 3:9f745022331a 210 * @retval true - success.
itead 3:9f745022331a 211 * @retval false - failure.
itead 3:9f745022331a 212 */
itead 3:9f745022331a 213 bool unregisterUDP(void);
itead 4:c8e2381d34d2 214
itead 3:9f745022331a 215 /**
itead 3:9f745022331a 216 * Create TCP connection in multiple mode.
itead 3:9f745022331a 217 *
itead 3:9f745022331a 218 * @param mux_id - the identifier of this TCP(available value: 0 - 4).
itead 3:9f745022331a 219 * @param addr - the IP or domain name of the target host.
itead 3:9f745022331a 220 * @param port - the port number of the target host.
itead 3:9f745022331a 221 * @retval true - success.
itead 3:9f745022331a 222 * @retval false - failure.
itead 3:9f745022331a 223 */
itead 3:9f745022331a 224 bool createTCP(uint8_t mux_id, String addr, uint32_t port);
itead 3:9f745022331a 225
itead 3:9f745022331a 226 /**
itead 3:9f745022331a 227 * Release TCP connection in multiple mode.
itead 3:9f745022331a 228 *
itead 3:9f745022331a 229 * @param mux_id - the identifier of this TCP(available value: 0 - 4).
itead 3:9f745022331a 230 * @retval true - success.
itead 3:9f745022331a 231 * @retval false - failure.
itead 3:9f745022331a 232 */
itead 3:9f745022331a 233 bool releaseTCP(uint8_t mux_id);
itead 3:9f745022331a 234
itead 3:9f745022331a 235 /**
itead 3:9f745022331a 236 * Register UDP port number in multiple mode.
itead 3:9f745022331a 237 *
itead 3:9f745022331a 238 * @param mux_id - the identifier of this TCP(available value: 0 - 4).
itead 3:9f745022331a 239 * @param addr - the IP or domain name of the target host.
itead 3:9f745022331a 240 * @param port - the port number of the target host.
itead 3:9f745022331a 241 * @retval true - success.
itead 3:9f745022331a 242 * @retval false - failure.
itead 3:9f745022331a 243 */
itead 3:9f745022331a 244 bool registerUDP(uint8_t mux_id, String addr, uint32_t port);
itead 3:9f745022331a 245
itead 3:9f745022331a 246 /**
itead 3:9f745022331a 247 * Unregister UDP port number in multiple mode.
itead 3:9f745022331a 248 *
itead 3:9f745022331a 249 * @param mux_id - the identifier of this TCP(available value: 0 - 4).
itead 3:9f745022331a 250 * @retval true - success.
itead 3:9f745022331a 251 * @retval false - failure.
itead 3:9f745022331a 252 */
itead 3:9f745022331a 253 bool unregisterUDP(uint8_t mux_id);
itead 4:c8e2381d34d2 254
itead 4:c8e2381d34d2 255
itead 4:c8e2381d34d2 256 /**
itead 4:c8e2381d34d2 257 * Set the timeout of TCP Server.
itead 4:c8e2381d34d2 258 *
itead 4:c8e2381d34d2 259 * @param timeout - the duration for timeout by second(0 ~ 28800, default:180).
itead 4:c8e2381d34d2 260 * @retval true - success.
itead 4:c8e2381d34d2 261 * @retval false - failure.
itead 4:c8e2381d34d2 262 */
itead 4:c8e2381d34d2 263 bool setTCPServerTimeout(uint32_t timeout = 180);
itead 3:9f745022331a 264
itead 3:9f745022331a 265 /**
itead 4:c8e2381d34d2 266 * Start TCP Server(Only in multiple mode).
itead 4:c8e2381d34d2 267 *
itead 4:c8e2381d34d2 268 * After started, user should call method: getIPStatus to know the status of TCP connections.
itead 4:c8e2381d34d2 269 * The methods of receiving data can be called for user's any purpose. After communication,
itead 4:c8e2381d34d2 270 * release the TCP connection is needed by calling method: releaseTCP with mux_id.
itead 4:c8e2381d34d2 271 *
itead 4:c8e2381d34d2 272 * @param port - the port number to listen(default: 333).
itead 4:c8e2381d34d2 273 * @retval true - success.
itead 4:c8e2381d34d2 274 * @retval false - failure.
itead 4:c8e2381d34d2 275 *
itead 4:c8e2381d34d2 276 * @see String getIPStatus(void);
itead 4:c8e2381d34d2 277 * @see uint32_t recv(uint8_t *coming_mux_id, uint8_t *buffer, uint32_t len, uint32_t timeout);
itead 4:c8e2381d34d2 278 * @see bool releaseTCP(uint8_t mux_id);
itead 4:c8e2381d34d2 279 */
itead 4:c8e2381d34d2 280 bool startTCPServer(uint32_t port = 333);
itead 4:c8e2381d34d2 281
itead 4:c8e2381d34d2 282 /**
itead 4:c8e2381d34d2 283 * Stop TCP Server(Only in multiple mode).
itead 4:c8e2381d34d2 284 *
itead 4:c8e2381d34d2 285 * @retval true - success.
itead 4:c8e2381d34d2 286 * @retval false - failure.
itead 4:c8e2381d34d2 287 */
itead 4:c8e2381d34d2 288 bool stopTCPServer(void);
itead 4:c8e2381d34d2 289
itead 4:c8e2381d34d2 290 /**
itead 4:c8e2381d34d2 291 * Send data based on TCP or UDP builded already in single mode.
itead 4:c8e2381d34d2 292 *
itead 4:c8e2381d34d2 293 * @param buffer - the buffer of data to send.
itead 4:c8e2381d34d2 294 * @param len - the length of data to send.
itead 4:c8e2381d34d2 295 * @retval true - success.
itead 4:c8e2381d34d2 296 * @retval false - failure.
itead 4:c8e2381d34d2 297 */
itead 4:c8e2381d34d2 298 bool send(const uint8_t *buffer, uint32_t len);
itead 4:c8e2381d34d2 299
itead 4:c8e2381d34d2 300 /**
itead 3:9f745022331a 301 * Send data based on one of TCP or UDP builded already in multiple mode.
itead 3:9f745022331a 302 *
itead 3:9f745022331a 303 * @param mux_id - the identifier of this TCP(available value: 0 - 4).
itead 3:9f745022331a 304 * @param buffer - the buffer of data to send.
itead 3:9f745022331a 305 * @param len - the length of data to send.
itead 3:9f745022331a 306 * @retval true - success.
itead 3:9f745022331a 307 * @retval false - failure.
itead 3:9f745022331a 308 */
itead 9:dec2cf52b744 309 bool send(uint8_t mux_id, const uint8_t *buffer, uint32_t len);
itead 3:9f745022331a 310
itead 3:9f745022331a 311 /**
itead 4:c8e2381d34d2 312 * Receive data from TCP or UDP builded already in single mode.
itead 4:c8e2381d34d2 313 *
itead 4:c8e2381d34d2 314 * @param buffer - the buffer for storing data.
itead 9:dec2cf52b744 315 * @param buffer_size - the length of the buffer.
itead 4:c8e2381d34d2 316 * @param timeout - the time waiting data.
itead 4:c8e2381d34d2 317 * @return the length of data received actually.
itead 4:c8e2381d34d2 318 */
itead 9:dec2cf52b744 319 uint32_t recv(uint8_t *buffer, uint32_t buffer_size, uint32_t timeout = 1000);
itead 4:c8e2381d34d2 320
itead 4:c8e2381d34d2 321 /**
itead 3:9f745022331a 322 * Receive data from one of TCP or UDP builded already in multiple mode.
itead 3:9f745022331a 323 *
itead 3:9f745022331a 324 * @param mux_id - the identifier of this TCP(available value: 0 - 4).
itead 3:9f745022331a 325 * @param buffer - the buffer for storing data.
itead 9:dec2cf52b744 326 * @param buffer_size - the length of the buffer.
itead 3:9f745022331a 327 * @param timeout - the time waiting data.
itead 3:9f745022331a 328 * @return the length of data received actually.
itead 3:9f745022331a 329 */
itead 9:dec2cf52b744 330 uint32_t recv(uint8_t mux_id, uint8_t *buffer, uint32_t buffer_size, uint32_t timeout = 1000);
itead 3:9f745022331a 331
itead 3:9f745022331a 332 /**
itead 3:9f745022331a 333 * Receive data from all of TCP or UDP builded already in multiple mode.
itead 3:9f745022331a 334 *
itead 3:9f745022331a 335 * After return, coming_mux_id store the id of TCP or UDP from which data coming.
itead 3:9f745022331a 336 * User should read the value of coming_mux_id and decide what next to do.
itead 3:9f745022331a 337 *
itead 3:9f745022331a 338 * @param coming_mux_id - the identifier of TCP or UDP.
itead 3:9f745022331a 339 * @param buffer - the buffer for storing data.
itead 9:dec2cf52b744 340 * @param buffer_size - the length of the buffer.
itead 3:9f745022331a 341 * @param timeout - the time waiting data.
itead 3:9f745022331a 342 * @return the length of data received actually.
itead 3:9f745022331a 343 */
itead 9:dec2cf52b744 344 uint32_t recv(uint8_t *coming_mux_id, uint8_t *buffer, uint32_t buffer_size, uint32_t timeout = 1000);
itead 4:c8e2381d34d2 345
itead 1:edc634cad906 346 private:
itead 9:dec2cf52b744 347 /*
itead 9:dec2cf52b744 348 * Recvive data from uart. Return all received data if target found or timeout.
itead 9:dec2cf52b744 349 */
itead 6:18eb2d9fb2ac 350 String recvString(String target, uint32_t timeout = 1000);
itead 9:dec2cf52b744 351
itead 9:dec2cf52b744 352 /*
itead 9:dec2cf52b744 353 * Recvive data from uart. Return all received data if one of target1 and target2 found or timeout.
itead 9:dec2cf52b744 354 */
itead 6:18eb2d9fb2ac 355 String recvString(String target1, String target2, uint32_t timeout = 1000);
itead 9:dec2cf52b744 356
itead 9:dec2cf52b744 357 /*
itead 9:dec2cf52b744 358 * Recvive data from uart. Return all received data if one of target1, target2 and target3 found or timeout.
itead 9:dec2cf52b744 359 */
itead 6:18eb2d9fb2ac 360 String recvString(String target1, String target2, String target3, uint32_t timeout = 1000);
itead 9:dec2cf52b744 361
itead 9:dec2cf52b744 362 /*
itead 9:dec2cf52b744 363 * Recvive data from uart and search first target. Return true if target found, false for timeout.
itead 9:dec2cf52b744 364 */
itead 6:18eb2d9fb2ac 365 bool recvFind(String target, uint32_t timeout = 1000);
itead 9:dec2cf52b744 366
itead 9:dec2cf52b744 367 /*
itead 9:dec2cf52b744 368 * Recvive data from uart and search first target and cut out the substring between begin and end(excluding begin and end self).
itead 9:dec2cf52b744 369 * Return true if target found, false for timeout.
itead 9:dec2cf52b744 370 */
itead 6:18eb2d9fb2ac 371 bool recvFindAndFilter(String target, String begin, String end, String &data, uint32_t timeout = 1000);
itead 5:5fa655d7212c 372
itead 9:dec2cf52b744 373 /*
itead 9:dec2cf52b744 374 * Receive a package from uart.
itead 9:dec2cf52b744 375 *
itead 9:dec2cf52b744 376 * @param buffer - the buffer storing data.
itead 9:dec2cf52b744 377 * @param buffer_size - guess what!
itead 9:dec2cf52b744 378 * @param data_len - the length of data actually received(maybe more than buffer_size, the remained data will be abandoned).
itead 9:dec2cf52b744 379 * @param timeout - the duration waitting data comming.
itead 9:dec2cf52b744 380 * @param coming_mux_id - in single connection mode, should be NULL and not NULL in multiple.
itead 9:dec2cf52b744 381 */
itead 15:5c5a85e984a8 382 uint32_t recvPkg(uint8_t *buffer, uint32_t buffer_size, uint32_t *data_len, uint32_t timeout, uint8_t *coming_mux_id);
itead 9:dec2cf52b744 383
itead 9:dec2cf52b744 384
itead 5:5fa655d7212c 385 bool eAT(void);
itead 5:5fa655d7212c 386 bool eATRST(void);
itead 6:18eb2d9fb2ac 387 bool eATGMR(String &version);
itead 5:5fa655d7212c 388
itead 10:002615561b0b 389 bool qATCWMODE(uint8_t *mode);
itead 5:5fa655d7212c 390 bool sATCWMODE(uint8_t mode);
itead 6:18eb2d9fb2ac 391 bool sATCWJAP(String ssid, String pwd);
itead 6:18eb2d9fb2ac 392 bool eATCWLAP(String &list);
itead 6:18eb2d9fb2ac 393 bool eATCWQAP(void);
itead 6:18eb2d9fb2ac 394 bool sATCWSAP(String ssid, String pwd, uint8_t chl, uint8_t ecn);
itead 6:18eb2d9fb2ac 395 bool eATCWLIF(String &list);
itead 6:18eb2d9fb2ac 396
itead 6:18eb2d9fb2ac 397 bool eATCIPSTATUS(String &list);
itead 6:18eb2d9fb2ac 398 bool sATCIPSTARTSingle(String type, String addr, uint32_t port);
itead 6:18eb2d9fb2ac 399 bool sATCIPSTARTMultiple(uint8_t mux_id, String type, String addr, uint32_t port);
itead 9:dec2cf52b744 400 bool sATCIPSENDSingle(const uint8_t *buffer, uint32_t len);
itead 9:dec2cf52b744 401 bool sATCIPSENDMultiple(uint8_t mux_id, const uint8_t *buffer, uint32_t len);
itead 6:18eb2d9fb2ac 402 bool sATCIPCLOSEMulitple(uint8_t mux_id);
itead 6:18eb2d9fb2ac 403 bool eATCIPCLOSESingle(void);
itead 6:18eb2d9fb2ac 404 bool eATCIFSR(String &list);
itead 6:18eb2d9fb2ac 405 bool sATCIPMUX(uint8_t mode);
itead 9:dec2cf52b744 406 bool sATCIPSERVER(uint8_t mode, uint32_t port = 333);
itead 6:18eb2d9fb2ac 407 bool sATCIPSTO(uint32_t timeout);
itead 6:18eb2d9fb2ac 408
itead 6:18eb2d9fb2ac 409 /*
itead 6:18eb2d9fb2ac 410 * +IPD,len:data
itead 6:18eb2d9fb2ac 411 * +IPD,id,len:data
itead 6:18eb2d9fb2ac 412 */
itead 6:18eb2d9fb2ac 413
itead 6:18eb2d9fb2ac 414
itead 3:9f745022331a 415 ArduinoSerial *m_puart; /* The UART to communicate with ESP8266 */
itead 1:edc634cad906 416
itead 1:edc634cad906 417 };
itead 0:d3b93948c925 418
itead 2:fb209f93f3f1 419 #endif /* #ifndef __ESP8266_H__ */