@@ -48,6 +48,18 @@ void ESP8266WiFiClass::mode(WiFiMode m)
48
48
ETS_UART_INTR_ENABLE ();
49
49
}
50
50
51
+ int ESP8266WiFiClass::begin ()
52
+ {
53
+ static struct station_config conf;
54
+ wifi_station_get_config (&conf);
55
+
56
+ const char * ssid = reinterpret_cast <const char *>(conf.ssid );
57
+ const char * passphrase = reinterpret_cast <const char *>(conf.password );
58
+
59
+ begin (ssid,passphrase);
60
+
61
+ }
62
+
51
63
int ESP8266WiFiClass::begin (const char * ssid)
52
64
{
53
65
return begin (ssid, 0 );
@@ -365,6 +377,26 @@ int ESP8266WiFiClass::hostByName(const char* aHostname, IPAddress& aResult)
365
377
return (aResult != 0 ) ? 1 : 0 ;
366
378
}
367
379
380
+ void ESP8266WiFiClass::setSmartLink ()
381
+ {
382
+ smartconfig_start (SC_TYPE_ESPTOUCH,smartconfig_call_back);// SC_TYPE_ESPTOUCH use ESPTOUCH for smartconfig, or use SC_TYPE_AIRKISS for AIRKISS
383
+ }
384
+
385
+ sc_status ESP8266WiFiClass::getSmartlinkStatus (){
386
+ return smartconfig_get_status ();// when smartconfig complete, return SC_STATUS_LINK_OVER
387
+ }
388
+
389
+ void smartconfig_call_back (void *data)
390
+ {
391
+ struct station_config *sta_conf = (struct station_config *)data;
392
+
393
+ wifi_station_set_config (sta_conf);
394
+ wifi_station_disconnect ();
395
+ wifi_station_connect ();
396
+
397
+ }
398
+
399
+
368
400
void ESP8266WiFiClass::printDiag (Print& p)
369
401
{
370
402
const char * modes[] = {" NULL" , " STA" , " AP" , " STA+AP" };
0 commit comments