mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/btdm_fix_strncpy_error_in_blufi' into 'master'
Component/bt: fix strncpy error in blufi See merge request idf/esp-idf!2141
This commit is contained in:
commit
e84df7a27d
@ -231,6 +231,10 @@ static void example_event_callback(esp_blufi_cb_event_t event, esp_blufi_cb_para
|
|||||||
break;
|
break;
|
||||||
case ESP_BLUFI_EVENT_REQ_CONNECT_TO_AP:
|
case ESP_BLUFI_EVENT_REQ_CONNECT_TO_AP:
|
||||||
BLUFI_INFO("BLUFI requset wifi connect to AP\n");
|
BLUFI_INFO("BLUFI requset wifi connect to AP\n");
|
||||||
|
/* there is no wifi callback when the device has already connected to this wifi
|
||||||
|
so disconnect wifi before connection.
|
||||||
|
*/
|
||||||
|
esp_wifi_disconnect();
|
||||||
esp_wifi_connect();
|
esp_wifi_connect();
|
||||||
break;
|
break;
|
||||||
case ESP_BLUFI_EVENT_REQ_DISCONNECT_FROM_AP:
|
case ESP_BLUFI_EVENT_REQ_DISCONNECT_FROM_AP:
|
||||||
@ -288,14 +292,16 @@ static void example_event_callback(esp_blufi_cb_event_t event, esp_blufi_cb_para
|
|||||||
break;
|
break;
|
||||||
case ESP_BLUFI_EVENT_RECV_SOFTAP_SSID:
|
case ESP_BLUFI_EVENT_RECV_SOFTAP_SSID:
|
||||||
strncpy((char *)ap_config.ap.ssid, (char *)param->softap_ssid.ssid, param->softap_ssid.ssid_len);
|
strncpy((char *)ap_config.ap.ssid, (char *)param->softap_ssid.ssid, param->softap_ssid.ssid_len);
|
||||||
|
ap_config.ap.ssid[param->softap_ssid.ssid_len] = '\0';
|
||||||
ap_config.ap.ssid_len = param->softap_ssid.ssid_len;
|
ap_config.ap.ssid_len = param->softap_ssid.ssid_len;
|
||||||
esp_wifi_set_config(WIFI_IF_AP, &ap_config);
|
esp_wifi_set_config(WIFI_IF_AP, &ap_config);
|
||||||
BLUFI_INFO("Recv SOFTAP SSID %s, ssid len %d\n", ap_config.ap.ssid, ap_config.ap.ssid_len);
|
BLUFI_INFO("Recv SOFTAP SSID %s, ssid len %d\n", ap_config.ap.ssid, ap_config.ap.ssid_len);
|
||||||
break;
|
break;
|
||||||
case ESP_BLUFI_EVENT_RECV_SOFTAP_PASSWD:
|
case ESP_BLUFI_EVENT_RECV_SOFTAP_PASSWD:
|
||||||
strncpy((char *)ap_config.ap.password, (char *)param->softap_passwd.passwd, param->softap_passwd.passwd_len);
|
strncpy((char *)ap_config.ap.password, (char *)param->softap_passwd.passwd, param->softap_passwd.passwd_len);
|
||||||
|
ap_config.ap.password[param->softap_passwd.passwd_len] = '\0';
|
||||||
esp_wifi_set_config(WIFI_IF_AP, &ap_config);
|
esp_wifi_set_config(WIFI_IF_AP, &ap_config);
|
||||||
BLUFI_INFO("Recv SOFTAP PASSWORD %s\n", ap_config.ap.password);
|
BLUFI_INFO("Recv SOFTAP PASSWORD %s len = %d\n", ap_config.ap.password, param->softap_passwd.passwd_len);
|
||||||
break;
|
break;
|
||||||
case ESP_BLUFI_EVENT_RECV_SOFTAP_MAX_CONN_NUM:
|
case ESP_BLUFI_EVENT_RECV_SOFTAP_MAX_CONN_NUM:
|
||||||
if (param->softap_max_conn_num.max_conn_num > 4) {
|
if (param->softap_max_conn_num.max_conn_num > 4) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user