feat: add check if wifi connected
This commit is contained in:
parent
908ca96c39
commit
46d3edef1d
@ -5,6 +5,7 @@
|
||||
#include <ESP8266HTTPClient.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <WiFiClientSecureBearSSL.h>
|
||||
#include <ESP8266WiFi.h>
|
||||
|
||||
class DiscordAPI{
|
||||
public:
|
||||
@ -24,12 +25,12 @@ private:
|
||||
|
||||
/**
|
||||
* @brief http client
|
||||
*
|
||||
*/
|
||||
HTTPClient* httpClient;
|
||||
|
||||
//WiFiClient* wifiClient;
|
||||
|
||||
/**
|
||||
* @brief wifi client (for https)
|
||||
*/
|
||||
BearSSL::WiFiClientSecure* wifiClient;
|
||||
};
|
||||
|
||||
|
@ -11,8 +11,9 @@ DiscordAPI::DiscordAPI(String hookUrl){
|
||||
bool DiscordAPI::sendMessage(String message){
|
||||
bool sortie = true;
|
||||
|
||||
//TODO: faire test si le wifi est bien connecter
|
||||
|
||||
if(WiFi.status() != WL_CONNECTED){
|
||||
return false;
|
||||
}
|
||||
|
||||
this->httpClient->begin(*this->wifiClient, this->hookUrl);
|
||||
this->httpClient->addHeader("Content-Type", "application/json");
|
||||
|
Loading…
x
Reference in New Issue
Block a user