Skip to content

Commit

Permalink
renamed .h to .hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
PBrunot committed Nov 16, 2023
1 parent 392f4e4 commit d9743f7
Show file tree
Hide file tree
Showing 27 changed files with 149 additions and 88 deletions.
2 changes: 1 addition & 1 deletion include/AuthProvider.h → include/AuthProvider.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef AUTHPROVIDER_H_
#define AUTHPROVIDER_H_

#include "FabUser.h"
#include "FabUser.hpp"
#include <list>
#include <string_view>
#include <tuple>
Expand Down
19 changes: 19 additions & 0 deletions include/BoardInfo.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef BOARDINFO_HPP
#define BOARDINFO_HPP

#include "Machine.hpp"

struct BoardInfo
{
bool server_connected;
Machine::PowerState power_state;
bool power_warning;
bool operator==(const BoardInfo &t) const
{
return server_connected == t.server_connected &&
power_state == t.power_state &&
power_warning == t.power_warning;
}
};

#endif // BOARDINFO_HPP
6 changes: 3 additions & 3 deletions include/BoardLogic.h → include/BoardLogic.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef BOARDLOGIC_H
#define BOARDLOGIC_H

#include "FabUser.h"
#include "card.h"
#include "FabUser.hpp"
#include "card.hpp"
#include <Adafruit_NeoPixel.h>
#include "pins.h"
#include "pins.hpp"

