]> granicus.if.org Git - esp-idf/commitdiff
Make error codes globally unique
authorRoland Dobai <dobai.roland@gmail.com>
Fri, 9 Feb 2018 13:43:11 +0000 (14:43 +0100)
committerRoland Dobai <dobai.roland@gmail.com>
Tue, 27 Mar 2018 06:12:54 +0000 (08:12 +0200)
components/esp32/esp_err_to_name.c
components/esp32/include/esp_now.h
components/esp32/include/esp_wifi.h
components/esp32/include/esp_wifi_internal.h
components/esp32/include/esp_wpa2.h
components/esp32/include/esp_wps.h
components/lwip/apps/ping/esp_ping.h
components/tcpip_adapter/include/tcpip_adapter.h
docs/en/api-guides/wifi.rst

index 594c30203c30bdfa2f104ec411318c75719ddd30..b0907d1958877e8fa597327a8996c95be1438fad 100644 (file)
@@ -51,35 +51,15 @@ static const esp_err_msg_t esp_err_msg_table[] = {
 #   ifdef      ESP_FAIL
     ERR_TBL_IT(ESP_FAIL),                                   /*    -1 */
 #   endif
-    // components/esp32/include/esp_wifi.h
-#   ifdef      ESP_ERR_WIFI_FAIL
-    ERR_TBL_IT(ESP_ERR_WIFI_FAIL),                          /*    -1 General fail code */
-#   endif
-    // components/esp32/include/esp_err.h
 #   ifdef      ESP_OK
     ERR_TBL_IT(ESP_OK),                                     /*     0 */
 #   endif
-    // components/esp32/include/esp_wifi.h
-#   ifdef      ESP_ERR_WIFI_OK
-    ERR_TBL_IT(ESP_ERR_WIFI_OK),                            /*     0 No error */
-#   endif
-    // components/esp32/include/esp_err.h
 #   ifdef      ESP_ERR_NO_MEM
     ERR_TBL_IT(ESP_ERR_NO_MEM),                             /*   257 0x101 */
 #   endif
-    // components/esp32/include/esp_wifi.h
-#   ifdef      ESP_ERR_WIFI_NO_MEM
-    ERR_TBL_IT(ESP_ERR_WIFI_NO_MEM),                        /*   257 0x101 Out of memory */
-#   endif
-    // components/esp32/include/esp_err.h
 #   ifdef      ESP_ERR_INVALID_ARG
     ERR_TBL_IT(ESP_ERR_INVALID_ARG),                        /*   258 0x102 */
 #   endif
-    // components/esp32/include/esp_wifi.h
-#   ifdef      ESP_ERR_WIFI_ARG
-    ERR_TBL_IT(ESP_ERR_WIFI_ARG),                           /*   258 0x102 Invalid argument */
-#   endif
-    // components/esp32/include/esp_err.h
 #   ifdef      ESP_ERR_INVALID_STATE
     ERR_TBL_IT(ESP_ERR_INVALID_STATE),                      /*   259 0x103 */
 #   endif
@@ -92,11 +72,6 @@ static const esp_err_msg_t esp_err_msg_table[] = {
 #   ifdef      ESP_ERR_NOT_SUPPORTED
     ERR_TBL_IT(ESP_ERR_NOT_SUPPORTED),                      /*   262 0x106 */
 #   endif
-    // components/esp32/include/esp_wifi.h
-#   ifdef      ESP_ERR_WIFI_NOT_SUPPORT
-    ERR_TBL_IT(ESP_ERR_WIFI_NOT_SUPPORT),                   /*   262 0x106 Indicates that API is not supported yet */
-#   endif
-    // components/esp32/include/esp_err.h
 #   ifdef      ESP_ERR_TIMEOUT
     ERR_TBL_IT(ESP_ERR_TIMEOUT),                            /*   263 0x107 */
 #   endif
@@ -287,12 +262,12 @@ static const esp_err_msg_t esp_err_msg_table[] = {
     ERR_TBL_IT(ESP_ERR_WIFI_WPS_SM),                        /* 12341 0x3035 WPS state machine is not initialized */
 #   endif
     // components/esp32/include/esp_now.h
+#   ifdef      ESP_ERR_ESPNOW_BASE
+    ERR_TBL_IT(ESP_ERR_ESPNOW_BASE),                        /* 12388 0x3064 ESPNOW error number base. */
+#   endif
 #   ifdef      ESP_ERR_ESPNOW_NOT_INIT
     ERR_TBL_IT(ESP_ERR_ESPNOW_NOT_INIT),                    /* 12389 0x3065 ESPNOW is not initialized. */
 #   endif
-#   ifdef      ESP_ERR_ESPNOW_BASE
-    ERR_TBL_IT(ESP_ERR_ESPNOW_BASE),                        /* 12389 0x3065 ESPNOW error number base. */
-#   endif
 #   ifdef      ESP_ERR_ESPNOW_ARG
     ERR_TBL_IT(ESP_ERR_ESPNOW_ARG),                         /* 12390 0x3066 Invalid argument */
 #   endif
@@ -315,39 +290,39 @@ static const esp_err_msg_t esp_err_msg_table[] = {
     ERR_TBL_IT(ESP_ERR_ESPNOW_IF),                          /* 12396 0x306c Interface error */
 #   endif
     // components/tcpip_adapter/include/tcpip_adapter.h
-#   ifdef      ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS
-    ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS),       /* 20480 0x5000 */
-#   endif
 #   ifdef      ESP_ERR_TCPIP_ADAPTER_BASE
     ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_BASE),                 /* 20480 0x5000 */
 #   endif
+#   ifdef      ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS
+    ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS),       /* 20481 0x5001 */
+#   endif
 #   ifdef      ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY
-    ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY),         /* 20481 0x5001 */
+    ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY),         /* 20482 0x5002 */
 #   endif
 #   ifdef      ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED
