diff --git a/ESP/lib/src/data/config/project_config.cpp b/ESP/lib/src/data/config/project_config.cpp index 3966213..246fdad 100644 --- a/ESP/lib/src/data/config/project_config.cpp +++ b/ESP/lib/src/data/config/project_config.cpp @@ -65,11 +65,11 @@ void ProjectConfig::load() ESP.restart(); return; } - + log_d("Project config found - Config length: %d", configLen); char buff[configLen]; - getBytes("config", buff, configLen); + getBytes("projectConf", buff, configLen); for (int i = 0; i < configLen; i++) Serial.printf("%02X ", buff[i]); @@ -83,7 +83,7 @@ void ProjectConfig::save() log_d("Saving project config"); TrackerConfig_t *tracker_config = (TrackerConfig_t *)&this->config; - putBytes("config", tracker_config, 3 * sizeof(TrackerConfig_t)); + putBytes("projectConf", tracker_config, 3 * sizeof(TrackerConfig_t)); log_i("Project config saved and system is rebooting"); delay(20000); diff --git a/ESP/lib/src/data/utilities/helpers.cpp b/ESP/lib/src/data/utilities/helpers.cpp index 4c24f26..0950cd2 100644 --- a/ESP/lib/src/data/utilities/helpers.cpp +++ b/ESP/lib/src/data/utilities/helpers.cpp @@ -32,7 +32,7 @@ char *Helpers::itoa(int value, char *result, int base) return result; } -void split(std::string str, std::string splitBy, std::vector &tokens) +void split(const std::string &str, const std::string &splitBy, std::vector &tokens) { /* Store the original string in the array, so we can loop the rest * of the algorithm. */ diff --git a/ESP/lib/src/network/WifiHandler/WifiHandler.hpp b/ESP/lib/src/network/WifiHandler/WifiHandler.hpp index 686c35a..3a503c2 100644 --- a/ESP/lib/src/network/WifiHandler/WifiHandler.hpp +++ b/ESP/lib/src/network/WifiHandler/WifiHandler.hpp @@ -12,8 +12,8 @@ class WiFiHandler { public: WiFiHandler(ProjectConfig *configManager, StateManager *stateManager, - std::string ssid, - std::string password, + const std::string &ssid, + const std::string &password, uint8_t channel); virtual ~WiFiHandler(); void setupWifi(); diff --git a/ESP/lib/src/network/WifiHandler/wifiHandler.cpp b/ESP/lib/src/network/WifiHandler/wifiHandler.cpp index 0382357..2b53633 100644 --- a/ESP/lib/src/network/WifiHandler/wifiHandler.cpp +++ b/ESP/lib/src/network/WifiHandler/wifiHandler.cpp @@ -3,8 +3,8 @@ WiFiHandler::WiFiHandler(ProjectConfig *configManager, StateManager *stateManager, - std::string ssid, - std::string password, + const std::string &ssid, + const std::string &password, uint8_t channel) : configManager(configManager), stateManager(stateManager), ssid(ssid), @@ -52,7 +52,7 @@ void WiFiHandler::setupWifi() count++; while (WiFi.status() != WL_CONNECTED) - { + { progress++; stateManager->setState(ProgramStates::DeviceStates::WiFiState_e::WiFiState_Connecting); currentMillis = millis(); diff --git a/ESP/lib/src/network/api/baseAPI/baseAPI.cpp b/ESP/lib/src/network/api/baseAPI/baseAPI.cpp index ad6e486..bae7097 100644 --- a/ESP/lib/src/network/api/baseAPI/baseAPI.cpp +++ b/ESP/lib/src/network/api/baseAPI/baseAPI.cpp @@ -4,7 +4,7 @@ BaseAPI::BaseAPI(int CONTROL_PORT, WiFiHandler *network, CameraHandler *camera, StateManager *stateManager, - std::string api_url) : API_Utilities(CONTROL_PORT, + const std::string &api_url) : API_Utilities(CONTROL_PORT, network, camera, stateManager, diff --git a/ESP/lib/src/network/api/baseAPI/baseAPI.hpp b/ESP/lib/src/network/api/baseAPI/baseAPI.hpp index dcefd7e..b54db87 100644 --- a/ESP/lib/src/network/api/baseAPI/baseAPI.hpp +++ b/ESP/lib/src/network/api/baseAPI/baseAPI.hpp @@ -74,7 +74,7 @@ public: WiFiHandler *network, CameraHandler *camera, StateManager *stateManager, - std::string api_url); + const std::string &api_url); virtual ~BaseAPI(); virtual void begin(); diff --git a/ESP/lib/src/network/api/utilities/apiUtilities.cpp b/ESP/lib/src/network/api/utilities/apiUtilities.cpp index 2096577..4f2fd54 100644 --- a/ESP/lib/src/network/api/utilities/apiUtilities.cpp +++ b/ESP/lib/src/network/api/utilities/apiUtilities.cpp @@ -22,7 +22,7 @@ API_Utilities::API_Utilities(int CONTROL_PORT, WiFiHandler *network, CameraHandler *camera, StateManager *stateManager, - std::string api_url) : server(new AsyncWebServer(CONTROL_PORT)), + const std::string &api_url) : server(new AsyncWebServer(CONTROL_PORT)), stateManager(stateManager), network(network), camera(camera), diff --git a/ESP/lib/src/network/api/utilities/apiUtilities.hpp b/ESP/lib/src/network/api/utilities/apiUtilities.hpp index 7565711..bb67c7f 100644 --- a/ESP/lib/src/network/api/utilities/apiUtilities.hpp +++ b/ESP/lib/src/network/api/utilities/apiUtilities.hpp @@ -33,7 +33,7 @@ public: WiFiHandler *network, CameraHandler *camera, StateManager *stateManager, - std::string api_url); + const std::string &api_url); virtual ~API_Utilities(); static void printASCII(); diff --git a/ESP/lib/src/network/api/webserverHandler.cpp b/ESP/lib/src/network/api/webserverHandler.cpp index 514c6c8..fe441a0 100644 --- a/ESP/lib/src/network/api/webserverHandler.cpp +++ b/ESP/lib/src/network/api/webserverHandler.cpp @@ -8,11 +8,11 @@ APIServer::APIServer(int CONTROL_PORT, WiFiHandler *network, CameraHandler *camera, StateManager *stateManager, - std::string api_url) : BaseAPI(CONTROL_PORT, - network, - camera, - stateManager, - api_url) {} + const std::string &api_url) : BaseAPI(CONTROL_PORT, + network, + camera, + stateManager, + api_url) {} APIServer::~APIServer() {} @@ -47,11 +47,11 @@ void APIServer::setupServer() addRouteMap("builtin", routes, indexes); // add new route map to the route_map } -void APIServer::findParam(AsyncWebServerRequest *request, const char *param, String &value) +void APIServer::findParam(AsyncWebServerRequest *request, const char *param, std::string &value) { if (request->hasParam(param)) { - value = request->getParam(param)->value(); + value = request->getParam(param)->value().c_str(); } } @@ -65,7 +65,7 @@ void APIServer::findParam(AsyncWebServerRequest *request, const char *param, Str * @return void * */ -void APIServer::addRouteMap(std::string index, route_t route, std::vector &indexes) +void APIServer::addRouteMap(const std::string &index, route_t route, std::vector &indexes) { route_map.emplace(index, route); diff --git a/ESP/lib/src/network/api/webserverHandler.hpp b/ESP/lib/src/network/api/webserverHandler.hpp index 806f6b3..ddbdc43 100644 --- a/ESP/lib/src/network/api/webserverHandler.hpp +++ b/ESP/lib/src/network/api/webserverHandler.hpp @@ -11,13 +11,13 @@ public: WiFiHandler *network, CameraHandler *camera, StateManager *stateManager, - std::string api_url); + const std::string &api_url); virtual ~APIServer(); void begin(); void setupServer(); - void findParam(AsyncWebServerRequest *request, const char *param, String &value); - void addRouteMap(std::string index, route_t route, std::vector &indexes); + void findParam(AsyncWebServerRequest *request, const char *param, std::string &value); + void addRouteMap(const std::string &index, route_t route, std::vector &indexes); void handleRequest(AsyncWebServerRequest *request); public: