Skip to content

Commit

Permalink
refactor: migrate to helper lib, Update include paths and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ZanzyTHEbar committed Mar 31, 2024
1 parent c08ee58 commit 102ba5d
Show file tree
Hide file tree
Showing 20 changed files with 26 additions and 371 deletions.
8 changes: 4 additions & 4 deletions NetworkManager/include/api/asyncota.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include "api/server.hpp"
#include "data/config/project_config.hpp"
#include "utilities/api_utilities.hpp"
#include <data/config/project_config.hpp>
#include <utilities/api_utilities.hpp>
#include "server.hpp"

typedef std::function<void(void)> AsyncOTACustomHandlerFunction;
using AsyncOTACustomHandlerFunction = std::function<void(void)>;
class AsyncOTA {
AsyncOTACustomHandlerFunction customHandlerFunction = NULL;
AsyncServer_t& async_server;
Expand Down
6 changes: 3 additions & 3 deletions NetworkManager/include/api/base_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <ArduinoJson.h>
#include <AsyncJson.h>

#include "data/config/project_config.hpp"
#include "utilities/api_utilities.hpp"
#include "utilities/helpers.hpp"
#include <data/config/project_config.hpp>
#include <helpers/helpers.hpp>
#include <utilities/api_utilities.hpp>

class BaseAPI : public API_Utilities {
protected:
Expand Down
2 changes: 0 additions & 2 deletions NetworkManager/include/api/elegantWebpage.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef ElegantOTAWebpage_h
#define ElegantOTAWebpage_h

#include <Arduino.h>

const uint32_t ELEGANT_HTML_SIZE = 53715;
const uint8_t ELEGANT_HTML[] PROGMEM = {
31,139,8,0,0,0,0,0,2,3,148,58,233,122,26,185,178,255,243,20,141,206,249,56,221,99,185,1,219,113,
Expand Down
6 changes: 3 additions & 3 deletions NetworkManager/include/api/rest_api_handler.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once
#define XWEBSERVERHANDLER_HPP
#include "api/asyncota.hpp"
#include "api/base_api.hpp"
#include "api/server.hpp"
#include "asyncota.hpp"
#include "base_api.hpp"
#include "server.hpp"

class APIServer : public BaseAPI {
private:
Expand Down
4 changes: 2 additions & 2 deletions NetworkManager/include/data/config/config_handler.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once
#include <data/config/project_config.hpp>
#include <utilities/observer.hpp>
#include <helpers/observer.hpp>
#include <utilities/states.hpp>

class ConfigHandler : public IObserver<StateVariant> {
class ConfigHandler : public Helpers::IObserver<StateVariant> {
public:
ConfigHandler(const std::string& configName = std::string(),
const std::string& mdnsName = std::string());
Expand Down
4 changes: 2 additions & 2 deletions NetworkManager/include/data/config/project_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include <string>
#include <vector>

#include <utilities/helpers.hpp>
#include <helpers/helpers.hpp>
#include <helpers/observer.hpp>
#include <utilities/network_utilities.hpp>
#include <utilities/observer.hpp>
#include <utilities/states.hpp>

class CustomConfigInterface {
Expand Down
1 change: 0 additions & 1 deletion NetworkManager/include/data/webpage.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#ifndef EasyNetworkWebManager_h
#define EasyNetworkWebManager_h
#include <Arduino.h>
const uint32_t WEB_MANAGER_HTML_SIZE = 2778;
const uint8_t WEB_MANAGER_HTML[] PROGMEM = {
31,139,8,0,0,0,0,0,2,3,221,91,103,119,219,56,214,254,238,95,129,151,83,108,79,68,53,55,189,178,
Expand Down
4 changes: 2 additions & 2 deletions NetworkManager/include/network/mdns/mdns_manager.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once
#include <ESPmDNS.h>
#include <data/config/project_config.hpp>
#include <utilities/observer.hpp>
#include <helpers/observer.hpp>

class MDNSHandler : public IObserver<StateVariant> {
class MDNSHandler : public Helpers::IObserver<StateVariant> {
private:
ProjectConfig& configManager;
std::string service_name;
Expand Down
4 changes: 2 additions & 2 deletions NetworkManager/include/network/wifihandler/wifi_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
# endif
#endif
#include <data/config/project_config.hpp>
#include <utilities/helpers.hpp>
#include <helpers/helpers.hpp>
#include <utilities/states.hpp>

class WiFiHandler : public IObserver<StateVariant> {
class WiFiHandler : public Helpers::IObserver<StateVariant> {
public:
WiFiHandler(ProjectConfig& configManager, const std::string& ssid,
const std::string& password, uint8_t channel);
Expand Down
2 changes: 1 addition & 1 deletion NetworkManager/include/utilities/api_utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <string>

#include "mbedtls/md.h"
#include "utilities/network_utilities.hpp"
#include "network_utilities.hpp"

constexpr int XHTTP_GET = 0b00000001;
constexpr int XHTTP_POST = 0b00000010;
Expand Down
44 changes: 0 additions & 44 deletions NetworkManager/include/utilities/extras/enum_inheritance.hpp

This file was deleted.

44 changes: 0 additions & 44 deletions NetworkManager/include/utilities/extras/make_unique.hpp

This file was deleted.

59 changes: 0 additions & 59 deletions NetworkManager/include/utilities/helpers.hpp

This file was deleted.

84 changes: 0 additions & 84 deletions NetworkManager/include/utilities/observer.hpp

This file was deleted.

4 changes: 2 additions & 2 deletions NetworkManager/include/utilities/state_manager.hpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#pragma once
#include <algorithm>
#include <helpers/observer.hpp>
#include <iostream>
#include <map>
#include <optional>
#include <string>
#include <type_traits>
#include <variant>
#include <vector>
#include "observer.hpp"

/**
* @brief StateManager is a singleton class that manages all states in the
* program.
* @note It is a singleton because it is used by many classes.
*/
template <typename StateVariant>
class StateManager : public ISubject<StateVariant> {
class StateManager : public Helpers::ISubject<StateVariant> {
public:
StateManager() = default;
virtual ~StateManager() override = default;
Expand Down
1 change: 1 addition & 0 deletions NetworkManager/ini/dev_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ description = "EasyNetworkManager"
platform = espressif32
framework = arduino
lib_deps =
https://github.com/ZanzyTHEbar/EasyHelpers.git
https://github.com/me-no-dev/ESPAsyncWebServer.git
https://github.com/me-no-dev/AsyncTCP.git
https://github.com/bblanchon/ArduinoJson
Expand Down
2 changes: 1 addition & 1 deletion NetworkManager/src/api/server.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "api/server.hpp"
#include <api/server.hpp>

AsyncServer_t::AsyncServer_t(const int CONTROL_PORT,
ProjectConfig& configManager,
Expand Down
2 changes: 1 addition & 1 deletion NetworkManager/src/data/config/config_handler.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "data/config/config_handler.hpp"
#include <data/config/config_handler.hpp>

ConfigHandler::ConfigHandler(const std::string& configName,
const std::string& mdnsName)
Expand Down
Loading

0 comments on commit 102ba5d

Please sign in to comment.