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 SetSetupNeeded();
58 static bool PopSetupNeeded();
60 static bool GetMainMacAddr(uint8_t *);
62 static void SetHostname(
const char *prefix,
int macSize);
64 static bool IsIpSetupTimeout();
65 static void LoadConfig();
67 static void printData(
const char *prefix,
const void *buf,
const int count);
69 explicit Network(uint8_t ip[4]);
72 virtual void onLoadConfig();
73 virtual void setup() = 0;
74 virtual void disable() = 0;
75 virtual void uninit();
76 virtual void setConfigMode();
77 virtual void setNormalMode();
78 virtual bool getMacAddr(uint8_t *);
79 virtual void setHostname(
const char *,
int macSize);
80 void generateHostname(
const char *prefix,
int macSize,
char *output);
81 virtual bool isIpSetupTimeout();
82 virtual uint32_t getIP();
86 virtual bool isReady() = 0;
87 virtual bool iterate();
92 virtual bool isWifiConfigRequired();
93 virtual void setSsid(
const char *wifiSsid);
94 virtual void setPassword(
const char *wifiPassword);
97 static void setSSLEnabled(
bool enabled);
99 void clearTimeCounters();
102 void setSetupNeeded();
103 bool popSetupNeeded();
105 enum IntfType getIntfType()
const;
106 virtual const char* getIntfName()
const;
108 bool isIntfDisabledInConfig()
const;
111 static Network *netIntf;
112 static Network *firstNetIntf;
114 Network *nextNetIntf =
nullptr;
116 const char *rootCACert =
nullptr;
117 unsigned int rootCACertSize = 0;
118 unsigned char localIp[4];
119 char hostname[32] = {};
121 enum IntfType intfType = IntfType::Unknown;
123 static enum DeviceMode mode;
124 bool setupNeeded =
false;
125 bool useLocalIp =
false;
126 bool intfDisabledInConfig =
false;