Skip to content
Shawn A edited this page Mar 5, 2021 · 7 revisions

This is draft outline for NEW API additions to be added to API reference

πŸ“˜ = NEW Methods πŸ“— = Existing Methods πŸ“™ = Legacy/deprecated

Public Methods

autoConnect() πŸ“—

autoConnect(char const *apName, char const *apPassword = NULL)

auto connect to saved wifi, or custom, and start config portal on failures

startConfigPortal(char const *apName, char const *apPassword = NULL) πŸ“—

manually start the config portal, autoconnect does this automatically on connect failure

returns bool

startConfigPortal() πŸ“—

auto generates apname

returns bool

stopConfigPortal() πŸ“—

manually stop the config portal if started manually, stop immediatly if non blocking, flag abort if blocking

returns bool

startWebPortal() πŸ“˜

manually start the web portal, autoconnect does this automatically on connect failure

stopWebPortal() πŸ“˜

_manually stop the web portal if started manually_mark

process() πŸ“˜

Run webserver processing, if setConfigPortalBlocking(false)

returns bool

getConfigPortalSSID() πŸ“˜

get the AP name of the config portal, so it can be used in the callback

returns String

getRSSIasQuality(int RSSI) πŸ“—

_get the wifi RSSI as a percentage quality value _

returns int

resetSettings() πŸ“—

erase wifi credentials

reboot() πŸ“˜

reboot esp

disconnect() πŸ“˜

disconnect wifi, without persistent saving or erasing

returns bool

erase() πŸ“˜

erase(bool opt) πŸ“˜

erase esp

returns bool

addParameter(WiFiManagerParameter *p) πŸ“—

adds a custom parameter

returns false on failure_

returns bool

WiFiManagerParameter

getParameters() πŸ“˜

returns the list of Parameters

getParametersCount() πŸ“˜

returns the Parameters Count

returns int

CALLBACKS

setAPCallback( std::function<void(WiFiManager*)> func ) πŸ“—

called after AP mode and config portal has started

setWebServerCallback( std::function<void()> func ) πŸ“˜

called after webserver has started

setConfigResetCallback( std::function<void()> func ) πŸ“˜

called when settings reset have been triggered

setSaveConfigCallback( std::function<void()> func ) πŸ“—

called when wifi settings have been changed and connection was successful ( or setBreakAfterConfig(true) )

setSaveParamsCallback( std::function<void()> func ) πŸ“˜

called when saving either params-in-wifi or params page

setPreSaveConfigCallback( std::function<void()> func ) πŸ“˜

called when saving params-in-wifi or params before anything else happens (eg wifi)

setConfigPortalTimeout(unsigned long seconds) πŸ“—

sets timeout before AP,webserver loop ends and exits even if there has been no setup. useful for devices that failed to connect at some point and got stuck in a webserver loop in seconds setConfigPortalTimeout is a new name for setTimeout, ! not used if setConfigPortalBlocking

setConnectTimeout(unsigned long seconds) πŸ“—

sets timeout for which to attempt connecting, useful if you get a lot of failed connects

REPLACES Timeout(unsigned long seconds)

_ConnectRetries(uint8_t numRetries) πŸ“˜

sets number of retries for autoconnect, force retry after wait failure exit

setSaveConnectTimeout(unsigned long seconds) πŸ“˜

sets timeout for which to attempt connecting on saves, useful if there are bugs in esp waitforconnectloop

setDebugOutput(bool debug) πŸ“—

toggle debug output

setMinimumSignalQuality(int quality = 8) πŸ“—

set min quality percentage to include in scan, defaults to 8% if not specified

setAPStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn) πŸ“—

sets a custom ip /gateway /subnet configuration

setSTAStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn) πŸ“—

sets config for a static IP

setSTAStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn, IPAddress dns) πŸ“—

sets config for a static IP with DNS

setBreakAfterConfig(bool shouldBreak) πŸ“—

if this is set, it will exit after config, even if connection is unsuccessful.

setConfigPortalBlocking(bool shouldBlock) πŸ“˜

