ESP32_RTOS_SDK V1.1.0

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Functions
SoftAP APIs
WiFi Related APIs

ESP32 Soft-AP APIs. More...

## Data Structures

struct | softap_config
struct | station_info

## Functions

bool | wifi_softap_get_config (struct softap_config *config)
| Get the current configuration of the ESP32 WiFi soft-AP. More...
bool | wifi_softap_get_config_default (struct softap_config *config)
| Get the configuration of the ESP32 WiFi soft-AP saved in the flash. More...
bool | wifi_softap_set_config (struct softap_config *config)
| Set the configuration of the WiFi soft-AP and save it to the Flash. More...
bool | wifi_softap_set_config_current (struct softap_config *config)
| Set the configuration of the WiFi soft-AP; the configuration will not be saved to the Flash. More...
uint8 | wifi_softap_get_station_num (void)
| Get the number of stations connected to the ESP32 soft-AP. More...
struct station_info * | wifi_softap_get_station_info (void)
| Get the information of stations connected to the ESP32 soft-AP, including MAC and IP. More...
void | wifi_softap_free_station_info (void)
| Free the space occupied by station_info when wifi_softap_get_station_info is called. More...
bool | wifi_softap_dhcps_start (void)
| Enable the ESP32 soft-AP DHCP server. More...
bool | wifi_softap_dhcps_stop (void)
| Disable the ESP32 soft-AP DHCP server. The DHCP is enabled by default. More...
enum dhcp_status | wifi_softap_dhcps_status (void)
| Get the ESP32 soft-AP DHCP server status. More...
bool | wifi_softap_get_dhcps_lease (struct dhcps_lease *please)
| Query the IP range that can be got from the ESP32 soft-AP DHCP server. More...
bool | wifi_softap_set_dhcps_lease (struct dhcps_lease *please)
| Set the IP range of the ESP32 soft-AP DHCP server. More...
uint32 | wifi_softap_get_dhcps_lease_time (void)
| Get ESP32 soft-AP DHCP server lease time. More...
bool | wifi_softap_set_dhcps_lease_time (uint32 minute)
| Set ESP32 soft-AP DHCP server lease time, default is 120 minutes. More...
bool | wifi_softap_reset_dhcps_lease_time (void)
| Reset ESP32 soft-AP DHCP server lease time which is 120 minutes by default. More...
bool | wifi_softap_set_dhcps_offer_option (uint8 level, void *optarg)
| Set the ESP32 soft-AP DHCP server option. More...

## Detailed Description

ESP32 Soft-AP APIs.

Attention
  To call APIs related to ESP32 soft-AP has to enable soft-AP mode first (wifi_set_opmode)

## Function Documentation

bool wifi_softap_dhcps_start | ( | void |  | ) |

Enable the ESP32 soft-AP DHCP server.

Attention
  1. The DHCP is enabled by default.
  2. The DHCP and the static IP related API (wifi_set_ip_info) influence each other, if the DHCP is enabled, the static IP will be disabled; if the static IP is enabled, the DHCP will be disabled. It depends on the latest configuration.

Parameters

  null |

Returns
  true : succeed
  false : fail

enum dhcp_status wifi_softap_dhcps_status | ( | void |  | ) |

Get the ESP32 soft-AP DHCP server status.

Parameters

  null |

Returns
  enum dhcp_status

bool wifi_softap_dhcps_stop | ( | void |  | ) |

Disable the ESP32 soft-AP DHCP server. The DHCP is enabled by default.

Parameters

  null |

Returns
  true : succeed
  false : fail

void wifi_softap_free_station_info | ( | void |  | ) |

Free the space occupied by station_info when wifi_softap_get_station_info is called.

Attention
  The ESP32 is limited to only one channel, so when in the soft-AP+station mode, the soft-AP will adjust its channel automatically to be the same as the channel of the ESP32 station.

Parameters

  null |

Returns
  null

bool wifi_softap_get_config | ( | struct softap_config * | config | ) |

Get the current configuration of the ESP32 WiFi soft-AP.

Parameters

  struct | softap_config *config : ESP32 soft-AP configuration

Returns
  true : succeed
  false : fail

bool wifi_softap_get_config_default | ( | struct softap_config * | config | ) |

Get the configuration of the ESP32 WiFi soft-AP saved in the flash.

Parameters

  struct | softap_config *config : ESP32 soft-AP configuration