-    ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED),   /* 20482 0x5002 */
+    ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED),   /* 20483 0x5003 */
 #   endif
 #   ifdef      ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED
-    ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED), /* 20483 0x5003 */
+    ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED), /* 20484 0x5004 */
 #   endif
 #   ifdef      ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPPED
-    ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPPED), /* 20484 0x5004 */
+    ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPPED), /* 20485 0x5005 */
 #   endif
 #   ifdef      ESP_ERR_TCPIP_ADAPTER_NO_MEM
-    ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_NO_MEM),               /* 20485 0x5005 */
+    ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_NO_MEM),               /* 20486 0x5006 */
 #   endif
 #   ifdef      ESP_ERR_TCPIP_ADAPTER_DHCP_NOT_STOPPED
-    ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_DHCP_NOT_STOPPED),     /* 20486 0x5006 */
+    ERR_TBL_IT(ESP_ERR_TCPIP_ADAPTER_DHCP_NOT_STOPPED),     /* 20487 0x5007 */
 #   endif
     // components/lwip/apps/ping/esp_ping.h
-#   ifdef      ESP_ERR_PING_INVALID_PARAMS
-    ERR_TBL_IT(ESP_ERR_PING_INVALID_PARAMS),                /* 24576 0x6000 */
-#   endif
 #   ifdef      ESP_ERR_PING_BASE
     ERR_TBL_IT(ESP_ERR_PING_BASE),                          /* 24576 0x6000 */
 #   endif
+#   ifdef      ESP_ERR_PING_INVALID_PARAMS
+    ERR_TBL_IT(ESP_ERR_PING_INVALID_PARAMS),                /* 24577 0x6001 */
+#   endif
 #   ifdef      ESP_ERR_PING_NO_MEM
-    ERR_TBL_IT(ESP_ERR_PING_NO_MEM),                        /* 24577 0x6001 */
+    ERR_TBL_IT(ESP_ERR_PING_NO_MEM),                        /* 24578 0x6002 */
 #   endif
     // components/spi_flash/include/esp_spi_flash.h
 #   ifdef      ESP_ERR_FLASH_BASE
