Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.4 KiB

  1. /*
  2. WIFI MODULE
  3. Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
  4. */
  5. #pragma once
  6. #define LWIP_INTERNAL
  7. #include <ESP8266WiFi.h>
  8. #undef LWIP_INTERNAL
  9. extern "C" {
  10. #include <lwip/opt.h>
  11. #include <lwip/ip.h>
  12. #include <lwip/tcp.h>
  13. #include <lwip/inet.h> // ip_addr_t
  14. #include <lwip/err.h> // ERR_x
  15. #include <lwip/dns.h> // dns_gethostbyname
  16. #include <lwip/ip_addr.h> // ip4/ip6 helpers
  17. #include <lwip/init.h> // LWIP_VERSION_MAJOR
  18. };
  19. #if LWIP_VERSION_MAJOR == 1
  20. #include <netif/etharp.h>
  21. #else // LWIP_VERSION_MAJOR >= 2
  22. #include <lwip/etharp.h>
  23. #endif
  24. #include <JustWifi.h>
  25. // ref: https://github.com/me-no-dev/ESPAsyncTCP/pull/115/files#diff-e2e636049095cc1ff920c1bfabf6dcacR8
  26. // This is missing with Core 2.3.0 and is sometimes missing from the build flags. Assume HIGH_BANDWIDTH version.
  27. #ifndef TCP_MSS
  28. #define TCP_MSS (1460)
  29. #endif
  30. struct wifi_scan_info_t;
  31. using wifi_scan_f = std::function<void(wifi_scan_info_t& info)>;
  32. using wifi_callback_f = std::function<void(justwifi_messages_t code, char * parameter)>;
  33. uint8_t wifiState();
  34. void wifiReconnectCheck();
  35. bool wifiConnected();
  36. String getNetwork();
  37. String getIP();
  38. void wifiDebug();
  39. void wifiDebug(WiFiMode_t modes);
  40. void wifiStartAP();
  41. void wifiStartSTA();
  42. void wifiDisconnect();
  43. void wifiStartWPS();
  44. void wifiStartSmartConfig();
  45. void wifiRegister(wifi_callback_f callback);
  46. void wifiSetup();
  47. void wifiLoop();