wifi test
Dependencies: X_NUCLEO_IKS01A2 mbed-http
easy-connect/wifi-x-nucleo-idw01m1/BlockExecuter.h@0:24d3eb812fd4, 2018-09-05 (annotated)
- Committer:
- JMF
- Date:
- Wed Sep 05 14:28:24 2018 +0000
- Revision:
- 0:24d3eb812fd4
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JMF | 0:24d3eb812fd4 | 1 | #ifndef BLOCK_EXEC_H |
JMF | 0:24d3eb812fd4 | 2 | #define BLOCK_EXEC_H |
JMF | 0:24d3eb812fd4 | 3 | |
JMF | 0:24d3eb812fd4 | 4 | #include "mbed.h" |
JMF | 0:24d3eb812fd4 | 5 | |
JMF | 0:24d3eb812fd4 | 6 | /* Helper class to execute something whenever entering/leaving a basic block */ |
JMF | 0:24d3eb812fd4 | 7 | class BlockExecuter { |
JMF | 0:24d3eb812fd4 | 8 | public: |
JMF | 0:24d3eb812fd4 | 9 | BlockExecuter(Callback<void()> exit_cb, Callback<void()> enter_cb = Callback<void()>()) : |
JMF | 0:24d3eb812fd4 | 10 | _exit_cb(exit_cb) { |
JMF | 0:24d3eb812fd4 | 11 | if((bool)enter_cb) enter_cb(); |
JMF | 0:24d3eb812fd4 | 12 | } |
JMF | 0:24d3eb812fd4 | 13 | |
JMF | 0:24d3eb812fd4 | 14 | ~BlockExecuter(void) { |
JMF | 0:24d3eb812fd4 | 15 | _exit_cb(); |
JMF | 0:24d3eb812fd4 | 16 | } |
JMF | 0:24d3eb812fd4 | 17 | |
JMF | 0:24d3eb812fd4 | 18 | private: |
JMF | 0:24d3eb812fd4 | 19 | Callback<void()> _exit_cb; |
JMF | 0:24d3eb812fd4 | 20 | }; |
JMF | 0:24d3eb812fd4 | 21 | |
JMF | 0:24d3eb812fd4 | 22 | #endif //BLOCK_EXEC_H |