-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetwork.h
More file actions
60 lines (51 loc) · 1.85 KB
/
Network.h
File metadata and controls
60 lines (51 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* @file Network.h
* @brief A 'Subject' class for common operations betwteen the MQTT 'proxy' and the 'Real Subject' class (NetworkCore)
*
* Subject network class headers
*
* @author Amine BAGGA (2025)
*/
#ifndef __NETWORK__
#define __NETWORK__
#include <string>
#include "InterfaceServer.h"
#include "InterfaceEthernet.h"
#include "InterfaceWifiAp.h"
#include "InterfaceWifiClient.h"
#include "NetworkCore.h"
class MqttProxy;
class Network {
public:
const std::string ETH_1_INTERFACE{"eth0"};
const std::string ETH_2_INTERFACE{"eth1"};
const std::string BRIDGE_INTERFACE{"br0"};
const std::string WIFI_CLIENT_INTERFACE{"mlan0"};
const std::string WIFI_AP_INTERFACE{"uap0"};
const std::string ETH_TOPIC{"local/network/ethernet"};
const std::string ETH_1_TOPIC{"local/network/ethernet/1"};
const std::string ETH_2_TOPIC{"local/network/ethernet/1"};
const std::string BRIDGE_TOPIC{"local/network/ethernet/br0"};
const std::string WIFI_CLIENT_TOPIC{"local/network/wifi/client"};
const std::string WIFI_AP_TOPIC{"local/network/wifi/ap"};
Network(MqttProxy*);
virtual ~Network();
void setConfig(const std::string& topic, const std::string& payload);
void getConfigs(void);
void publishConfig(InterfaceServer*);
void publishConfig(Interface*);
void publishDiscoveryList(void);
protected:
InterfaceServer* m_ethernet;
InterfaceEthernet* m_eth0;
InterfaceEthernet* m_eth1;
InterfaceEthernet* m_br0;
InterfaceWifiAp* m_wifiAp;
InterfaceWifiClient* m_wifiClient;
MqttProxy* m_mqttProxy;
NetworkCore* m_networkCore;
private:
void _publishConfigs(void);
void _handleNetworkChange(const std::variant<std::tuple<std::string, std::string>, std::tuple<std::string, std::string, int>, std::tuple<std::string, std::string, std::map<std::string, int>>>&);
};
#endif // __NETWORK__