From bcbde510e046aa09b310a67149b8e1a549dc2854 Mon Sep 17 00:00:00 2001 From: GW_MC <72297530+GWMCwing@users.noreply.github.com> Date: Mon, 2 Feb 2026 20:46:46 +0800 Subject: [PATCH] feat: add SystemContext class for global system component access --- main/common/system_context.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 main/common/system_context.h diff --git a/main/common/system_context.h b/main/common/system_context.h new file mode 100644 index 0000000..d44eba8 --- /dev/null +++ b/main/common/system_context.h @@ -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; +};