### SimplePortal Asynchronous Example (C++) Source: https://github.com/gyverlibs/simpleportal/blob/main/README_EN.md Shows how to use the SimplePortal library asynchronously. Portalstart() is called in setup() to launch the portal without blocking. The Portaltick() function must be repeatedly called in the main loop() to process portal events. When a portal action (like submitting data or timeout) occurs, Portaltick() returns true, allowing the sketch to check the status and access configuration data. ```C++ #include #include VOID setup () { Serial.Begin (9600); // Launch the portal Portalstart (); } VOID loop () { // CALL in LOOP if (portalTick ()) { Serial.println (Portalstatus ()); if (portalstatus () == sp_submit) { Serial.println (Portalcfg.ssid); Serial.println (Portalcfg.pass); // Take the login-Parol } // will work once under action // point will be automatically turned off } } ``` -------------------------------- ### SimplePortal Blocking Example (C++) Source: https://github.com/gyverlibs/simpleportal/blob/main/README_EN.md Demonstrates how to use the SimplePortal library in a blocking manner. The Portalrun() function is called in setup(), which blocks until the portal action is complete or times out. After Portalrun returns, the sketch checks the portal status and accesses the configured SSID and password from the PortalCFG structure if the status is sp_submit. ```C++ #include #include VOID setup () { Serial.Begin (9600); Delay (3000); Portalrun ();// Launch with a timeout 60C // Portalrun (30000);// Launch with a custom timeout Serial.println (Portalstatus ()); // Status: 0 Error, 1 Connect, 2 AP, 3 Local, 4 Exit, 5 Timeout if (portalstatus () == sp_submit) { Serial.println (Portalcfg.ssid); Serial.println (Portalcfg.pass); // Take the login-Parol } } VOID loop () { } ``` -------------------------------- ### SimplePortal Core Functions and Status Constants (C++) Source: https://github.com/gyverlibs/simpleportal/blob/main/README_EN.md Declares the main functions for starting, stopping, ticking, and running the SimplePortal, along with constants representing the portal's status. Portalstart launches the portal, Portalstop stops it, Portaltick should be called in the main loop for asynchronous operation, Portalrun is a blocking call, and portalstatus returns the current state. ```C++ VOID Portalstart ();// Launch the portal VOID Portalstop ();// Stop the portal Bool Portaltick ();// Call in the cycle VOID Portalrun (Uint32_T PRD = 60000);// blocking call Byte portalstatus ();// Status: 1 Connect, 2 AP, 3 Local, 4 Exit, 5 Timeout // Constants of Status SP_ERROR // Error Sp_submit // sent login-paralle Sp_switch_ap // Signal to change in AP Sp_switch_local // shift signal to Local Sp_exit // click button output Sp_timeout // Taimout came out ``` -------------------------------- ### SimplePortal Public API and Status Constants - C++ Source: https://github.com/gyverlibs/simpleportal/blob/main/README.md This snippet lists the main public functions provided by the SimplePortal library for controlling the portal lifecycle and checking its status, along with the constants representing different portal states or events. ```C++ void portalStart(); // запустить портал void portalStop(); // остановить портал bool portalTick(); // вызывать в цикле void portalRun(uint32_t prd = 60000); // блокирующий вызов byte portalStatus(); // статус: 1 connect, 2 ap, 3 local, 4 exit, 5 timeout // константы статуса SP_ERROR // ошибка SP_SUBMIT // отправлены логин-пароль SP_SWITCH_AP // сигнал на смену в AP SP_SWITCH_LOCAL // сигнал на смену в Local SP_EXIT // нажата кнопка выход SP_TIMEOUT // вышел таймаут ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.