network_wifi.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #pragma once
  2. #include "network_manager.h"
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. esp_netif_t * network_wifi_start();
  7. void destroy_network_wifi();
  8. /**
  9. * @brief saves the current STA wifi config to flash ram storage.
  10. */
  11. esp_err_t network_wifi_save_sta_config();
  12. /**
  13. * @brief fetch a previously STA wifi config in the flash ram storage.
  14. * @return true if a previously saved config was found, false otherwise.
  15. */
  16. bool network_wifi_load_wifi_sta_config();
  17. /**
  18. * @brief Registers handler for wifi and ip events
  19. */
  20. void network_wifi_register_handlers();
  21. /**
  22. * @brief Generates the list of access points after a wifi scan.
  23. * @note This is not thread-safe and should be called only if network_status_lock_json_buffer call is successful.
  24. */
  25. void network_wifi_generate_access_points_json(cJSON ** ap_list);
  26. /**
  27. * @brief Clear the list of access points.
  28. * @note This is not thread-safe and should be called only if network_status_lock_json_buffer call is successful.
  29. */
  30. void network_wifi_clear_access_points_json();
  31. esp_netif_t * network_wifi_config_ap();
  32. void network_wifi_filter_unique( wifi_ap_record_t * aplist, uint16_t * aps);
  33. esp_err_t wifi_scan_done();
  34. esp_err_t network_wifi_start_scan();
  35. esp_err_t network_wifi_load_restore(queue_message *msg);
  36. esp_err_t network_wifi_order_connect(queue_message *msg);
  37. esp_err_t network_wifi_disconnected(queue_message *msg);
  38. esp_err_t network_wifi_start_ap(queue_message *msg);
  39. bool network_wifi_get_config_for_ssid(wifi_config_t* config, const char * ssid);
  40. esp_err_t network_wifi_handle_event(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data);
  41. bool is_wifi_up();
  42. wifi_config_t* network_wifi_set_wifi_sta_config(const char * ssid, const char * password) ;
  43. void network_wifi_clear_config();
  44. esp_netif_t *network_wifi_get_interface();
  45. esp_netif_t *network_wifi_get_ap_interface();
  46. bool network_wifi_is_ap_sta_mode();
  47. bool network_wifi_is_sta_mode();
  48. bool network_wifi_is_ap_mode();
  49. bool network_wifi_sta_config_changed();
  50. void network_wifi_global_init();
  51. bool network_wifi_is_known_ap(const char * ssid);
  52. esp_err_t network_wifi_connect(const char * ssid, const char * password);
  53. esp_err_t network_wifi_erase_legacy();
  54. esp_err_t network_wifi_connect_ssid(const char * ssid);
  55. esp_err_t network_wifi_connect_active_ssid();
  56. esp_err_t network_wifi_erase_known_ap();
  57. esp_err_t network_wifi_set_sta_mode();
  58. size_t network_wifi_get_known_count();
  59. size_t network_wifi_get_known_count_in_range();
  60. esp_err_t network_wifi_built_known_ap_list();
  61. esp_err_t network_wifi_connect_next_in_range();
  62. const wifi_sta_config_t* network_wifi_load_active_config();
  63. #ifdef __cplusplus
  64. }
  65. #endif