Update API naming

This commit is contained in:
Phat Nguyen
2024-02-29 15:20:19 +07:00
parent 173e3caf2f
commit 67785ed99b
3 changed files with 18 additions and 18 deletions

View File

@ -115,7 +115,7 @@ public:
* @return true Success * @return true Success
* @return false Failure * @return false Failure
*/ */
bool fetchServerConfigure(String id) { bool fetchServerConfiguration(String id) {
String uri = String uri =
"http://hw.airgradient.com/sensors/airgradient:" + id + "/one/config"; "http://hw.airgradient.com/sensors/airgradient:" + id + "/one/config";
@ -368,7 +368,7 @@ static bool wifiHasConfig = false; /** */
static void boardInit(void); static void boardInit(void);
static void failedHandler(String msg); static void failedHandler(String msg);
static void co2Calibration(void); static void co2Calibration(void);
static void serverConfigUpdate(void); static void updateServerConfiguration(void);
static void co2Update(void); static void co2Update(void);
static void pmUpdate(void); static void pmUpdate(void);
static void tempHumUpdate(void); static void tempHumUpdate(void);
@ -382,7 +382,7 @@ bool hasSensorS8 = true;
bool hasSensorPMS = true; bool hasSensorPMS = true;
bool hasSensorSHT = true; bool hasSensorSHT = true;
int pmFailCount = 0; int pmFailCount = 0;
AgSchedule configSchedule(SERVER_CONFIG_UPDATE_INTERVAL, serverConfigUpdate); AgSchedule configSchedule(SERVER_CONFIG_UPDATE_INTERVAL, updateServerConfiguration);
AgSchedule serverSchedule(SERVER_SYNC_INTERVAL, sendDataToServer); AgSchedule serverSchedule(SERVER_SYNC_INTERVAL, sendDataToServer);
AgSchedule dispSchedule(DISP_UPDATE_INTERVAL, dispHandler); AgSchedule dispSchedule(DISP_UPDATE_INTERVAL, dispHandler);
AgSchedule co2Schedule(SENSOR_CO2_UPDATE_INTERVAL, co2Update); AgSchedule co2Schedule(SENSOR_CO2_UPDATE_INTERVAL, co2Update);
@ -413,7 +413,7 @@ void setup() {
wifiHasConfig = true; wifiHasConfig = true;
sendPing(); sendPing();
agServer.fetchServerConfigure(getDevId()); agServer.fetchServerConfiguration(getDevId());
if (agServer.isCo2Calib()) { if (agServer.isCo2Calib()) {
co2Calibration(); co2Calibration();
} }
@ -576,8 +576,8 @@ static void co2Calibration(void) {
} }
} }
static void serverConfigUpdate(void) { static void updateServerConfiguration(void) {
if (agServer.fetchServerConfigure(getDevId())) { if (agServer.fetchServerConfiguration(getDevId())) {
if (agServer.isCo2Calib()) { if (agServer.isCo2Calib()) {
if (hasSensorS8) { if (hasSensorS8) {
co2Calibration(); co2Calibration();

View File

@ -174,7 +174,7 @@ public:
* @return true Success * @return true Success
* @return false Failure * @return false Failure
*/ */
bool fetchServerConfigure(String id) { bool fetchServerConfiguration(String id) {
String uri = String uri =
"http://hw.airgradient.com/sensors/airgradient:" + id + "/one/config"; "http://hw.airgradient.com/sensors/airgradient:" + id + "/one/config";
@ -681,7 +681,7 @@ static String wifiSSID = "";
static void boardInit(void); static void boardInit(void);
static void failedHandler(String msg); static void failedHandler(String msg);
static void serverConfigUpdate(void); static void updateServerConfiguration(void);
static void co2Calibration(void); static void co2Calibration(void);
static void setRGBledPMcolor(int pm25Value); static void setRGBledPMcolor(int pm25Value);
static void ledSmHandler(int sm); static void ledSmHandler(int sm);
@ -711,7 +711,7 @@ bool hasSensorSHT = true;
int pmFailCount = 0; int pmFailCount = 0;
uint32_t factoryBtnPressTime = 0; uint32_t factoryBtnPressTime = 0;
AgSchedule dispLedSchedule(DISP_UPDATE_INTERVAL, displayAndLedBarUpdate); AgSchedule dispLedSchedule(DISP_UPDATE_INTERVAL, displayAndLedBarUpdate);
AgSchedule configSchedule(SERVER_CONFIG_UPDATE_INTERVAL, serverConfigUpdate); AgSchedule configSchedule(SERVER_CONFIG_UPDATE_INTERVAL, updateServerConfiguration);
AgSchedule serverSchedule(SERVER_SYNC_INTERVAL, sendDataToServer); AgSchedule serverSchedule(SERVER_SYNC_INTERVAL, sendDataToServer);
AgSchedule co2Schedule(SENSOR_CO2_UPDATE_INTERVAL, co2Update); AgSchedule co2Schedule(SENSOR_CO2_UPDATE_INTERVAL, co2Update);
AgSchedule pmsSchedule(SENSOR_PM_UPDATE_INTERVAL, pmUpdate); AgSchedule pmsSchedule(SENSOR_PM_UPDATE_INTERVAL, pmUpdate);
@ -786,7 +786,7 @@ void setup() {
Serial.println(WiFi.localIP()); Serial.println(WiFi.localIP());
/** Get first connected to wifi */ /** Get first connected to wifi */
agServer.fetchServerConfigure(getDevId()); agServer.fetchServerConfiguration(getDevId());
if (agServer.isConfigFailed()) { if (agServer.isConfigFailed()) {
dispSmHandler(APP_SM_WIFI_OK_SERVER_OK_SENSOR_CONFIG_FAILED); dispSmHandler(APP_SM_WIFI_OK_SERVER_OK_SENSOR_CONFIG_FAILED);
ledSmHandler(APP_SM_WIFI_OK_SERVER_OK_SENSOR_CONFIG_FAILED); ledSmHandler(APP_SM_WIFI_OK_SERVER_OK_SENSOR_CONFIG_FAILED);
@ -1721,8 +1721,8 @@ static void failedHandler(String msg) {
/** /**
* @brief Send data to server * @brief Send data to server
*/ */
static void serverConfigUpdate(void) { static void updateServerConfiguration(void) {
if (agServer.fetchServerConfigure(getDevId())) { if (agServer.fetchServerConfiguration(getDevId())) {
if (agServer.isCo2Calib()) { if (agServer.isCo2Calib()) {
if (hasSensorS8) { if (hasSensorS8) {
co2Calibration(); co2Calibration();

View File

@ -175,7 +175,7 @@ public:
* @return true Success * @return true Success
* @return false Failure * @return false Failure
*/ */
bool fetchServerConfigure(String id) { bool fetchServerConfiguration(String id) {
String uri = String uri =
"http://hw.airgradient.com/sensors/airgradient:" + id + "/one/config"; "http://hw.airgradient.com/sensors/airgradient:" + id + "/one/config";
@ -713,7 +713,7 @@ static void tvocUpdate(void);
static void pmUpdate(void); static void pmUpdate(void);
static void sendDataToServer(void); static void sendDataToServer(void);
static void co2Update(void); static void co2Update(void);
static void serverConfigUpdate(void); static void updateServerConfiguration(void);
static const char *getFwMode(int mode); static const char *getFwMode(int mode);
static void showNr(void); static void showNr(void);
static void webServerInit(void); static void webServerInit(void);
@ -726,7 +726,7 @@ bool hasSensorPMS1 = true;
bool hasSensorPMS2 = true; bool hasSensorPMS2 = true;
bool hasSensorSGP = true; bool hasSensorSGP = true;
uint32_t factoryBtnPressTime = 0; uint32_t factoryBtnPressTime = 0;
AgSchedule configSchedule(SERVER_CONFIG_UPDATE_INTERVAL, serverConfigUpdate); AgSchedule configSchedule(SERVER_CONFIG_UPDATE_INTERVAL, updateServerConfiguration);
AgSchedule serverSchedule(SERVER_SYNC_INTERVAL, sendDataToServer); AgSchedule serverSchedule(SERVER_SYNC_INTERVAL, sendDataToServer);
AgSchedule co2Schedule(SENSOR_CO2_UPDATE_INTERVAL, co2Update); AgSchedule co2Schedule(SENSOR_CO2_UPDATE_INTERVAL, co2Update);
AgSchedule pmsSchedule(SENSOR_PM_UPDATE_INTERVAL, pmUpdate); AgSchedule pmsSchedule(SENSOR_PM_UPDATE_INTERVAL, pmUpdate);
@ -764,7 +764,7 @@ void setup() {
wifiHasConfig = true; wifiHasConfig = true;
sendPing(); sendPing();
agServer.fetchServerConfigure(getDevId()); agServer.fetchServerConfiguration(getDevId());
if (agServer.isConfigFailed()) { if (agServer.isConfigFailed()) {
ledSmHandler(APP_SM_WIFI_OK_SERVER_OK_SENSOR_CONFIG_FAILED); ledSmHandler(APP_SM_WIFI_OK_SERVER_OK_SENSOR_CONFIG_FAILED);
delay(DISPLAY_DELAY_SHOW_CONTENT_MS); delay(DISPLAY_DELAY_SHOW_CONTENT_MS);
@ -1139,8 +1139,8 @@ static void co2Update(void) {
Serial.printf("CO2 index: %d\r\n", co2Ppm); Serial.printf("CO2 index: %d\r\n", co2Ppm);
} }
static void serverConfigUpdate(void) { static void updateServerConfiguration(void) {
if (agServer.fetchServerConfigure(getDevId())) { if (agServer.fetchServerConfiguration(getDevId())) {
/** Only support CO2 S8 sensor on FW_MODE_PST */ /** Only support CO2 S8 sensor on FW_MODE_PST */
if (fw_mode == FW_MODE_PST) { if (fw_mode == FW_MODE_PST) {
if (agServer.isCo2Calib()) { if (agServer.isCo2Calib()) {