read_network_config.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #pragma once
  2. #ifndef READ_NETWORK_CONFIG_H
  3. #define READ_NETWORK_CONFIG_H
  4. #include <string>
  5. #include <esp_err.h>
  6. #include "defines.h"
  7. struct network_config_t
  8. {
  9. std::string connection_type = "";
  10. std::string ssid = "";
  11. std::string eapid = "";
  12. std::string username = "";
  13. std::string password = "";
  14. std::string hostname = "watermeter";
  15. std::string ipaddress = "";
  16. std::string gateway = "";
  17. std::string netmask = "";
  18. std::string dns = "";
  19. int rssi_threshold = 0; // Default: 0 -> ROAMING disabled
  20. bool fix_ipaddress_used = false;
  21. bool http_auth = false;
  22. std::string http_username = "";
  23. std::string http_password = "";
  24. };
  25. extern struct network_config_t network_config;
  26. extern struct network_config_t network_config_temp;
  27. #define NETWORK_CONNECTION_WIFI_AP_SETUP "Wifi_AP_Setup"
  28. #define NETWORK_CONNECTION_WIFI_AP "Wifi_AP"
  29. #define NETWORK_CONNECTION_WIFI_STA "Wifi_STA"
  30. #if (CONFIG_ETH_ENABLED && CONFIG_ETH_USE_SPI_ETHERNET && CONFIG_ETH_SPI_ETHERNET_W5500)
  31. #define NETWORK_CONNECTION_ETH "Ethernet"
  32. #endif // (CONFIG_ETH_ENABLED && CONFIG_ETH_USE_SPI_ETHERNET && CONFIG_ETH_SPI_ETHERNET_W5500)
  33. #define NETWORK_CONNECTION_DISCONNECT "Disconnect"
  34. int LoadNetworkFromFile(std::string filename);
  35. bool ChangeHostName(std::string filename, std::string _newhostname);
  36. bool ChangeRSSIThreshold(std::string filename, int _newrssithreshold);
  37. esp_err_t GetAuthWebUIConfig(std::string filename);
  38. #endif // READ_NETWORK_CONFIG_H