uClimate / ESP8266_moj

Dependencies:   ArduinoAPI

Fork of WeeESP8266 by ITEAD STUDIO

Files at this revision

API Documentation at this revision

Comitter:
itead
Date:
Fri Feb 06 00:55:22 2015 +0000
Parent:
1:edc634cad906
Child:
3:9f745022331a
Commit message:
Rename ESP8266AT to ESP8266

Changed in this revision

ESP8266.cpp Show annotated file Show diff for this revision Revisions of this file
ESP8266.h Show annotated file Show diff for this revision Revisions of this file
ESP8266AT.cpp Show diff for this revision Revisions of this file
ESP8266AT.h Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ESP8266.cpp	Fri Feb 06 00:55:22 2015 +0000
@@ -0,0 +1,2 @@
+#include "ESP8266.h"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ESP8266.h	Fri Feb 06 00:55:22 2015 +0000
@@ -0,0 +1,140 @@
+/**
+ * @file ESP8266.h
+ * @brief The definition of class ESP8266. 
+ * @author Wu Pengfei<pengfei.wu@itead.cc> 
+ * @date 2015.02
+ * 
+ * @par Copyright:
+ * Copyright (c) 2015 ITEAD Intelligent Systems Co., Ltd. \n\n
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version. \n\n
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef __ESP8266_H__
+#define __ESP8266_H__
+
+#include "ArduinoAPI.h"
+
+/**
+ * Provide an easy-to-use way to manipulate ESP8266. 
+ */
+class ESP8266 {
+ public:
+ 
+    /* Constructors */
+    ESP8266(PinName tx, PinName rx, int32_t baud_rate = 9600);
+    
+    /** 
+     * Verify ESP8266 live or not. 
+     *
+     * Actually, this method will send command "AT" to ESP8266 and waiting for "OK". 
+     * 
+     * @retval true - alive.
+     * @retval false - dead.
+     */
+    bool kick(void);
+    
+    /**
+     * Restart ESP8266 by "AT+RST". 
+     *
+     * This method will take 3 seconds or more. 
+     *
+     * @retval true - success.
+     * @retval false - failure.
+     */
+    bool restart(void);
+    
+    /**
+     * Get the version of AT Command Set. 
+     * 
+     * @return the string of version. 
+     */
+    String getVersion(void);
+    
+    /**
+     * Set operation mode to staion. 
+     * 
+     * @retval true - success.
+     * @retval false - failure.
+     */
+    bool setOprToStation(void);
+    
+    /**
+     * Set operation mode to softap. 
+     * 
+     * @retval true - success.
+     * @retval false - failure.
+     */
+    bool setOprToSoftAP(void);
+    
+    /**
+     * Set operation mode to station + softap. 
+     * 
+     * @retval true - success.
+     * @retval false - failure.
+     */
+    bool setOprToStationSoftAP(void);
+    
+    /**
+     * Search available AP list and return it.
+     * 
+     * @return the list of available APs. 
+     * @note This method will occupy a lot of memeory(hundreds of Bytes to a couple of KBytes). 
+     *  Do not call this method unless you must and ensure that your board has enough memery left.
+     */
+    String getAPList(void);
+    
+    /**
+     * Join in AP. 
+     *
+     * @param ssid - SSID of AP to join in. 
+     * @param pwd - Password of AP to join in. 
+     * @retval true - success.
+     * @retval false - failure.
+     * @note This method will take a couple of seconds. 
+     */
+    bool joinAP(String ssid, String pwd);
+    
+    /**
+     * Leave AP joined before. 
+     *
+     * @retval true - success.
+     * @retval false - failure.
+     */
+    bool leaveAP(void);
+    
+    /**
+     * Set SoftAP parameters. 
+     * 
+     * @param ssid - SSID of SoftAP. 
+     * @param pwd - PASSWORD of SoftAP. 
+     * @param chl - the channel (1 - 13, default: 7). 
+     * @param ecn - the way of encrypstion (0 - OPEN, 1 - WEP, 
+     *  2 - WPA_PSK, 3 - WPA2_PSK, 4 - WPA_WPA2_PSK, default: 0). 
+     * @note This method should not be called when station mode. 
+     */
+    bool setSoftAPParam(String ssid, String pwd, uint8_t chl = 7, uint8_t ecn = 0);
+    
+    /**
+     * Get the IP list of devices connected to SoftAP. 
+     * 
+     * @return the list of IP.
+     * @note This method should not be called when station mode. 
+     */
+    String getDeviceIP(void);
+    
+    
+ private:
+    ArduinoSerial m_uart; /* The UART to communicate with ESP8266 */
+ 
+};
+
+#endif /* #ifndef __ESP8266_H__ */
\ No newline at end of file
--- a/ESP8266AT.cpp	Thu Feb 05 10:21:21 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-#include "ESP8266AT.h"
-
--- a/ESP8266AT.h	Thu Feb 05 10:21:21 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/**
- * @file ESP8266AT.h
- * @brief The definition of class ESP8266AT. 
- * @author Wu Pengfei<pengfei.wu@itead.cc> 
- * @date 2015.02
- * 
- * @par Copyright:
- * Copyright (c) 2015 ITEAD Intelligent Systems Co., Ltd. \n\n
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version. \n\n
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef __ESP8266AT_H__
-#define __ESP8266AT_H__
-
-#include "ArduinoAPI.h"
-
-/**
- * Provide an easy-to-use way to manipulate ESP8266. 
- */
-class ESP8266AT {
- public:
- 
-    /* Constructors */
-    ESP8266AT(PinName tx, PinName rx, int32_t baud_rate = 9600);
-    
-    /** 
-     * Verify ESP8266 live or not. 
-     *
-     * Actually, this method will send command "AT" to ESP8266 and waiting for "OK". 
-     * 
-     * @retval true - alive.
-     * @retval false - dead.
-     */
-    bool kick(void);
-    
-    /**
-     * Restart ESP8266 by "AT+RST". 
-     *
-     * This method will take 3 seconds or more. 
-     *
-     * @retval true - success.
-     * @retval false - failure.
-     */
-    bool restart(void);
-    
-    /**
-     * Get the version of AT Command Set. 
-     * 
-     * @return the string of version. 
-     */
-    String getVersion(void);
-    
-    /**
-     * Set operation mode to staion. 
-     * 
-     * @retval true - success.
-     * @retval false - failure.
-     */
-    bool setOprToStation(void);
-    
-    /**
-     * Set operation mode to softap. 
-     * 
-     * @retval true - success.
-     * @retval false - failure.
-     */
-    bool setOprToSoftAP(void);
-    
-    /**
-     * Set operation mode to station + softap. 
-     * 
-     * @retval true - success.
-     * @retval false - failure.
-     */
-    bool setOprToStationSoftAP(void);
-    
-    /**
-     * Search available AP list and return it.
-     * 
-     * @return the list of available APs. 
-     * @note This method will occupy a lot of memeory(hundreds of Bytes to a couple of KBytes). 
-     *  Do not call this method unless you must and ensure that your board has enough memery left.
-     */
-    String getAPList(void);
-    
-    /**
-     * Join in AP. 
-     *
-     * @param ssid - SSID of AP to join in. 
-     * @param pwd - Password of AP to join in. 
-     * @retval true - success.
-     * @retval false - failure.
-     * @note This method will take a couple of seconds. 
-     */
-    bool joinAP(String ssid, String pwd);
-    
-    /**
-     * Leave AP joined before. 
-     *
-     * @retval true - success.
-     * @retval false - failure.
-     */
-    bool leaveAP(void);
-    
-    /**
-     * Set SoftAP parameters. 
-     * 
-     * @param ssid - SSID of SoftAP. 
-     * @param pwd - PASSWORD of SoftAP. 
-     * @param chl - the channel (1 - 13, default: 7). 
-     * @param ecn - the way of encrypstion (0 - OPEN, 1 - WEP, 
-     *  2 - WPA_PSK, 3 - WPA2_PSK, 4 - WPA_WPA2_PSK, default: 0). 
-     * @note This method should not be called when station mode. 
-     */
-    bool setSoftAPParam(String ssid, String pwd, uint8_t chl = 7, uint8_t ecn = 0);
-    
-    /**
-     * Get the IP list of devices connected to SoftAP. 
-     * 
-     * @return the list of IP.
-     * @note This method should not be called when station mode. 
-     */
-    String getDeviceIP(void);
-    
-    
- private:
-    ArduinoSerial m_uart; /* The UART to communicate with ESP8266 */
- 
-};
-
-#endif /* #ifndef __ESP8266AT_H__ */
\ No newline at end of file