- Replace C function pointers with C++ `std::function` in `Thread`, `Timer` and `DispatcherThread` - Rename `SystemEvent`-related functions - WiFi: fix auto-connect when WiFi disconnects from bad signal - WiFi: fix auto-connect when WiFi fails to auto-connect - WiFi: implement disconnect() when tapping connected WiFi ap in WiFi management app
33 lines
638 B
C++
33 lines
638 B
C++
#pragma once
|
|
|
|
#include "Dispatcher.h"
|
|
|
|
namespace tt {
|
|
|
|
/** Starts a Thread to process dispatched messages */
|
|
class DispatcherThread {
|
|
|
|
Dispatcher dispatcher;
|
|
std::unique_ptr<Thread> thread;
|
|
bool interruptThread = false;
|
|
|
|
int32_t threadMain();
|
|
|
|
public:
|
|
|
|
explicit DispatcherThread(const std::string& threadName, size_t threadStackSize = 4096);
|
|
~DispatcherThread();
|
|
|
|
/**
|
|
* Dispatch a message.
|
|
*/
|
|
void dispatch(Dispatcher::Function function, TickType_t timeout = portMAX_DELAY);
|
|
|
|
/** Start the thread (blocking). */
|
|
void start();
|
|
|
|
/** Stop the thread (blocking). */
|
|
void stop();
|
|
};
|
|
|
|
} |