Squash of branch setup

This commit is contained in:
GW_MC
2026-01-27 19:15:44 +08:00
parent 64fe528abc
commit 3ce135a028
66 changed files with 10798 additions and 0 deletions

32
main/network/network.cpp Normal file
View File

@@ -0,0 +1,32 @@
#include "esp_log.h"
#include "network/network.h"
#include "network/http_handler.h"
#include "common/constants.h"
NetworkHandler::NetworkHandler(
std::unique_ptr<WifiHandler> wifiHandler
) : wifiHandler(std::move(wifiHandler)) { }
NetworkHandler::~NetworkHandler() { }
void NetworkHandler::init(EventGroupHandle_t system_event_group) {
if (this->initialized) {
ESP_LOGW("NetworkHandler", "Already initialized, skipping");
return;
}
this->wifiHandler->init();
this->initialized = true;
xEventGroupSetBits(
system_event_group,
NETWORK_READY_BIT
);
}
WifiHandler& NetworkHandler::get_wifi_handler() {
return *this->wifiHandler;
}
std::unique_ptr<HttpHandler> NetworkHandler::get_http_handler(const esp_http_client_config_t&& config) {
return std::unique_ptr<HttpHandler>(new HttpHandler(std::move(config), this->wifiHandler.get()));
}