esp_wifi_default.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // Copyright 2019 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #ifndef _ESP_WIFI_DEFAULT_H
  14. #define _ESP_WIFI_DEFAULT_H
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /**
  19. * @brief Attaches wifi station interface to supplied netif
  20. *
  21. * @param esp_netif instance to attach the wifi station to
  22. *
  23. * @return
  24. * - ESP_OK on success
  25. * - ESP_FAIL if attach failed
  26. */
  27. esp_err_t esp_netif_attach_wifi_station(esp_netif_t *esp_netif);
  28. /**
  29. * @brief Attaches wifi soft AP interface to supplied netif
  30. *
  31. * @param esp_netif instance to attach the wifi AP to
  32. *
  33. * @return
  34. * - ESP_OK on success
  35. * - ESP_FAIL if attach failed
  36. */
  37. esp_err_t esp_netif_attach_wifi_ap(esp_netif_t *esp_netif);
  38. /**
  39. * @brief Sets default wifi event handlers for STA interface
  40. *
  41. * @return
  42. * - ESP_OK on success, error returned from esp_event_handler_register if failed
  43. */
  44. esp_err_t esp_wifi_set_default_wifi_sta_handlers(void);
  45. /**
  46. * @brief Sets default wifi event handlers for STA interface
  47. *
  48. * @return
  49. * - ESP_OK on success, error returned from esp_event_handler_register if failed
  50. */
  51. esp_err_t esp_wifi_set_default_wifi_ap_handlers(void);
  52. /**
  53. * @brief Clears default wifi event handlers for supplied network interface
  54. *
  55. * @param esp_netif instance of corresponding if object
  56. *
  57. * @return
  58. * - ESP_OK on success, error returned from esp_event_handler_register if failed
  59. */
  60. esp_err_t esp_wifi_clear_default_wifi_driver_and_handlers(void *esp_netif);
  61. /**
  62. * @brief Creates default WIFI AP. In case of any init error this API aborts.
  63. *
  64. * @return pointer to esp-netif instance
  65. */
  66. esp_netif_t* esp_netif_create_default_wifi_ap(void);
  67. /**
  68. * @brief Creates default WIFI STA. In case of any init error this API aborts.
  69. *
  70. * @return pointer to esp-netif instance
  71. */
  72. esp_netif_t* esp_netif_create_default_wifi_sta(void);
  73. /**
  74. * @brief Creates esp_netif WiFi object based on the custom configuration.
  75. *
  76. * @attention This API DOES NOT register default handlers!
  77. *
  78. * @param[in] wifi_if type of wifi interface
  79. * @param[in] esp_netif_config inherent esp-netif configuration pointer
  80. *
  81. * @return pointer to esp-netif instance
  82. */
  83. esp_netif_t* esp_netif_create_wifi(wifi_interface_t wifi_if, esp_netif_inherent_config_t *esp_netif_config);
  84. /**
  85. * @brief Creates default STA and AP network interfaces for esp-mesh.
  86. *
  87. * Both netifs are almost identical to the default station and softAP, but with
  88. * DHCP client and server disabled. Please note that the DHCP client is typically
  89. * enabled only if the device is promoted to a root node.
  90. *
  91. * Returns created interfaces which could be ignored setting parameters to NULL
  92. * if an application code does not need to save the interface instances
  93. * for further processing.
  94. *
  95. * @param[out] p_netif_sta pointer where the resultant STA interface is saved (if non NULL)
  96. * @param[out] p_netif_ap pointer where the resultant AP interface is saved (if non NULL)
  97. *
  98. * @return ESP_OK on success
  99. */
  100. esp_err_t esp_netif_create_default_wifi_mesh_netifs(esp_netif_t **p_netif_sta, esp_netif_t **p_netif_ap);
  101. #ifdef __cplusplus
  102. }
  103. #endif
  104. #endif //_ESP_WIFI_DEFAULT_H