44 static Network *Instance();
45 static Network *FirstInstance();
46 static Network *NextInstance(Network *instance);
47 static Network *GetInstanceByIP(uint32_t ip);
48 static int GetNetIntfCount();
49 static void DisconnectProtocols();
51 static void Disable();
53 static bool IsReady();
54 static bool Iterate();
55 static void SetConfigMode();
56 static void SetNormalMode();
57 static void SetOfflineMode();
58 static void SetTestMode();
59 static void SetSetupNeeded();
60 static bool PopSetupNeeded();
62 static bool GetMainMacAddr(uint8_t *);
64 static void SetHostname(
const char *prefix,
int macSize);
66 static bool IsIpSetupTimeout();
67 static void LoadConfig();
69 static void printData(
const char *prefix,
const void *buf,
const int count);
71 explicit Network(uint8_t ip[4]);
74 virtual void onLoadConfig();
75 virtual void setup() = 0;
76 virtual void disable() = 0;
77 virtual void uninit();
78 virtual void setConfigMode();
79 virtual void setNormalMode();
80 virtual void setOfflineMode();
82 virtual bool getMacAddr(uint8_t *);
83 virtual void setHostname(
const char *,
int macSize);
84 void generateHostname(
const char *prefix,
int macSize,
char *output);
85 virtual bool isIpSetupTimeout();
86 virtual uint32_t getIP();
90 virtual bool isReady() = 0;
91 virtual bool iterate();
96 virtual bool isWifiConfigRequired();
97 virtual void setSsid(
const char *wifiSsid);
98 virtual void setPassword(
const char *wifiPassword);
101 static void setSSLEnabled(
bool enabled);
103 void clearTimeCounters();
106 void setSetupNeeded();
107 bool popSetupNeeded();
109 enum IntfType getIntfType()
const;
110 virtual const char* getIntfName()
const;
112 bool isIntfDisabledInConfig()
const;
115 static Network *netIntf;
116 static Network *firstNetIntf;
118 Network *nextNetIntf =
nullptr;
120 const char *rootCACert =
nullptr;
121 unsigned int rootCACertSize = 0;
122 unsigned char localIp[4];
123 char hostname[32] = {};
125 enum IntfType intfType = IntfType::Unknown;
127 static enum DeviceMode mode;
128 bool setupNeeded =
false;
129 bool useLocalIp =
false;
130 bool intfDisabledInConfig =
false;
131 bool testMode =
false;