Returns
  true : succeed
  false : fail

bool wifi_softap_get_dhcps_lease | ( | struct dhcps_lease * | please | ) |

Query the IP range that can be got from the ESP32 soft-AP DHCP server.

Attention
  This API can only be called during ESP32 soft-AP DHCP server enabled.

Parameters

  struct | dhcps_lease *please : IP range of the ESP32 soft-AP DHCP server.

Returns
  true : succeed
  false : fail

uint32 wifi_softap_get_dhcps_lease_time | ( | void |  | ) |

Get ESP32 soft-AP DHCP server lease time.

Attention
  This API can only be called during ESP32 soft-AP DHCP server enabled.

Parameters

  null |

Returns
  lease time, uint: minute.

struct station_info* wifi_softap_get_station_info | ( | void |  | ) |

Get the information of stations connected to the ESP32 soft-AP, including MAC and IP.

Attention
  wifi_softap_get_station_info depends on DHCP, it can only be used when DHCP is enabled, so it can not get the static IP.

Parameters

  null |

Returns
  struct station_info* : station information structure

uint8 wifi_softap_get_station_num | ( | void |  | ) |

Get the number of stations connected to the ESP32 soft-AP.

Attention
  The ESP32 is limited to only one channel, so when in the soft-AP+station mode, the soft-AP will adjust its channel automatically to be the same as the channel of the ESP32 station.

Parameters

  null |

Returns
  the number of stations connected to the ESP32 soft-AP

bool wifi_softap_reset_dhcps_lease_time | ( | void |  | ) |

Reset ESP32 soft-AP DHCP server lease time which is 120 minutes by default.

Attention
  This API can only be called during ESP32 soft-AP DHCP server enabled.

Parameters

  null |

Returns
  true : succeed
  false : fail

bool wifi_softap_set_config | ( | struct softap_config * | config | ) |

Set the configuration of the WiFi soft-AP and save it to the Flash.

Attention
  1. This configuration will be saved in flash system parameter area if changed
  2. The ESP32 is limited to only one channel, so when in the soft-AP+station mode, the soft-AP will adjust its channel automatically to be the same as the channel of the ESP32 station.

Parameters

  struct | softap_config *config : ESP32 soft-AP configuration

Returns
  true : succeed
  false : fail

bool wifi_softap_set_config_current | ( | struct softap_config * | config | ) |

Set the configuration of the WiFi soft-AP; the configuration will not be saved to the Flash.

Attention
  The ESP32 is limited to only one channel, so when in the soft-AP+station mode, the soft-AP will adjust its channel automatically to be the same as the channel of the ESP32 station.

Parameters

  struct | softap_config *config : ESP32 soft-AP configuration

Returns
  true : succeed
  false : fail

bool wifi_softap_set_dhcps_lease | ( | struct dhcps_lease * | please | ) |

Set the IP range of the ESP32 soft-AP DHCP server.

Attention
  1. The IP range should be in the same sub-net with the ESP32 soft-AP IP address.
  2. This API should only be called when the DHCP server is disabled (wifi_softap_dhcps_stop).
  3. This configuration will only take effect the next time when the DHCP server is enabled (wifi_softap_dhcps_start).
  - If the DHCP server is disabled again, this API should be called to set the IP range.
  - Otherwise, when the DHCP server is enabled later, the default IP range will be used.

Parameters

  struct | dhcps_lease *please : IP range of the ESP32 soft-AP DHCP server.

Returns
  true : succeed
  false : fail

bool wifi_softap_set_dhcps_lease_time | ( | uint32 | minute | ) |

Set ESP32 soft-AP DHCP server lease time, default is 120 minutes.

Attention
  This API can only be called during ESP32 soft-AP DHCP server enabled.

Parameters

  uint32 | minute : lease time, uint: minute, range:[1, 2880].

Returns
  true : succeed
  false : fail

bool wifi_softap_set_dhcps_offer_option | ( | uint8 | level,
|  | void * | optarg
| ) |  |

Set the ESP32 soft-AP DHCP server option.

Example:

            uint8 mode = 0;
            wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, &mode);

Parameters

  uint8 | level : OFFER_ROUTER, set the router option.
  void* | optarg :
  - bit0, 0 disable the router information;
  - bit0, 1 enable the router information.

Returns
  true : succeed
  false : fail