mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
use String instead of char pointer for SSID() and psk()
This commit is contained in:
parent
1bc87e7bff
commit
0034697b6e
@ -370,18 +370,18 @@ IPAddress ESP8266WiFiClass::gatewayIP()
|
|||||||
return IPAddress(ip.gw.addr);
|
return IPAddress(ip.gw.addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* ESP8266WiFiClass::SSID()
|
String ESP8266WiFiClass::SSID() const
|
||||||
{
|
{
|
||||||
static struct station_config conf;
|
static struct station_config conf;
|
||||||
wifi_station_get_config(&conf);
|
wifi_station_get_config(&conf);
|
||||||
return reinterpret_cast<char*>(conf.ssid);
|
return String(reinterpret_cast<char*>(conf.ssid));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ESP8266WiFiClass::psk()
|
String ESP8266WiFiClass::psk() const
|
||||||
{
|
{
|
||||||
static struct station_config conf;
|
static struct station_config conf;
|
||||||
wifi_station_get_config(&conf);
|
wifi_station_get_config(&conf);
|
||||||
return reinterpret_cast<const char*>(conf.password);
|
return String(reinterpret_cast<char*>(conf.password));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* ESP8266WiFiClass::BSSID(void)
|
uint8_t* ESP8266WiFiClass::BSSID(void)
|
||||||
|
@ -173,21 +173,21 @@ public:
|
|||||||
*
|
*
|
||||||
* return: ssid string
|
* return: ssid string
|
||||||
*/
|
*/
|
||||||
char* SSID();
|
String SSID() const;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the current pre shared key associated with the network
|
* Return the current pre shared key associated with the network
|
||||||
*
|
*
|
||||||
* return: psk string
|
* return: psk string
|
||||||
*/
|
*/
|
||||||
const char* psk();
|
String psk() const;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the current bssid / mac associated with the network if configured
|
* Return the current bssid / mac associated with the network if configured
|
||||||
*
|
*
|
||||||
* return: bssid uint8_t *
|
* return: bssid uint8_t *
|
||||||
*/
|
*/
|
||||||
uint8_t * BSSID(void);
|
uint8_t *BSSID(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the current bssid / mac associated with the network if configured
|
* Return the current bssid / mac associated with the network if configured
|
||||||
|
@ -240,12 +240,8 @@ void setup()
|
|||||||
delay(10);
|
delay(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ... Load sdk config.
|
// ... Compare file config with sdk config.
|
||||||
String ssid(WiFi.SSID());
|
if (WiFi.SSID() != station_ssid || WiFi.psk() != station_psk)
|
||||||
String psk(WiFi.psk());
|
|
||||||
|
|
||||||
// ... Compare fiel config with sdk config.
|
|
||||||
if (ssid != station_ssid || psk != station_psk)
|
|
||||||
{
|
{
|
||||||
Serial.println("WiFi config changed.");
|
Serial.println("WiFi config changed.");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user