index 4a0a4be7d61081da530cab9fd861f93ca8f60190..981c9001e490dc708af12c3702aca7f1d8b70e8a 100644 (file)
@@ -40,15 +40,15 @@ extern "C" {
   * @{
   */
 
-#define ESP_ERR_ESPNOW_BASE         (ESP_ERR_WIFI_BASE + 101) /*!< ESPNOW error number base. */
-#define ESP_ERR_ESPNOW_NOT_INIT     (ESP_ERR_ESPNOW_BASE)     /*!< ESPNOW is not initialized. */
-#define ESP_ERR_ESPNOW_ARG          (ESP_ERR_ESPNOW_BASE + 1) /*!< Invalid argument */
-#define ESP_ERR_ESPNOW_NO_MEM       (ESP_ERR_ESPNOW_BASE + 2) /*!< Out of memory */
-#define ESP_ERR_ESPNOW_FULL         (ESP_ERR_ESPNOW_BASE + 3) /*!< ESPNOW peer list is full */
-#define ESP_ERR_ESPNOW_NOT_FOUND    (ESP_ERR_ESPNOW_BASE + 4) /*!< ESPNOW peer is not found */
-#define ESP_ERR_ESPNOW_INTERNAL     (ESP_ERR_ESPNOW_BASE + 5) /*!< Internal error */
-#define ESP_ERR_ESPNOW_EXIST        (ESP_ERR_ESPNOW_BASE + 6) /*!< ESPNOW peer has existed */
-#define ESP_ERR_ESPNOW_IF           (ESP_ERR_ESPNOW_BASE + 7) /*!< Interface error */
+#define ESP_ERR_ESPNOW_BASE         (ESP_ERR_WIFI_BASE + 100) /*!< ESPNOW error number base. */
+#define ESP_ERR_ESPNOW_NOT_INIT     (ESP_ERR_ESPNOW_BASE + 1) /*!< ESPNOW is not initialized. */
+#define ESP_ERR_ESPNOW_ARG          (ESP_ERR_ESPNOW_BASE + 2) /*!< Invalid argument */
+#define ESP_ERR_ESPNOW_NO_MEM       (ESP_ERR_ESPNOW_BASE + 3) /*!< Out of memory */
+#define ESP_ERR_ESPNOW_FULL         (ESP_ERR_ESPNOW_BASE + 4) /*!< ESPNOW peer list is full */
+#define ESP_ERR_ESPNOW_NOT_FOUND    (ESP_ERR_ESPNOW_BASE + 5) /*!< ESPNOW peer is not found */
+#define ESP_ERR_ESPNOW_INTERNAL     (ESP_ERR_ESPNOW_BASE + 6) /*!< Internal error */
+#define ESP_ERR_ESPNOW_EXIST        (ESP_ERR_ESPNOW_BASE + 7) /*!< ESPNOW peer has existed */
+#define ESP_ERR_ESPNOW_IF           (ESP_ERR_ESPNOW_BASE + 8) /*!< Interface error */
 
 #define ESP_NOW_ETH_ALEN             6         /*!< Length of ESPNOW peer MAC address */
 #define ESP_NOW_KEY_LEN              16        /*!< Length of ESPNOW peer local master key */
index 47a056347cae734581e5fc8574642cf16fa77e8e..beb36e270901f929ee08c468061d14a3d8bf3ee5 100755 (executable)
 extern "C" {
 #endif
 
-#define ESP_ERR_WIFI_OK          ESP_OK                    /*!< No error */
-#define ESP_ERR_WIFI_FAIL        ESP_FAIL                  /*!< General fail code */
-#define ESP_ERR_WIFI_NO_MEM      ESP_ERR_NO_MEM            /*!< Out of memory */
-#define ESP_ERR_WIFI_ARG         ESP_ERR_INVALID_ARG       /*!< Invalid argument */
-#define ESP_ERR_WIFI_NOT_SUPPORT ESP_ERR_NOT_SUPPORTED     /*!< Indicates that API is not supported yet */
-
 #define ESP_ERR_WIFI_NOT_INIT    (ESP_ERR_WIFI_BASE + 1)   /*!< WiFi driver was not installed by esp_wifi_init */
 #define ESP_ERR_WIFI_NOT_STARTED (ESP_ERR_WIFI_BASE + 2)   /*!< WiFi driver was not started by esp_wifi_start */
 #define ESP_ERR_WIFI_NOT_STOPPED (ESP_ERR_WIFI_BASE + 3)   /*!< WiFi driver was not stopped by esp_wifi_stop */
@@ -199,7 +193,7 @@ extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
   *
   * @return
   *    - ESP_OK: succeed
-  *    - ESP_ERR_WIFI_NO_MEM: out of memory
+  *    - ESP_ERR_NO_MEM: out of memory
   *    - others: refer to error code esp_err.h
   */
 esp_err_t esp_wifi_init(const wifi_init_config_t *config);
@@ -225,7 +219,7 @@ esp_err_t esp_wifi_deinit(void);
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   *    - others: refer to error code in esp_err.h
   */
 esp_err_t esp_wifi_set_mode(wifi_mode_t mode);
@@ -238,7 +232,7 @@ esp_err_t esp_wifi_set_mode(wifi_mode_t mode);
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   */
 esp_err_t esp_wifi_get_mode(wifi_mode_t *mode);
 
@@ -251,10 +245,10 @@ esp_err_t esp_wifi_get_mode(wifi_mode_t *mode);
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *    - ESP_ERR_WIFI_ARG: invalid argument
-  *    - ESP_ERR_WIFI_NO_MEM: out of memory
+  *    - ESP_ERR_INVALID_ARG: invalid argument
+  *    - ESP_ERR_NO_MEM: out of memory
   *    - ESP_ERR_WIFI_CONN: WiFi internal error, station or soft-AP control block wrong
-  *    - ESP_ERR_WIFI_FAIL: other WiFi internal errors
+  *    - ESP_FAIL: other WiFi internal errors
   */
 esp_err_t esp_wifi_start(void);
 
@@ -307,7 +301,7 @@ esp_err_t esp_wifi_connect(void);
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi was not initialized by esp_wifi_init
   *    - ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start
-  *    - ESP_ERR_WIFI_FAIL: other WiFi internal errors
+  *    - ESP_FAIL: other WiFi internal errors
   */
 esp_err_t esp_wifi_disconnect(void);
 
@@ -330,7 +324,7 @@ esp_err_t esp_wifi_clear_fast_connect(void);
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
   *    - ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   *    - ESP_ERR_WIFI_MODE: WiFi mode is wrong
   */
 esp_err_t esp_wifi_deauth_sta(uint16_t aid);
@@ -378,7 +372,7 @@ esp_err_t esp_wifi_scan_stop(void);
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
   *    - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   */
 esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number);
 
@@ -393,8 +387,8 @@ esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number);
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
   *    - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
-  *    - ESP_ERR_WIFI_ARG: invalid argument
-  *    - ESP_ERR_WIFI_NO_MEM: out of memory
+  *    - ESP_ERR_INVALID_ARG: invalid argument
+  *    - ESP_ERR_NO_MEM: out of memory
   */
 esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records);
 
