2024-04-03 07:04:55 +07:00
|
|
|
/**
|
|
|
|
* @file AgApiClient.h
|
|
|
|
* @brief HTTP client connect post data to Aigradient cloud.
|
|
|
|
* @version 0.1
|
|
|
|
* @date 2024-Apr-02
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2024
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _AG_API_CLIENT_H_
|
|
|
|
#define _AG_API_CLIENT_H_
|
|
|
|
|
|
|
|
#include "AgConfigure.h"
|
2024-04-04 18:35:15 +07:00
|
|
|
#include "AirGradient.h"
|
2024-04-03 21:26:04 +07:00
|
|
|
#include "Main/PrintLog.h"
|
2024-04-03 07:04:55 +07:00
|
|
|
#include <Arduino.h>
|
|
|
|
|
2024-04-03 21:26:04 +07:00
|
|
|
class AgApiClient : public PrintLog {
|
2024-04-03 07:04:55 +07:00
|
|
|
private:
|
2024-04-07 16:39:01 +07:00
|
|
|
Configuration &config;
|
2024-04-04 18:35:15 +07:00
|
|
|
AirGradient *ag;
|
2024-04-03 07:04:55 +07:00
|
|
|
|
2024-04-03 21:26:04 +07:00
|
|
|
bool getConfigFailed;
|
2024-04-03 07:04:55 +07:00
|
|
|
bool postToServerFailed;
|
2024-05-22 12:13:57 +07:00
|
|
|
bool notAvailableOnDashboard = false; // Device not setup on Airgradient cloud dashboard.
|
2024-04-03 07:04:55 +07:00
|
|
|
|
|
|
|
public:
|
2024-04-07 16:39:01 +07:00
|
|
|
AgApiClient(Stream &stream, Configuration &config);
|
2024-04-03 07:04:55 +07:00
|
|
|
~AgApiClient();
|
|
|
|
|
|
|
|
void begin(void);
|
2024-04-04 18:35:15 +07:00
|
|
|
bool fetchServerConfiguration(void);
|
|
|
|
bool postToServer(String data);
|
2024-04-03 07:04:55 +07:00
|
|
|
bool isFetchConfigureFailed(void);
|
|
|
|
bool isPostToServerFailed(void);
|
2024-05-22 12:13:57 +07:00
|
|
|
bool isNotAvailableOnDashboard(void);
|
2024-04-04 18:35:15 +07:00
|
|
|
void setAirGradient(AirGradient *ag);
|
2024-04-11 09:29:29 +07:00
|
|
|
bool sendPing(int rssi, int bootCount);
|
2024-04-03 07:04:55 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /** _AG_API_CLIENT_H_ */
|