From e16373a64d3cc6ee0858cd5e2f76d2ffd9894664 Mon Sep 17 00:00:00 2001 From: samuelbles07 Date: Wed, 11 Sep 2024 16:02:13 +0700 Subject: [PATCH] Add new public member to set http client timeout by caller --- src/AgApiClient.cpp | 9 +++++++++ src/AgApiClient.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/AgApiClient.cpp b/src/AgApiClient.cpp index 8af3004..5b9bdb6 100644 --- a/src/AgApiClient.cpp +++ b/src/AgApiClient.cpp @@ -184,6 +184,15 @@ String AgApiClient::getApiRoot() const { return apiRoot; } void AgApiClient::setApiRoot(const String &apiRoot) { this->apiRoot = apiRoot; } +/** + * @brief Set http request timeout. (Default: 10s) + * + * @param timeoutMs + */ +void AgApiClient::setTimeout(uint16_t timeoutMs) { + this->timeoutMs = timeoutMs; +} + /** * @brief Set timeout to both connect to server and tcp connection timeout * diff --git a/src/AgApiClient.h b/src/AgApiClient.h index 8027d04..1c13100 100644 --- a/src/AgApiClient.h +++ b/src/AgApiClient.h @@ -51,6 +51,7 @@ public: bool sendPing(int rssi, int bootCount); String getApiRoot() const; void setApiRoot(const String &apiRoot); + void setTimeout(uint16_t timeoutMs); }; #endif /** _AG_API_CLIENT_H_ */