@@ -418,7 +412,7 @@ esp_err_t esp_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info);
   *
   * @param     type  power save type
   *
-  * @return    ESP_ERR_WIFI_NOT_SUPPORT: not supported yet
+  * @return    ESP_ERR_NOT_SUPPORTED: not supported yet
   */
 esp_err_t esp_wifi_set_ps(wifi_ps_type_t type);
 
@@ -429,7 +423,7 @@ esp_err_t esp_wifi_set_ps(wifi_ps_type_t type);
   *
   * @param[out]  type: store current power save type
   *
-  * @return    ESP_ERR_WIFI_NOT_SUPPORT: not supported yet
+  * @return    ESP_ERR_NOT_SUPPORTED: not supported yet
   */
 esp_err_t esp_wifi_get_ps(wifi_ps_type_t *type);
 
@@ -460,7 +454,7 @@ esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap);
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
   *    - ESP_ERR_WIFI_IF: invalid interface
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   *    - others: refer to error codes in esp_err.h
   */
 esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap);
@@ -478,7 +472,7 @@ esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap);
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
   *    - ESP_ERR_WIFI_IF: invalid interface
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   *    - others: refer to error codes in esp_err.h
   */
 esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw);
@@ -495,7 +489,7 @@ esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw);
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
   *    - ESP_ERR_WIFI_IF: invalid interface
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   */
 esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw);
 
@@ -512,7 +506,7 @@ esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw);
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
   *    - ESP_ERR_WIFI_IF: invalid interface
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   */
 esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second);
 
@@ -527,7 +521,7 @@ esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second);
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   */
 esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
 
