ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
NetworkMgr.hpp
Go to the documentation of this file.
1#pragma once
2/*
3* NetworkMgr.hpp - Input Management class
4*
5* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
6* Copyright (c) 2021, 2022 Shelby Merrick
7* http://www.forkineye.com
8*
9* This program is provided free for you to use in any way that you wish,
10* subject to the laws and regulations where you are using it. Due diligence
11* is strongly suggested before using this code. Please give credit where due.
12*
13* The Author makes no warranty of any kind, express or implied, with regard
14* to this program or the documentation contained in this document. The
15* Author shall not be liable in any event for incidental or consequential
16* damages in connection with, or arising out of, the furnishing, performance
17* or use of these programs.
18*
19* This is a factory class used to manage the input channels. It creates and deletes
20* the input channel functionality as needed to support any new configurations
21* that get sent from from the WebPage.
22*
23*/
24
25#include "ESPixelStick.h"
26#include "WiFiDriver.hpp"
27#ifdef SUPPORT_ETHERNET
28# include "EthernetDriver.hpp"
29#endif // def SUPPORT_ETHERNET
30
32{
33public:
34 c_NetworkMgr ();
35 virtual ~c_NetworkMgr ();
36
37 void Begin ();
38 void GetConfig (JsonObject & json);
39 void GetStatus (JsonObject & json);
40 bool SetConfig (JsonObject & json);
41 void Poll ();
42 void GetDriverName (String & Name) { Name = "NetworkMgr"; }
43
44 void SetWiFiIsConnected (bool newState);
45 void SetEthernetIsConnected (bool newState);
46
48 void GetHostname (String & name) { name = hostname; }
49 IPAddress GetlocalIP ();
50
51private:
52 bool Validate ();
53 void AdvertiseNewState ();
54 void SetWiFiEnable ();
55
57#ifdef SUPPORT_ETHERNET
58 c_EthernetDriver EthernetDriver;
59#endif // def SUPPORT_ETHERNET
60
61 String hostname;
62 bool HasBeenInitialized = false;
63 bool IsWiFiConnected = false;
64 bool IsEthernetConnected = false;
65 bool PreviousState = false;
67
68}; // c_NetworkMgr
69
c_NetworkMgr NetworkMgr
Definition NetworkMgr.cpp:332
Definition NetworkMgr.hpp:32
void Poll()
< Called from loop()
Definition NetworkMgr.cpp:142
void GetHostname(String &name)
Definition NetworkMgr.hpp:48
String hostname
Definition NetworkMgr.hpp:61
void SetWiFiIsConnected(bool newState)
Definition NetworkMgr.cpp:274
c_NetworkMgr()
< Start up the driver and put it into a safe mode
Definition NetworkMgr.cpp:35
void Begin()
< Start the module
Definition NetworkMgr.cpp:69
bool HasBeenInitialized
Definition NetworkMgr.hpp:62
void GetStatus(JsonObject &json)
Definition NetworkMgr.cpp:120
IPAddress GetlocalIP()
Definition NetworkMgr.cpp:114
bool SetConfig(JsonObject &json)
Definition NetworkMgr.cpp:160
void SetWiFiEnable()
Definition NetworkMgr.cpp:288
c_WiFiDriver WiFiDriver
Definition NetworkMgr.hpp:56
void SetEthernetIsConnected(bool newState)
Definition NetworkMgr.cpp:316
bool Validate()
Definition NetworkMgr.cpp:249
bool PreviousState
Definition NetworkMgr.hpp:65
void GetConfig(JsonObject &json)
Definition NetworkMgr.cpp:91
virtual ~c_NetworkMgr()
< deallocate any resources and put the Input channels into a safe state
Definition NetworkMgr.cpp:41
bool IsConnected()
Definition NetworkMgr.hpp:47
void GetDriverName(String &Name)
Definition NetworkMgr.hpp:42
bool IsEthernetConnected
Definition NetworkMgr.hpp:64
bool AllowWiFiAndEthUpSimultaneously
Definition NetworkMgr.hpp:66
void AdvertiseNewState()
Definition NetworkMgr.cpp:50
bool IsWiFiConnected
Definition NetworkMgr.hpp:63
Definition WiFiDriver.hpp:52