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 SetTestMode();
58 static void SetSetupNeeded();
59 static bool PopSetupNeeded();
61 static bool GetMainMacAddr(uint8_t *);
63 static void SetHostname(
const char *prefix,
int macSize);
65 static bool IsIpSetupTimeout();
66 static void LoadConfig();
68 static void printData(
const char *prefix,
const void *buf,
const int count);
70 explicit Network(uint8_t ip[4]);
73 virtual void onLoadConfig();
74 virtual void setup() = 0;
75 virtual void disable() = 0;
76 virtual void uninit();
77 virtual void setConfigMode();
78 virtual void setNormalMode();
80 virtual bool getMacAddr(uint8_t *);
81 virtual void setHostname(
const char *,
int macSize);
82 void generateHostname(
const char *prefix,
int macSize,
char *output);
83 virtual bool isIpSetupTimeout();
84 virtual uint32_t getIP();
88 virtual bool isReady() = 0;
89 virtual bool iterate();
94 virtual bool isWifiConfigRequired();
95 virtual void setSsid(
const char *wifiSsid);
96 virtual void setPassword(
const char *wifiPassword);
99 static void setSSLEnabled(
bool enabled);
101 void clearTimeCounters();
104 void setSetupNeeded();
105 bool popSetupNeeded();
107 enum IntfType getIntfType()
const;
108 virtual const char* getIntfName()
const;
110 bool isIntfDisabledInConfig()
const;
113 static Network *netIntf;
114 static Network *firstNetIntf;
116 Network *nextNetIntf =
nullptr;
118 const char *rootCACert =
nullptr;
119 unsigned int rootCACertSize = 0;
120 unsigned char localIp[4];
121 char hostname[32] = {};
123 enum IntfType intfType = IntfType::Unknown;
125 static enum DeviceMode mode;
126 bool setupNeeded =
false;
127 bool useLocalIp =
false;
128 bool intfDisabledInConfig =
false;
129 bool testMode =
false;