documentation checked and edit

for all files in lib folder
This commit is contained in:
2023-10-12 18:45:12 +02:00
parent 61a95e4601
commit db74898b72
41 changed files with 1030 additions and 569 deletions
+13 -13
View File
@@ -21,18 +21,18 @@ Network::Network(const char *ssid, const char *passphrase)
this->init(ssid, passphrase);
}
Network::Network(const char *ssid, const char *passphrase, NetworkAdresses adresses)
: adresses{adresses}
Network::Network(const char *ssid, const char *passphrase, NetworkAddresses adresses)
: addresses{adresses}
{
if (!WiFiGenericClass::mode(WIFI_AP_STA))
{
std::cout << "Network::connectWiFi failed WiFi.mode" << std::endl;
}
if (!WiFi.config(this->adresses.localIP,
this->adresses.gateway,
this->adresses.subnet,
this->adresses.dnsServer))
if (!WiFi.config(this->addresses.localIP,
this->addresses.gateway,
this->addresses.subnet,
this->addresses.dnsServer))
{
std::cout << "STA Failed to configure" << std::endl;
}
@@ -45,7 +45,7 @@ Network::~Network()
delete mqttClient;
}
bool Network::activateEspNow(recieveCallbackPtr reci, sendCallbackPtr send)
bool Network::activateEspNow(receiveCallbackPtr reci, sendCallbackPtr send)
{
if (esp_now_init() != ESP_OK)
{
@@ -76,7 +76,7 @@ bool Network::activateMqtt(const char *user, const char *passphrase)
this->mqttPassphrase = passphrase;
this->mqttClient = new PubSubClient(this->wifiClient);
this->mqttClient->setServer(this->adresses.mqttServer, this->adresses.mqttPort);
this->mqttClient->setServer(this->addresses.mqttServer, this->addresses.mqttPort);
this->mqttClient->setSocketTimeout(1);
if (this->wifiConnected)
@@ -116,7 +116,7 @@ uint8_t Network::getCurrentChannel()
void Network::runAsChild()
{
if (!this->initSucessful)
if (!this->initSuccessful)
{
return;
}
@@ -154,21 +154,21 @@ void Network::init(const char *ssid, const char *passphrase)
void Network::checkWifi()
{
if ((WiFiSTAClass::status() != WL_CONNECTED) && (millis() - this->lastWifiRecoonectAttemp >= Network::wifiReconnectDelay))
if ((WiFiSTAClass::status() != WL_CONNECTED) && (millis() - this->lastWifiReconnectAttempt >= Network::wifiReconnectDelay))
{
std::cout << "Reconnecting to WiFi..." << std::endl;
WiFi.disconnect();
this->wifiConnected = WiFi.reconnect();
this->lastWifiRecoonectAttemp = millis();
this->lastWifiReconnectAttempt = millis();
}
}
void Network::checkMqtt()
{
if (!this->mqttClient->connected() && millis() - this->lastMqttReconnectAttemp > Network::mqttReconnectDelay)
if (!this->mqttClient->connected() && millis() - this->lastMqttReconnectAttempt > Network::mqttReconnectDelay)
{
this->mqttConnected = this->connectMqtt();
this->lastMqttReconnectAttemp = millis();
this->lastMqttReconnectAttempt = millis();
}
if (this->mqttConnected)