You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alternatively, it can be declared as ``static`` in both function and global scopes.
44
47
45
-
2. Select particular event (in this case ``onStationModeDisconnected``)
46
-
and add the code to be executed when event is fired.
47
48
48
-
``cpp disconnectedEventHandler = WiFi.onStationModeDisconnected([](const WiFiEventStationModeDisconnected& event) { Serial.println("Station disconnected"); });`` If this event is fired the code will print out information that station has been disconnected.
49
+
2. Select particular event (in this case ``onStationModeDisconnected``).
50
+
When this event is fired the code will print out information that station has been disconnected:
3. Disable ``disconnectedEventHandler``, so the event is no longer handled by our callback:
59
+
60
+
.. code:: cpp
61
+
disconnectedEventHandler = nullptr;
49
62
50
-
That's it. It is all we need to do.
63
+
Take note that lifetime of the callback handler is up to the app. e.g. if ``onStationModeDisconnected`` is declared in the function scope, it would be discarded immediately after the function exists.
Copy file name to clipboardExpand all lines: doc/esp8266wifi/soft-access-point-examples.rst
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,9 @@ Sketch is small so analysis shouldn't be difficult. In first line we are includi
79
79
80
80
Setting up of the access point ``ESPsoftAP_01`` is done by executing:
81
81
82
-
``cpp boolean result = WiFi.softAP("ESPsoftAP_01", "pass-to-soft-AP");``
82
+
.. code:: cpp
83
+
84
+
boolean result = WiFi.softAP("ESPsoftAP_01", "pass-to-soft-AP");
83
85
84
86
If this operation is successful then ``result`` will be ``true`` or ``false`` if otherwise. Basing on that either ``Ready`` or ``Failed!`` will be printed out by the following ``if - else`` conditional statement.
0 commit comments