@@ -553,7 +547,7 @@ esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   */
 esp_err_t esp_wifi_set_country(const wifi_country_t *country);
 
@@ -565,7 +559,7 @@ esp_err_t esp_wifi_set_country(const wifi_country_t *country);
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   */
 esp_err_t esp_wifi_get_country(wifi_country_t *country);
 
@@ -584,7 +578,7 @@ esp_err_t esp_wifi_get_country(wifi_country_t *country);
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   *    - ESP_ERR_WIFI_IF: invalid interface
   *    - ESP_ERR_WIFI_MAC: invalid mac address
   *    - ESP_ERR_WIFI_MODE: WiFi mode is wrong
@@ -601,7 +595,7 @@ esp_err_t esp_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6]);
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   *    - ESP_ERR_WIFI_IF: invalid interface
   */
 esp_err_t esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]);
@@ -648,7 +642,7 @@ esp_err_t esp_wifi_set_promiscuous(bool en);
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   */
 esp_err_t esp_wifi_get_promiscuous(bool *en);
 
@@ -673,7 +667,7 @@ esp_err_t esp_wifi_set_promiscuous_filter(const wifi_promiscuous_filter_t *filte
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   */
 esp_err_t esp_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter);
 
@@ -691,7 +685,7 @@ esp_err_t esp_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter);
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   *    - ESP_ERR_WIFI_IF: invalid interface
   *    - ESP_ERR_WIFI_MODE: invalid mode
   *    - ESP_ERR_WIFI_PASSWORD: invalid password
@@ -709,7 +703,7 @@ esp_err_t esp_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf);
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   *    - ESP_ERR_WIFI_IF: invalid interface
   */
 esp_err_t esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf);
@@ -724,7 +718,7 @@ esp_err_t esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf);
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   *    - ESP_ERR_WIFI_MODE: WiFi mode is wrong
   *    - ESP_ERR_WIFI_CONN: WiFi internal error, the station/soft-AP control block is invalid
   */
@@ -741,7 +735,7 @@ esp_err_t esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta);
   * @return
   *   - ESP_OK: succeed
   *   - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *   - ESP_ERR_WIFI_ARG: invalid argument
+  *   - ESP_ERR_INVALID_ARG: invalid argument
   */
 esp_err_t esp_wifi_set_storage(wifi_storage_t storage);
 
@@ -767,7 +761,7 @@ esp_err_t esp_wifi_set_auto_connect(bool en);
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   */
 esp_err_t esp_wifi_get_auto_connect(bool *en);
 
@@ -783,9 +777,9 @@ esp_err_t esp_wifi_get_auto_connect(bool *en);
   * @return
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init()
-  *    - ESP_ERR_WIFI_ARG: Invalid argument, including if first byte of vnd_ie is not WIFI_VENDOR_IE_ELEMENT_ID (0xDD)
+  *    - ESP_ERR_INVALID_ARG: Invalid argument, including if first byte of vnd_ie is not WIFI_VENDOR_IE_ELEMENT_ID (0xDD)
   *      or second byte is an invalid length.
-  *    - ESP_ERR_WIFI_NO_MEM: Out of memory
+  *    - ESP_ERR_NO_MEM: Out of memory
   */
 esp_err_t esp_wifi_set_vendor_ie(bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie);
 
@@ -871,7 +865,7 @@ esp_err_t esp_wifi_set_max_tx_power(int8_t power);
   *    - ESP_OK: succeed
   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
   *    - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
-  *    - ESP_ERR_WIFI_ARG: invalid argument
+  *    - ESP_ERR_INVALID_ARG: invalid argument
   */
 esp_err_t esp_wifi_get_max_tx_power(int8_t *power);
 
