2023-03-27 17:42:17 +02:00
|
|
|
#ifndef API_H
|
|
|
|
#define API_H
|
|
|
|
|
|
|
|
#include <Arduino_JSON.h>
|
2023-03-28 17:28:55 +02:00
|
|
|
#include <WiFiEsp.h>
|
2023-03-27 17:42:17 +02:00
|
|
|
|
|
|
|
class API {
|
|
|
|
public:
|
|
|
|
|
2023-03-28 16:05:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
API(String user, String password, String host, bool https = true);
|
|
|
|
|
2023-03-28 17:28:55 +02:00
|
|
|
bool wifiBegin(String wifiId, String wifiPass, Stream* espSerial);
|
|
|
|
|
2023-04-03 16:07:57 +02:00
|
|
|
bool sendValute(String val, String poubelleID, String unit, bool full);
|
2023-03-28 16:05:36 +02:00
|
|
|
|
2023-03-27 17:42:17 +02:00
|
|
|
JSONVar* connect();
|
2023-03-28 16:05:36 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
String user;
|
|
|
|
String password;
|
|
|
|
String serveurHost;
|
|
|
|
bool https;
|
2023-03-28 17:28:55 +02:00
|
|
|
|
|
|
|
WiFiEspClient* client;
|
2023-04-03 16:07:57 +02:00
|
|
|
|
2023-03-28 16:05:36 +02:00
|
|
|
String token;
|
2023-03-28 17:28:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2023-03-27 17:42:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|