_if this is set, portal will be blocking and wait until save or exit, _ is false user must manually process() to handle config portal, setConfigPortalTimeout is ignored in this mode, user is responsible for closing configportal

setCustomHeadElement(const char* element) πŸ“—

if this is set, customise style

setRemoveDuplicateAPs(bool removeDuplicates) πŸ“—

if this is true, remove duplicated Access Points - defaut true

setRestorePersistent(bool persistent) πŸ“˜

setter for ESP wifi.persistent so we can remember it and restore user preference, as WIFi._persistent is protected

setShowStaticFields(bool alwaysShow) πŸ“˜

if true, always show static net inputs, IP, subnet, gateway, else only show if set via setSTAStaticIPConfig

setShowDnsFields(bool alwaysShow) πŸ“˜

if true, always show static dns, esle only show if set via setSTAStaticIPConfig

setShowPassword(bool show) πŸ“˜

toggle showing the saved wifi password in wifi form, could be a security issue.

setCaptivePortalEnable(bool enabled) πŸ“˜

if false, disable captive portal redirection

setAPClientCheck(bool enabled) πŸ“˜

if false, timeout captive portal even if a STA client connected to softAP (false), suggest disabling if captiveportal is open

setWebPortalClientCheck(bool enabled) πŸ“˜

if true, reset timeout when webclient connects (true), suggest disabling if captiveportal is open

setWiFiAutoReconnect(bool enabled) πŸ“˜

if true, enable autoreconnecting

setScanDispPerc(bool enabled) πŸ“˜

if true, wifiscan will show percentage instead of quality icons, until we have better templating

setEnableConfigPortal(bool enable) πŸ“˜

if true (default) then start the config portal from autoConnect if connection failed

setHostname(const char * hostname) πŸ“˜

set a custom hostname, sets sta and ap dhcp client id for esp32, and sta for esp8266

returns bool

setShowInfoErase(bool enabled) πŸ“˜

show erase wifi onfig button on info page, true

setShowInfoUpdate(bool enabled) πŸ“˜

show OTA upload button on info page

setWiFiAPChannel(int32_t channel) πŸ“˜

set ap channel

WiFiAPHidden(bool hidden) πŸ“˜

set ap hidden

CleanConnect(bool enable) πŸ“˜

clean connect, always disconnect before connecting

setMenu(std::vector<const char*>& menu) πŸ“˜

setMenu(const char* menu[], uint8_t size) πŸ“˜

set custom menu items and order, vector or arr _see menutokens for ids

setParamsPage(bool enable) πŸ“˜

add params to its own menu page and remove from wifi, NOT TO BE COMBINED WITH setMenu!

getLastConxResult() πŸ“˜

get last connection result, includes autoconnect and wifisave

returns uint8_t

getWLStatusString(uint8_t status) πŸ“˜

get a status as string

returns String

getModeString(uint8_t mode) πŸ“˜

get wifi mode as string

returns String

getWiFiIsSaved() πŸ“˜

check if the module has a saved ap to connect to

returns bool

getWiFiPass(bool persistent = true) πŸ“˜

helper to get saved password, if persistent get stored, else get current if connected

returns String

getWiFiSSID(bool persistent = true) πŸ“˜

helper to get saved ssid, if persistent get stored, else get current if connected

returns String

debugSoftAPConfig() πŸ“˜

debug output the softap config

debugPlatformInfo() πŸ“˜

debug output platform info and versioning

htmlEntities(String str) πŸ“˜

helper for html

returns String

setCountry(String cc) πŸ“˜

set the country code for wifi settings, CN

setClass(String str) πŸ“˜

set body class (invert), may be used for hacking in alt classes

setDarkMode(bool enable) πŸ“˜

set dark mode via invert class

getDefaultAPName() πŸ“˜

get default ap esp uses , esp_chipid etc returns String

setHttpPort(uint16_t port) πŸ“˜

set port of webserver, 80

getConfigPortalActive() πŸ“˜

check if config portal is active (true)

returns bool

getWebPortalActive() πŸ“˜

check if web portal is active (true)

returns bool

l

Clone this wiki locally