Hi. I'm using the ESP8266-01 Wi-Fi module in my project and I have successfully compiled the code for FirebaseDemo. Now, I want to know how things have been done so I want to see the code for some functions like WiFi.begin(), WiFi.status() and WiFi.localIP(). In the FirebaseDemo sketch, only two header files are being included which are the <ESP8266WiFi.h> and the <FirebaseArduino.h>. So, I think the code for those functions will be defined in ESP8266WiFi.cpp. I searched in my PC for ESP8266WiFi.cpp and I found the following code:
#include "ESP8266WiFi.h"
extern "C" {
#include "c_types.h"
#include "ets_sys.h"
#include "os_type.h"
#include "osapi.h"
#include "mem.h"
#include "user_interface.h"
#include "smartconfig.h"
#include "lwip/opt.h"
#include "lwip/err.h"
#include "lwip/dns.h"
}
#include "debug.h"
// -----------------------------------------------------------------------------------------------------------------------
// ---------------------------------------------------------- Debug ------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------
/**
* Output WiFi settings to an object derived from Print interface (like Serial).
* @param p Print interface
*/
void ESP8266WiFiClass::printDiag(Print& p) {
const char* modes[] = { "NULL", "STA", "AP", "STA+AP" };
p.print("Mode: ");
p.println(modes[wifi_get_opmode()]);
const char* phymodes[] = { "", "B", "G", "N" };
p.print("PHY mode: ");
p.println(phymodes[(int) wifi_get_phy_mode()]);
p.print("Channel: ");
p.println(wifi_get_channel());
p.print("AP id: ");
p.println(wifi_station_get_current_ap_id());
p.print("Status: ");
p.println(wifi_station_get_connect_status());
p.print("Auto connect: ");
p.println(wifi_station_get_auto_connect());
struct station_config conf;
wifi_station_get_config(&conf);
char ssid[33]; //ssid can be up to 32chars, => plus null term
memcpy(ssid, conf.ssid, sizeof(conf.ssid));
ssid[32] = 0; //nullterm in case of 32 char ssid
p.print("SSID (");
p.print(strlen(ssid));
p.print("): ");
p.println(ssid);
char passphrase[65];
memcpy(passphrase, conf.password, sizeof(conf.password));
passphrase[64] = 0;
p.print("Passphrase (");
p.print(strlen(passphrase));
p.print("): ");
p.println(passphrase);
p.print("BSSID set: ");
p.println(conf.bssid_set);
}
ESP8266WiFiClass WiFi;
The functions stated above are not in this file that I found on my PC. Then, I found another ESP8266WiFi.cpp on GitHub and here's the link: https://github.com/rogerclarkmelbourne/arduino-esp8266/blob/master/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp.
And from here, I saw someone posted the function prototype for the begin function but with different class name from what I found on GitHub.
So, my question is, which cpp file should I refer to if I want to see the code for functions like WiFi.begin(), WiFi.status() and WiFi.localIP()?