Implement get config command and api endpoint for testing purposes

This commit is contained in:
Lorow
2024-12-05 00:40:06 +01:00
parent e033f663ff
commit 44179cee65
8 changed files with 48 additions and 2 deletions

View File

@@ -467,6 +467,26 @@ std::string ProjectConfig::WiFiTxPower_t::toRepresentation()
return json;
}
std::string ProjectConfig::TrackerConfig_t::toRepresentation()
{
std::string WifiConfigRepresentation = "";
for (auto &network : this->networks)
{
WifiConfigRepresentation += Helpers::format_string(", %s", network.toRepresentation());
}
std::string json = Helpers::format_string(
"%s, %s, %s, %s, %s, %s",
this->device.toRepresentation().c_str(),
this->mdns.toRepresentation().c_str(),
this->camera.toRepresentation().c_str(),
WifiConfigRepresentation.c_str(),
this->mdns.toRepresentation().c_str(),
this->txpower.toRepresentation().c_str());
return json;
}
//**********************************************************************************************************************
//*
//! Get Methods
@@ -497,3 +517,7 @@ ProjectConfig::WiFiTxPower_t &ProjectConfig::getWiFiTxPowerConfig()
{
return this->config.txpower;
}
ProjectConfig::TrackerConfig_t &ProjectConfig::getTrackerConfig()
{
return this->config;
}

View File

@@ -99,6 +99,7 @@ public:
AP_WiFiConfig_t ap_network;
MDNSConfig_t mdns;
WiFiTxPower_t txpower;
std::string toRepresentation();
};
DeviceConfig_t &getDeviceConfig();
@@ -107,6 +108,7 @@ public:
AP_WiFiConfig_t &getAPWifiConfig();
MDNSConfig_t &getMDNSConfig();
WiFiTxPower_t &getWiFiTxPowerConfig();
TrackerConfig_t &getTrackerConfig();
void setDeviceConfig(const std::string &OTALogin,
const std::string &OTAPassword,