class BoardLogic
{
Expand Down
8 changes: 4 additions & 4 deletions include/FabServer.h → include/FabServer.hpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#ifndef FABSERVER_H_
#define FABSERVER_H_

#include "FabUser.h"
#include "WiFi.h"
#include "FabUser.hpp"
#include "Wifi.h"
#include <array>
#include "conf.h"
#include "conf.hpp"
#include <string>
#include <MQTTClient.h>
#include <functional>
#include <ArduinoJson.h>
#include "MQTTtypes.h"
#include "MQTTtypes.hpp"
#include <chrono>

using namespace ServerMQTT;
Expand Down
4 changes: 2 additions & 2 deletions include/FabUser.h → include/FabUser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <string>
#include <array>
#include "Arduino.h"
#include "conf.h"
#include "card.h"
#include "conf.hpp"
#include "card.hpp"
#include <sstream>

struct FabUser
Expand Down
18 changes: 3 additions & 15 deletions include/LCDWrapper.h → include/LCDWrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,14 @@
#define LCDWRAPPER_H_

#include <array>
#include "BoardInfo.hpp"
#include "LiquidCrystal.h"
#include "Machine.h"
#include "pins.h"
#include "Machine.hpp"
#include "pins.hpp"
#include <chrono>

using namespace std::chrono;

struct BoardInfo
{
bool server_connected;
Machine::PowerState power_state;
bool power_warning;
bool operator==(const BoardInfo &t) const
{
return server_connected == t.server_connected &&
power_state == t.power_state &&
power_warning == t.power_warning;
}
};

template <uint8_t _COLS, uint8_t _ROWS>
class LCDWrapper
{
Expand Down
6 changes: 3 additions & 3 deletions include/MQTTtypes.h → include/MQTTtypes.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef MQTTTYPES_H_
#define MQTTTYPES_H_

#include "card.h"
#include "card.hpp"
#include "string"
#include <memory>
#include "FabUser.h"
#include "Machine.h"
#include "FabUser.hpp"
#include "Machine.hpp"
#include <string_view>
#include "ArduinoJson.h"

Expand Down
2 changes: 1 addition & 1 deletion include/Machine.h → include/Machine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <cstdint>
#include <array>
#include <chrono>
#include "FabUser.h"
#include "FabUser.hpp"

class FabServer;

Expand Down
2 changes: 1 addition & 1 deletion include/MockMQTTBroker.h → include/MockMQTTBroker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#ifndef MOCKMQTTBROKER_H_
#define MOCKMQTTBROKER_H_

#include "sMQTTBroker.h"
#include "sMQTTBroker.hpp"

class MockMQTTBroker : public sMQTTBroker
{
Expand Down
4 changes: 2 additions & 2 deletions include/MockRFIDWrapper.h → include/MockRFIDWrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <string>
#include <memory>

#include "conf.h"
#include "card.h"
#include "conf.hpp"
#include "card.hpp"

class MockRFIDWrapper
{
Expand Down
4 changes: 2 additions & 2 deletions include/RFIDWrapper.h → include/RFIDWrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <string>
#include <memory>

#include "conf.h"
#include "card.h"
#include "conf.hpp"
#include "card.hpp"
#include "MFRC522v2.h"
#include "MFRC522DriverSPI.h"
#include "MFRC522DriverPinSimple.h"
Expand Down
2 changes: 1 addition & 1 deletion include/card.h → include/card.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define CARD_H_

#include "Arduino.h"
#include "conf.h"
#include "conf.hpp"

namespace card
{
Expand Down
File renamed without changes.
22 changes: 11 additions & 11 deletions include/globals.h → include/globals.hpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#ifndef GLOBALS_H_
#define GLOBALS_H_

#include "FabServer.h"
#include "Machine.h"
#include "LCDWrapper.h"
#include "conf.h"
#include "MockRFIDWrapper.h"
#include "RFIDWrapper.h"
#include "pins.h"
#include "secrets.h"
#include "AuthProvider.h"
#include "BoardLogic.h"
#include "FabServer.hpp"
#include "Machine.hpp"
#include "LCDWrapper.hpp"
#include "conf.hpp"
#include "MockRFIDWrapper.hpp"
#include "RFIDWrapper.hpp"
#include "pins.hpp"
#include "secrets.hpp"
#include "AuthProvider.hpp"
#include "BoardLogic.hpp"
#include <TaskScheduler.h>
#include "MockMQTTBroker.h"
#include "MockMQTTBroker.hpp"

// Global variables
namespace Board
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions include/secrets.h.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <cstdint>
#include <array>
#include <string_view>
#include "Machine.h"
#include "conf.h"
#include "FabUser.h"
#include "Machine.hpp"
#include "conf.hpp"
#include "FabUser.hpp"

namespace secrets::cards
{
Expand Down
56 changes: 56 additions & 0 deletions include/secrets.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#ifndef SECRETS_H_
#define SECRETS_H_

#include <cstdint>
#include <array>
#include <string_view>
#include "Machine.hpp"
#include "conf.hpp"
#include "FabUser.hpp"

namespace secrets::cards
{
using WhiteListEntry = std::tuple<card::uid_t, FabUser::UserLevel, std::string_view>;
using WhiteList = std::array<WhiteListEntry, conf::whitelist::LEN>;

static constexpr WhiteList whitelist /* List of RFID tags whitelisted, regardless of connection */
{
std::make_tuple(0xAABBCCD1, FabUser::UserLevel::FABLAB_ADMIN, "ABCDEFG"),
std::make_tuple(0xAABBCCD2, FabUser::UserLevel::FABLAB_ADMIN, "PIPPO"),
std::make_tuple(0xAABBCCD3, FabUser::UserLevel::FABLAB_USER, "USER1"),
std::make_tuple(0xAABBCCD4, FabUser::UserLevel::FABLAB_USER, "USER2"),
std::make_tuple(0xAABBCCD5, FabUser::UserLevel::FABLAB_USER, "USER3"),
std::make_tuple(0xAABBCCD6, FabUser::UserLevel::FABLAB_USER, "USER1"),
std::make_tuple(0xAABBCCD7, FabUser::UserLevel::FABLAB_USER, "USER1"),
std::make_tuple(0xAABBCCD8, FabUser::UserLevel::FABLAB_USER, "USER1"),
std::make_tuple(0xAABBCCD9, FabUser::UserLevel::FABLAB_USER, "USER1"),
std::make_tuple(0xAABBCCDA, FabUser::UserLevel::FABLAB_USER, "USER1")};
} // namespace secrets::cards

namespace secrets::machine
{
// Machine connected to the ESP32
static constexpr std::string_view machine_name = "LASER1";
static constexpr Machine::MachineType machine_type = Machine::MachineType::LASER;
static constexpr std::string_view machine_topic = "shellyplus1-007/command/switch:0";
static constexpr Machine::MachineID machine_id{1}; /* ID of the machine. Will be used to compose MQTT topic*/

} // namespace secrets::machine

namespace secrets::wifi
{
static constexpr std::string_view ssid = "MORIA"; /* Change with WIFI SSID name */
static constexpr std::string_view password = "Youshallnotpass!"; /* Change with WIFI SSID password */
} // namespace secrets::wifi

namespace secrets::mqtt
{
static constexpr std::string_view client = "BOARD-1"; /* Name of with MQTT client */
static constexpr std::string_view user = "user!"; /* Change with MQTT user */
static constexpr std::string_view password = "password"; /* Change with MQTT password */
static constexpr std::string_view server = "192.168.1.123"; /* IP of MQTT broker*/
static constexpr std::string_view topic = "/machine"; /* Initial part of the topic, machine ID will be added */
static constexpr std::string_view response_topic = "/reply"; /* Server reply (sub-topic of the full machine topic) */
} // namespace secrets::mqtt

#endif // SECRETS_H_
7 changes: 4 additions & 3 deletions src/AuthProvider.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "AuthProvider.h"
#include "AuthProvider.hpp"

#include <string>
#include <cstdint>
#include "FabServer.h"
#include <string>

#include "FabServer.hpp"

namespace Board
{
Expand Down
20 changes: 10 additions & 10 deletions src/BoardLogic.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#include "BoardLogic.h"
#include "BoardLogic.hpp"
#include "Arduino.h"
#include "secrets.h"
#include "conf.h"
#include "Machine.h"
#include "FabServer.h"
#include "RFIDWrapper.h"
#include "MockRFIDWrapper.h"
#include "AuthProvider.h"
#include "secrets.hpp"
#include "conf.hpp"
#include "Machine.hpp"
#include "FabServer.hpp"
#include "RFIDWrapper.hpp"
#include "MockRFIDWrapper.hpp"
#include "AuthProvider.hpp"
#include <esp_task_wdt.h>
#include "LCDWrapper.h"
#include "LCDWrapper.hpp"
#include <sstream>
#include "pins.h"
#include "pins.hpp"
#include <Adafruit_NeoPixel.h>

namespace Board
Expand Down
4 changes: 2 additions & 2 deletions src/FabServer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "FabServer.h"
#include "secrets.h"
#include "FabServer.hpp"
#include "secrets.hpp"

#include <string>
#include <string_view>
Expand Down
3 changes: 0 additions & 3 deletions src/LCDWrapper.tpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#include "LCDWrapper.h"

#include <cstdint>
#include <string>
#include <array>
#include <sstream>
#include "Machine.h"

template <uint8_t _COLS, uint8_t _ROWS>
LCDWrapper<_COLS, _ROWS>::LCDWrapper(const pins_config::lcd_config &conf) : config(conf),
Expand Down
8 changes: 4 additions & 4 deletions src/MQTTtypes.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "MQTTtypes.h"
#include "card.h"
#include "MQTTtypes.hpp"
#include "card.hpp"
#include "string"
#include <memory>
#include "FabUser.h"
#include "FabUser.hpp"
#include <string_view>
#include <sstream>
#include "ArduinoJson.h"
#include "ArduinoJson.hpp"

namespace ServerMQTT
{
Expand Down
6 changes: 3 additions & 3 deletions src/Machine.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "Machine.h"
#include "Machine.hpp"
#include "Arduino.h"
#include <sstream>
#include <cstdint>
#include <type_traits>
#include <chrono>
#include "secrets.h"
#include "FabServer.h"
#include "secrets.hpp"
#include "FabServer.hpp"

using namespace std::chrono_literals;
using namespace std::chrono;
Expand Down
4 changes: 2 additions & 2 deletions src/MockMQTTBroker.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifdef WOKWI_SIMULATION
#include "MockMQTTBroker.h"
#include "conf.h"
#include "MockMQTTBroker.hpp"
#include "conf.hpp"

MockMQTTBroker::MockMQTTBroker()
{
Expand Down
10 changes: 5 additions & 5 deletions src/MockRFIDWrapper.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "MockRFIDWrapper.h"
#include "pins.h"
#include "conf.h"
#include "card.h"
#include "MockRFIDWrapper.hpp"
#include "pins.hpp"
#include "conf.hpp"
#include "card.hpp"
#include <memory>
#include "secrets.h"
#include "secrets.hpp"

MockRFIDWrapper::MockRFIDWrapper()
{
Expand Down
8 changes: 4 additions & 4 deletions src/RFIDWrapper.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "RFIDWrapper.h"
#include "pins.h"
#include "RFIDWrapper.hpp"
#include "pins.hpp"
#include "MFRC522v2.h"
#include "MFRC522DriverSPI.h"
#include "MFRC522DriverPinSimple.h"
#include "MFRC522Debug.h"
#include "conf.h"
#include "card.h"
#include "conf.hpp"
#include "card.hpp"
#include <memory>

RFIDWrapper::RFIDWrapper()
Expand Down
Loading

0 comments on commit d9743f7

Please sign in to comment.