feat: add SystemContext class for global system component access
This commit is contained in:
30
main/common/system_context.h
Normal file
30
main/common/system_context.h
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class NetworkHandler;
|
||||||
|
class WifiHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief System context providing access to global system components
|
||||||
|
*/
|
||||||
|
class SystemContext {
|
||||||
|
public:
|
||||||
|
static SystemContext& instance() {
|
||||||
|
static SystemContext context;
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_network_handler(NetworkHandler* handler) {
|
||||||
|
network_handler_ = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
NetworkHandler* get_network_handler() const {
|
||||||
|
return network_handler_;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
SystemContext() = default;
|
||||||
|
SystemContext(const SystemContext&) = delete;
|
||||||
|
SystemContext& operator=(const SystemContext&) = delete;
|
||||||
|
|
||||||
|
NetworkHandler* network_handler_ = nullptr;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user