index ed636ba67bea4adb485b28914fbc34a8da13f99f..2fc138b737e3a341b889e6e36339096f8945e2c2 100644 (file)
@@ -55,7 +55,7 @@ extern "C" {
  *
  * @return
  *    - ESP_OK: succeed
- *    - ESP_ERR_WIFI_NO_MEM: out of memory
+ *    - ESP_ERR_NO_MEM: out of memory
  *    - others: refer to error code esp_err.h
  */
 esp_err_t esp_wifi_init_internal(const wifi_init_config_t *config);
index c704e81c78683f633c19f1de1f8e4921e252d712..fa73dbe28702c0df97e26d92dac27b35e0a73d81 100644 (file)
@@ -39,8 +39,8 @@ typedef struct {
   * @attention 2. wpa2 enterprise authentication can only support TLS, PEAP-MSCHAPv2 and TTLS-MSCHAPv2 method.
   *
   * @return
-  *    - ESP_ERR_WIFI_OK: succeed.
-  *    - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
+  *    - ESP_OK: succeed.
+  *    - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
   */
 esp_err_t esp_wifi_sta_wpa2_ent_enable(const esp_wpa2_config_t *config);
 
@@ -51,7 +51,7 @@ esp_err_t esp_wifi_sta_wpa2_ent_enable(const esp_wpa2_config_t *config);
   * @attention 2. wpa2 enterprise authentication can only support TLS, PEAP-MSCHAPv2 and TTLS-MSCHAPv2 method.
   *
   * @return
-  *    - ESP_ERR_WIFI_OK: succeed.
+  *    - ESP_OK: succeed.
   */
 esp_err_t esp_wifi_sta_wpa2_ent_disable(void);
 
@@ -64,9 +64,9 @@ esp_err_t esp_wifi_sta_wpa2_ent_disable(void);
   * @param  len: length of identity, limited to 1~127
   *
   * @return
-  *    - ESP_ERR_WIFI_OK: succeed
-  *    - ESP_ERR_WIFI_ARG: fail(len <= 0 or len >= 128)
-  *    - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
+  *    - ESP_OK: succeed
+  *    - ESP_ERR_INVALID_ARG: fail(len <= 0 or len >= 128)
+  *    - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
   */
 esp_err_t esp_wifi_sta_wpa2_ent_set_identity(const unsigned char *identity, int len);
 
@@ -84,9 +84,9 @@ void esp_wifi_sta_wpa2_ent_clear_identity(void);
   * @param  len: length of username, limited to 1~127
   *
   * @return
-  *    - ESP_ERR_WIFI_OK: succeed
-  *    - ESP_ERR_WIFI_ARG: fail(len <= 0 or len >= 128)
-  *    - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
+  *    - ESP_OK: succeed
+  *    - ESP_ERR_INVALID_ARG: fail(len <= 0 or len >= 128)
+  *    - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
   */
 esp_err_t esp_wifi_sta_wpa2_ent_set_username(const unsigned char *username, int len);
 
@@ -104,9 +104,9 @@ void esp_wifi_sta_wpa2_ent_clear_username(void);
   * @param  len: length of password(len > 0)
   *
   * @return
-  *    - ESP_ERR_WIFI_OK: succeed
-  *    - ESP_ERR_WIFI_ARG: fail(len <= 0)
-  *    - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
+  *    - ESP_OK: succeed
+  *    - ESP_ERR_INVALID_ARG: fail(len <= 0)
+  *    - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
   */
 esp_err_t esp_wifi_sta_wpa2_ent_set_password(const unsigned char *password, int len);
 
@@ -125,9 +125,9 @@ void esp_wifi_sta_wpa2_ent_clear_password(void);
   * @param  len: length of password
   *
   * @return
-  *    - ESP_ERR_WIFI_OK: succeed
-  *    - ESP_ERR_WIFI_ARG: fail(len <= 0)
-  *    - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
+  *    - ESP_OK: succeed
+  *    - ESP_ERR_INVALID_ARG: fail(len <= 0)
+  *    - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
   */
 
 esp_err_t esp_wifi_sta_wpa2_ent_set_new_password(const unsigned char *password, int len);
@@ -147,7 +147,7 @@ void esp_wifi_sta_wpa2_ent_clear_new_password(void);
   * @param  len: length of ca_cert
   *
   * @return
-  *    - ESP_ERR_WIFI_OK: succeed
+  *    - ESP_OK: succeed
   */
 esp_err_t esp_wifi_sta_wpa2_ent_set_ca_cert(const unsigned char *ca_cert, int len);
 
@@ -170,7 +170,7 @@ void esp_wifi_sta_wpa2_ent_clear_ca_cert(void);
   * @param  private_key_password_len: length of private key password;
   *
   * @return
-  *    - ESP_ERR_WIFI_OK: succeed
+  *    - ESP_OK: succeed
   */
 esp_err_t esp_wifi_sta_wpa2_ent_set_cert_key(const unsigned char *client_cert, int client_cert_len, const unsigned char *private_key, int private_key_len, const unsigned char *private_key_passwd, int private_key_passwd_len);
 
index bfbb215370d48768f452e49afd737ddb51ecf221..efe37bd028de1a70e091ec25779044d3cd3a2da3 100644 (file)
@@ -77,7 +77,7 @@ typedef struct {
   *          - ESP_OK : succeed
   *          - ESP_ERR_WIFI_WPS_TYPE : wps type is invalid
   *          - ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
-  *          - ESP_ERR_WIFI_FAIL : wps initialization fails
+  *          - ESP_FAIL : wps initialization fails
   */
 esp_err_t esp_wifi_wps_enable(const esp_wps_config_t *config);
 
@@ -106,7 +106,7 @@ esp_err_t esp_wifi_wps_disable(void);
   *          - ESP_ERR_WIFI_WPS_TYPE : wps type is invalid
   *          - ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
   *          - ESP_ERR_WIFI_WPS_SM : wps state machine is not initialized
-  *          - ESP_ERR_WIFI_FAIL : wps initialization fails
+  *          - ESP_FAIL : wps initialization fails
   */
 esp_err_t esp_wifi_wps_start(int timeout_ms);
 
index 993fee214125623ae38ff94511892895004ff908..d83c5b367b7260a73e31f1b7009c1e76e4c1d268 100644 (file)
@@ -23,8 +23,8 @@ extern "C" {
 
 #define ESP_ERR_PING_BASE               0x6000
 
-#define ESP_ERR_PING_INVALID_PARAMS     ESP_ERR_PING_BASE + 0x00
-#define ESP_ERR_PING_NO_MEM             ESP_ERR_PING_BASE + 0x01
+#define ESP_ERR_PING_INVALID_PARAMS     ESP_ERR_PING_BASE + 0x01
+#define ESP_ERR_PING_NO_MEM             ESP_ERR_PING_BASE + 0x02
 
 #define ESP_PING_CHECK_OPTLEN(optlen, opttype) do { if ((optlen) < sizeof(opttype)) { return ESP_ERR_PING_INVALID_PARAMS; }}while(0)
 
index 4777f160571991b0e2b1e9757c9be8539100ecd4..7ab31d1c12bf9a7d49357db23706869781127f10 100644 (file)
@@ -97,13 +97,13 @@ typedef struct {
 
 #define ESP_ERR_TCPIP_ADAPTER_BASE      0x5000      // TODO: move base address to esp_err.h
 
-#define ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS        ESP_ERR_TCPIP_ADAPTER_BASE + 0x00
-#define ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY          ESP_ERR_TCPIP_ADAPTER_BASE + 0x01
-#define ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED    ESP_ERR_TCPIP_ADAPTER_BASE + 0x02
-#define ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED  ESP_ERR_TCPIP_ADAPTER_BASE + 0x03
-#define ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPPED  ESP_ERR_TCPIP_ADAPTER_BASE + 0x04
-#define ESP_ERR_TCPIP_ADAPTER_NO_MEM                ESP_ERR_TCPIP_ADAPTER_BASE + 0x05
-#define ESP_ERR_TCPIP_ADAPTER_DHCP_NOT_STOPPED      ESP_ERR_TCPIP_ADAPTER_BASE + 0x06
+#define ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS        ESP_ERR_TCPIP_ADAPTER_BASE + 0x01
+#define ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY          ESP_ERR_TCPIP_ADAPTER_BASE + 0x02
+#define ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED    ESP_ERR_TCPIP_ADAPTER_BASE + 0x03
+#define ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED  ESP_ERR_TCPIP_ADAPTER_BASE + 0x04
+#define ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPPED  ESP_ERR_TCPIP_ADAPTER_BASE + 0x05
+#define ESP_ERR_TCPIP_ADAPTER_NO_MEM                ESP_ERR_TCPIP_ADAPTER_BASE + 0x06
+#define ESP_ERR_TCPIP_ADAPTER_DHCP_NOT_STOPPED      ESP_ERR_TCPIP_ADAPTER_BASE + 0x07
 
 /* TODO: add Ethernet interface */
 typedef enum {
index daafca4d2863056d50e3f7bb9f631eda24ee005c..226d993bcc4f8ee39b3766de0eb42fb27178a959 100644 (file)
@@ -53,8 +53,8 @@ Just like the handling of "rainy-day" scenarios, a good error-recovery routine i
 ESP32 Wi-Fi API Error Code
 ---------------------------
 All of the ESP32 Wi-Fi APIs have well-defined return values, namely, the error code. The error code can be categorized into:
- - No errors, e.g. ESP_ERR_WIFI_OK means that the API returns successfully
- - Recoverable errors, such as ESP_ERR_WIFI_NO_MEM, etc.
+ - No errors, e.g. ESP_OK means that the API returns successfully
+ - Recoverable errors, such as ESP_ERR_NO_MEM, etc.
  - Non-recoverable, non-critical errors 
  - Non-recoverable, critical errors 
 
@@ -62,7 +62,7 @@ Whether the error is critical or not depends on the API and the application scen
 
 **The primary principle to write a robust application with Wi-Fi API is to always check the error code and write the error-handling code.** Generally, the error-handling code can be used:
 
- - for recoverable errors, in which case you can write a recoverable-error code. For example, when esp_wifi_start returns ESP_ERR_WIFI_NO_MEM, the recoverable-error code vTaskDelay can be called, in order to get a microseconds' delay for another try.
+ - for recoverable errors, in which case you can write a recoverable-error code. For example, when esp_wifi_start returns ESP_ERR_NO_MEM, the recoverable-error code vTaskDelay can be called, in order to get a microseconds' delay for another try.
  - for non-recoverable, yet non-critical, errors, in which case printing the error code is a good method for error handling.
  - for non-recoverable, critical errors, in which case "assert" may be a good method for error handling. For example, if esp_wifi_set_mode returns ESP_ERR_WIFI_NOT_INIT, it means that the Wi-Fi driver is not initialized by esp_wifi_init successfully. You can detect this kind of error very quickly in the application development phase.
 
@@ -1318,14 +1318,14 @@ Parameters of esp_wifi_80211_tx
 |                             |                                                   |
 |                             | If the buffer is wrong, or violates the Wi-Fi     |
 |                             | driver's restrictions, the API returns            |
-|                             | ESP_ERR_WIFI_ARG or results in unexpected         |
+|                             | ESP_ERR_INVALID_ARG or results in unexpected      |
 |                             | behavior. **Please read the following section     |
 |                             | carefully to make sure you understand the         |
 |                             | restrictions on encapsulating the buffer.**       |
 |                             |                                                   |
 +-----------------------------+---------------------------------------------------+
 | len                         | The length must be <= 1500; otherwise, the API    |
-|                             | will return ESP_ERR_WIFI_ARG.                     |
+|                             | will return ESP_ERR_INVALID_ARG.                  |
 |                             |                                                   |
 +-----------------------------+---------------------------------------------------+
 | en_sys_seq                  | If en_sys_seq is true, it means that the Wi-Fi    |
@@ -1345,7 +1345,7 @@ Preconditions of Using esp_wifi_80211_tx
 ++++++++++++++++++++++++++++++++++++++++++++
 
  - The Wi-Fi mode is Station, or SoftAP, or Station+SoftAP.
- - Either esp_wifi_set_promiscuous(true), or esp_wifi_start(), or both of these APIs return ESP_ERR_WIFI_OK. This is because we need to make sure that Wi-Fi hardware is initialized before esp_wifi_80211_tx() is called. In ESP32, both esp_wifi_set_promiscuous(true) and esp_wifi_start() can trigger the initialization of Wi-Fi hardware.
+ - Either esp_wifi_set_promiscuous(true), or esp_wifi_start(), or both of these APIs return ESP_OK. This is because we need to make sure that Wi-Fi hardware is initialized before esp_wifi_80211_tx() is called. In ESP32, both esp_wifi_set_promiscuous(true) and esp_wifi_start() can trigger the initialization of Wi-Fi hardware.
  - The parameters of esp_wifi_80211_tx are hereby correctly provided.
 
 Side-Effects to Avoid in Different Scenarios