init

Dependencies:   mbed

Fork of 仓库 by Keegan Hu

Revision:
1:3b487c4813a2
Parent:
0:63af4719467f
Child:
2:b10925c474fc
diff -r 63af4719467f -r 3b487c4813a2 esp8266.h
--- a/esp8266.h	Wed Oct 11 08:40:04 2017 +0000
+++ b/esp8266.h	Tue Nov 07 03:15:44 2017 +0000
@@ -1,17 +1,24 @@
 
+#include "mbed.h"
 
 class Esp8266 {                                                                 //声明一个类
     bool network_start;
     bool mqtt_start;
+    char esp_token[1024], esp_param[2048];
+    char esp_tokenBuf[1024], esp_paramBuf[2048];   // recv from esp8266
+    bool esp_buf_ready;
+    Serial ser2esp8266;
+    
+protected:
+    void esp8266_rxCallback();
 public:
-    // 0--client mode 1--host mode
-    Esp8266(int mode = 0);
+    Esp8266(PinName TX, PinName RX, const char *wifi_ssid, const char *wifi_passwd);
     
     // 通用
     bool reset();
     
     // 连接模式
-    bool connect_wifi();
+    bool connect_wifi(const char *wifi_ssid, const char *wifi_passwd);
     bool weblogin();
     bool connect_mqtt_broker(char *ip);