Page 1 of 1

Correct order of API calls to become an access point ...

Posted: Tue Nov 01, 2016 9:53 pm
by kolban
When looking at the API to become an access point, I see that there are three APIs of interest:
  • esp_wifi_start()
  • esp_wifi_set_config(WIFI_IF_AP, ...)
  • esp_wifi_set_mode(WIFI_MODE_AP)
My question is ... What is the correct semantic sequence for calling these functions? Is there a "state diagram" for the WiFi engine that we should be using?

Re: Correct order of API calls to become an access point ...

Posted: Wed Dec 28, 2016 1:49 am
by kolban
*bump*

Re: Correct order of API calls to become an access point ...

Posted: Fri Dec 30, 2016 10:38 pm
by arao23
Set mode -> Set config -> Start works fine for me. After starting, I can switch between modes using just esp_wifi_set_mode without needing to touch anything else.

Code: Select all

	ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_AP) );

	wifi_config_t apConfig = {
			.ap = {
					.ssid="SomeSSIDHere",
					.password = "SomePasswordMoreThan8Chars",
					.ssid_len = 0,
					.channel = 0,
					.authmode = WIFI_AUTH_WPA2_PSK,
					.ssid_hidden = 0,
					.max_connection = 4, // how many clients to allow?
					.beacon_interval = 100 // default value
			}
	};

	ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_AP, &apConfig) );
	ESP_ERROR_CHECK( esp_wifi_start() );
As for a state diagram, I'm not sure, but it would be quite helpful to have one that encompasses everything from start to finish, including when the various events are raised.