esp32: add const for some WiFi api

Add const if the pointer parameter is const
This commit is contained in:
Liu Zhi Fu 2017-10-13 09:47:19 +08:00
parent 0a52dbccca
commit 0e586a4cdf
4 changed files with 14 additions and 14 deletions

View file

@ -181,14 +181,14 @@ extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
* which are set by WIFI_INIT_CONFIG_DEFAULT, please be notified that the field 'magic' of * which are set by WIFI_INIT_CONFIG_DEFAULT, please be notified that the field 'magic' of
* wifi_init_config_t should always be WIFI_INIT_CONFIG_MAGIC! * wifi_init_config_t should always be WIFI_INIT_CONFIG_MAGIC!
* *
* @param config provide WiFi init configuration * @param config pointer to WiFi init configuration structure; can point to a temporary variable.
* *
* @return * @return
* - ESP_OK: succeed * - ESP_OK: succeed
* - ESP_ERR_WIFI_NO_MEM: out of memory * - ESP_ERR_WIFI_NO_MEM: out of memory
* - others: refer to error code esp_err.h * - others: refer to error code esp_err.h
*/ */
esp_err_t esp_wifi_init(wifi_init_config_t *config); esp_err_t esp_wifi_init(const wifi_init_config_t *config);
/** /**
* @brief Deinit WiFi * @brief Deinit WiFi
@ -341,7 +341,7 @@ esp_err_t esp_wifi_deauth_sta(uint16_t aid);
* - ESP_ERR_WIFI_TIMEOUT: blocking scan is timeout * - ESP_ERR_WIFI_TIMEOUT: blocking scan is timeout
* - others: refer to error code in esp_err.h * - others: refer to error code in esp_err.h
*/ */
esp_err_t esp_wifi_scan_start(wifi_scan_config_t *config, bool block); esp_err_t esp_wifi_scan_start(const wifi_scan_config_t *config, bool block);
/** /**
* @brief Stop the scan in process * @brief Stop the scan in process
@ -539,7 +539,7 @@ esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument * - ESP_ERR_WIFI_ARG: invalid argument
*/ */
esp_err_t esp_wifi_set_country(wifi_country_t *country); esp_err_t esp_wifi_set_country(const wifi_country_t *country);
/** /**
* @brief get the current country info * @brief get the current country info
@ -574,7 +574,7 @@ esp_err_t esp_wifi_get_country(wifi_country_t *country);
* - ESP_ERR_WIFI_MODE: WiFi mode is wrong * - ESP_ERR_WIFI_MODE: WiFi mode is wrong
* - others: refer to error codes in esp_err.h * - others: refer to error codes in esp_err.h
*/ */
esp_err_t esp_wifi_set_mac(wifi_interface_t ifx, uint8_t mac[6]); esp_err_t esp_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6]);
/** /**
* @brief Get mac of specified interface * @brief Get mac of specified interface
@ -682,7 +682,7 @@ esp_err_t esp_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter);
* - ESP_ERR_WIFI_NVS: WiFi internal NVS error * - ESP_ERR_WIFI_NVS: WiFi internal NVS error
* - others: refer to the erro code in esp_err.h * - others: refer to the erro code in esp_err.h
*/ */
esp_err_t esp_wifi_set_config(wifi_interface_t ifx, wifi_config_t *conf); esp_err_t esp_wifi_set_config(wifi_interface_t ifx, const wifi_config_t *conf);
/** /**
* @brief Get configuration of specified interface * @brief Get configuration of specified interface

View file

@ -58,7 +58,7 @@ extern "C" {
* - ESP_ERR_WIFI_NO_MEM: out of memory * - ESP_ERR_WIFI_NO_MEM: out of memory
* - others: refer to error code esp_err.h * - others: refer to error code esp_err.h
*/ */
esp_err_t esp_wifi_init_internal(wifi_init_config_t *config); esp_err_t esp_wifi_init_internal(const wifi_init_config_t *config);
/** /**
* @brief get whether the wifi driver is allowed to transmit data or not * @brief get whether the wifi driver is allowed to transmit data or not

View file

@ -68,7 +68,7 @@ esp_err_t esp_wifi_sta_wpa2_ent_disable(void);
* - ESP_ERR_WIFI_ARG: fail(len <= 0 or len >= 128) * - ESP_ERR_WIFI_ARG: fail(len <= 0 or len >= 128)
* - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail) * - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
*/ */
esp_err_t esp_wifi_sta_wpa2_ent_set_identity(unsigned char *identity, int len); esp_err_t esp_wifi_sta_wpa2_ent_set_identity(const unsigned char *identity, int len);
/** /**
* @brief Clear identity for PEAP/TTLS method. * @brief Clear identity for PEAP/TTLS method.
@ -88,7 +88,7 @@ void esp_wifi_sta_wpa2_ent_clear_identity(void);
* - ESP_ERR_WIFI_ARG: fail(len <= 0 or len >= 128) * - ESP_ERR_WIFI_ARG: fail(len <= 0 or len >= 128)
* - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail) * - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
*/ */
esp_err_t esp_wifi_sta_wpa2_ent_set_username(unsigned char *username, int len); esp_err_t esp_wifi_sta_wpa2_ent_set_username(const unsigned char *username, int len);
/** /**
* @brief Clear username for PEAP/TTLS method. * @brief Clear username for PEAP/TTLS method.
@ -108,7 +108,7 @@ void esp_wifi_sta_wpa2_ent_clear_username(void);
* - ESP_ERR_WIFI_ARG: fail(len <= 0) * - ESP_ERR_WIFI_ARG: fail(len <= 0)
* - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail) * - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
*/ */
esp_err_t esp_wifi_sta_wpa2_ent_set_password(unsigned char *password, int len); esp_err_t esp_wifi_sta_wpa2_ent_set_password(const unsigned char *password, int len);
/** /**
* @brief Clear password for PEAP/TTLS method.. * @brief Clear password for PEAP/TTLS method..
@ -130,7 +130,7 @@ void esp_wifi_sta_wpa2_ent_clear_password(void);
* - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail) * - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
*/ */
esp_err_t esp_wifi_sta_wpa2_ent_set_new_password(unsigned char *password, int len); esp_err_t esp_wifi_sta_wpa2_ent_set_new_password(const unsigned char *password, int len);
/** /**
* @brief Clear new password for MSCHAPv2 method.. * @brief Clear new password for MSCHAPv2 method..
@ -149,7 +149,7 @@ void esp_wifi_sta_wpa2_ent_clear_new_password(void);
* @return * @return
* - ESP_ERR_WIFI_OK: succeed * - ESP_ERR_WIFI_OK: succeed
*/ */
esp_err_t esp_wifi_sta_wpa2_ent_set_ca_cert(unsigned char *ca_cert, int len); esp_err_t esp_wifi_sta_wpa2_ent_set_ca_cert(const unsigned char *ca_cert, int len);
/** /**
* @brief Clear CA certificate for PEAP/TTLS method. * @brief Clear CA certificate for PEAP/TTLS method.
@ -172,7 +172,7 @@ void esp_wifi_sta_wpa2_ent_clear_ca_cert(void);
* @return * @return
* - ESP_ERR_WIFI_OK: succeed * - ESP_ERR_WIFI_OK: succeed
*/ */
esp_err_t esp_wifi_sta_wpa2_ent_set_cert_key(unsigned char *client_cert, int client_cert_len, unsigned char *private_key, int private_key_len, unsigned char *private_key_passwd, int private_key_passwd_len); 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);
/** /**
* @brief Clear client certificate and key. * @brief Clear client certificate and key.

View file

@ -16,7 +16,7 @@
#include <esp_wifi.h> #include <esp_wifi.h>
#include "esp_wifi_internal.h" #include "esp_wifi_internal.h"
esp_err_t esp_wifi_init(wifi_init_config_t *config) esp_err_t esp_wifi_init(const wifi_init_config_t *config)
{ {
esp_event_set_default_wifi_handlers(); esp_event_set_default_wifi_handlers();
return esp_wifi_init_internal(config); return esp_wifi_init_internal(config);