Skip to content

Commit 22374a2

Browse files
committed
Revert constness for Interface. Does nto work because getters are non const in dependencies.
1 parent 2ab16e3 commit 22374a2

10 files changed

Lines changed: 48 additions & 36 deletions

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,11 +530,11 @@ class Custom_HTTP_Client : public IHTTP_Client {
530530
}
531531
532532
#if THINGSBOARD_ENABLE_STL
533-
std::string get_response_body() const override {
533+
std::string get_response_body() override {
534534
return std::string();
535535
}
536536
#else
537-
String get_response_body() const override {
537+
String get_response_body() override {
538538
return String();
539539
}
540540
@@ -587,11 +587,11 @@ class Custom_MQTT_Client : public IMQTT_Client {
587587
return true;
588588
}
589589
590-
uint16_t get_receive_buffer_size() const override {
590+
uint16_t get_receive_buffer_size() override {
591591
return 0U;
592592
}
593593
594-
uint16_t get_send_buffer_size() const override {
594+
uint16_t get_send_buffer_size() override {
595595
return 0U;
596596
}
597597

src/Arduino_HTTP_Client.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ int Arduino_HTTP_Client::get(char const * url_path) {
3636
}
3737

3838
#if THINGSBOARD_ENABLE_STL
39-
std::string Arduino_HTTP_Client::get_response_body() const {
39+
std::string Arduino_HTTP_Client::get_response_body() {
4040
return m_http_client.responseBody().c_str();
4141
#else
42-
String Arduino_HTTP_Client::get_response_body() const {
42+
String Arduino_HTTP_Client::get_response_body() {
4343
return m_http_client.responseBody();
4444
#endif // THINGSBOARD_ENABLE_STL
4545
}

src/Arduino_HTTP_Client.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ class Arduino_HTTP_Client : public IHTTP_Client {
3939
int get(char const * url_path) override;
4040

4141
#if THINGSBOARD_ENABLE_STL
42-
std::string get_response_body() const override;
42+
std::string get_response_body() override;
4343
#else
44-
String get_response_body() const override;
44+
String get_response_body() override;
4545
#endif // THINGSBOARD_ENABLE_STL
4646

4747
private:

src/Arduino_MQTT_Client.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ bool Arduino_MQTT_Client::set_buffer_size(uint16_t receive_buffer_size, uint16_t
2626
return m_mqtt_client.setBufferSize(receive_buffer_size, send_buffer_size);
2727
}
2828

29-
uint16_t Arduino_MQTT_Client::get_receive_buffer_size() const {
29+
uint16_t Arduino_MQTT_Client::get_receive_buffer_size() {
3030
return m_mqtt_client.getReceiveBufferSize();
3131
}
3232

33-
uint16_t Arduino_MQTT_Client::get_send_buffer_size() const {
33+
uint16_t Arduino_MQTT_Client::get_send_buffer_size() {
3434
return m_mqtt_client.getSendBufferSize();
3535
}
3636

src/Arduino_MQTT_Client.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ class Arduino_MQTT_Client : public IMQTT_Client {
4141

4242
bool set_buffer_size(uint16_t receive_buffer_size, uint16_t send_buffer_size) override;
4343

44-
uint16_t get_receive_buffer_size() const override;
44+
uint16_t get_receive_buffer_size() override;
4545

46-
uint16_t get_send_buffer_size() const override;
46+
uint16_t get_send_buffer_size() override;
4747

4848
void set_server(char const * domain, uint16_t port) override;
4949

src/Attribute_Request_Callback.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class Attribute_Request_Callback : public Callback<void, JsonObjectConst const &
132132
}
133133

134134
/// @brief Sets the amount of microseconds until we expect to have received a response
135-
/// @note The default value of 0, means the timeout timer is never started and therefore the timeout callback never called
135+
/// @note The value of 0, means the timeout timer is never started and therefore the timeout callback never called
136136
/// @param timeout_microseconds Timeout time until timeout callback is called
137137
void Set_Timeout(uint64_t const & timeout_microseconds) {
138138
m_timeout_microseconds = timeout_microseconds;
@@ -156,7 +156,7 @@ class Attribute_Request_Callback : public Callback<void, JsonObjectConst const &
156156
}
157157

158158
/// @brief Stops the internal timeout timer, is called as soon as an answer is received from the cloud.
159-
/// If this method is not called in time the initally subscribed callback will be used to inform the user of the timeout instead.
159+
/// If this method is not called in time the initally subscribed callback will be used to inform the user of the timeout instead
160160
/// @note Is not mean to be called explicitly by the user, because it is instead called when necessary by internal methods that handle the class instance
161161
void Stop_Timeout_Timer() {
162162
m_timeout_callback.detach();

src/Espressif_MQTT_Client.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,15 @@ class Espressif_MQTT_Client : public IMQTT_Client {
228228
return update_configuration();
229229
}
230230

231-
uint16_t get_receive_buffer_size() const override {
231+
uint16_t get_receive_buffer_size() override {
232232
#if ESP_IDF_VERSION_MAJOR < 5
233233
return m_mqtt_configuration.buffer_size;
234234
#else
235235
return m_mqtt_configuration.buffer.size;
236236
#endif // ESP_IDF_VERSION_MAJOR < 5
237237
}
238238

239-
uint16_t get_send_buffer_size() const override {
239+
uint16_t get_send_buffer_size() override {
240240
#if ESP_IDF_VERSION_MAJOR < 5
241241
return m_mqtt_configuration.out_buffer_size;
242242
#else

src/IHTTP_Client.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ class IHTTP_Client {
6969
/// should be called after calling get_response_status_code() and ensuring the request was successful
7070
/// @return Response body of a request
7171
#if THINGSBOARD_ENABLE_STL
72-
virtual std::string get_response_body() const = 0;
72+
virtual std::string get_response_body() = 0;
7373
#else
74-
virtual String get_response_body() const = 0;
74+
virtual String get_response_body() = 0;
7575
#endif // THINGSBOARD_ENABLE_STL
7676
};
7777

src/IMQTT_Client.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ class IMQTT_Client {
6464

6565
/// @brief Gets the previously set size of the internal buffer size meant for incoming MQTT data
6666
/// @return Internal size of the buffer
67-
virtual uint16_t get_receive_buffer_size() const = 0;
67+
virtual uint16_t get_receive_buffer_size() = 0;
6868

6969
/// @brief Gets the previously set size of the internal buffer size meant for outgoing MQTT data
7070
/// @return Internal size of the buffer
71-
virtual uint16_t get_send_buffer_size() const = 0;
71+
virtual uint16_t get_send_buffer_size() = 0;
7272

7373
/// @brief Configures the server and port that the client should connect with over MQTT
7474
/// @note Should be called atleast once before calling connect() so the target server and port to connect too have been configured

src/Provision_Callback.h

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -112,47 +112,57 @@ class Provision_Callback : public Callback<void, JsonDocument const &> {
112112
void Set_Device_Access_Token(char const * access_token);
113113

114114
/// @brief Gets the basic MQTT credentials username, that will be used by the provisioned device
115-
/// @return Basic MQTT credentials username
115+
/// @return Non owning pointer to the basic MQTT credentials username.
116+
/// Owned by the user that passed it originally in the constructor or with the @ref Set_Credentials_Username method
116117
char const * Get_Credentials_Username() const;
117118

118119
/// @brief Sets the basic MQTT credentials username, that will be used by the provisioned device
119-
/// @param username Basic MQTT credentials username
120+
/// @param username Non owning pointer to the basic MQTT credentials username.
121+
/// Additionally it has to be kept alive by the user until the @ref Provision_Request method has been called with this instance as the argument, because that method copies the data into the outgoing MQTT buffer to create the provision request
120122
void Set_Credentials_Username(char const * username);
121123

122124
/// @brief Gets the basic MQTT credentials password, that will be used by the provisioned device
123-
/// @return Basic MQTT credentials password
125+
/// @return Non owning pointer to the basic MQTT credentials password
126+
/// Owned by the user that passed it originally in the constructor or with the @ref Set_Credentials_Password method
124127
char const * Get_Credentials_Password() const;
125128

126129
/// @brief Sets the basic MQTT credentials password, that will be used by the provisioned device
127-
/// @param password Basic MQTT credentials password
130+
/// @param password Non owning pointer to the basic MQTT credentials password.
131+
/// Additionally it has to be kept alive by the user until the @ref Provision_Request method has been called with this instance as the argument, because that method copies the data into the outgoing MQTT buffer to create the provision request
128132
void Set_Credentials_Password(char const * password);
129133

130-
/// @brief Gets the basic MQTT credentials client_id, that will be used by the provisioned device
131-
/// @return Basic MQTT credentials client_id
134+
/// @brief Gets the basic MQTT credentials client ID, that will be used by the provisioned device
135+
/// @return Non owning pointer to the basic MQTT credentials client ID.
136+
/// Owned by the user that passed it originally in the constructor or with the @ref Set_Credentials_Client_ID method
132137
char const * Get_Credentials_Client_ID() const;
133138

134-
/// @brief Sets the basic MQTT credentials client_id, that will be used by the provisioned device
135-
/// @param client_id Basic MQTT credentials client_id
139+
/// @brief Sets the basic MQTT credentials client ID, that will be used by the provisioned device
140+
/// @param client_id Non owning pointer to the basic MQTT credentials client ID.
141+
/// Additionally it has to be kept alive by the user until the @ref Provision_Request method has been called with this instance as the argument, because that method copies the data into the outgoing MQTT buffer to create the provision request
136142
void Set_Credentials_Client_ID(char const * client_id);
137143

138144
/// @brief Gets the public X.509 certificate hash, that will be used by the provisioned device
139-
/// @return Public X.509 certificate hash
145+
/// @return Non owning pointer to the public X.509 certificate hash.
146+
/// Owned by the user that passed it originally in the constructor or with the @ref Set_Certificate_Hash method
140147
char const * Get_Certificate_Hash() const;
141148

142149
/// @brief Sets the public X.509 certificate hash, that will be used by the provisioned device
143-
/// @param hash Public X.509 certificate hash
150+
/// @param hash Non owning pointer to the public X.509 certificate hash.
151+
/// Additionally it has to be kept alive by the user until the @ref Provision_Request method has been called with this instance as the argument, because that method copies the data into the outgoing MQTT buffer to create the provision request
144152
void Set_Certificate_Hash(char const * hash);
145153

146154
/// @brief Gets the string containing the used credentials type that decides which provisioning method is actually used,
147-
/// by the Provision_Callback and therefore decides what response we will receive from the server
148-
/// @return String containing the used credentials type
155+
/// by the @ref Provision_Callback and therefore decides what response we will receive from the server
156+
/// @return Owning pointer to th string containing the used credentials type.
157+
/// Simply points to a compile time string constant saved into static memory
149158
char const * Get_Credentials_Type() const;
150159

151160
/// @brief Gets the amount of microseconds until we expect to have received a response
152161
/// @return Timeout time until timeout callback is called
153162
uint64_t const & Get_Timeout() const;
154163

155164
/// @brief Sets the amount of microseconds until we expect to have received a response
165+
/// @note The value of 0, means the timeout timer is never started and therefore the timeout callback never called
156166
/// @param timeout_microseconds Timeout time until timeout callback is called
157167
void Set_Timeout(uint64_t const & timeout_microseconds);
158168

@@ -162,14 +172,16 @@ class Provision_Callback : public Callback<void, JsonDocument const &> {
162172
#endif // !THINGSBOARD_USE_ESP_TIMER
163173

164174
/// @brief Starts the internal timeout timer if we actually received a configured valid timeout time and a valid callback.
165-
/// Is called as soon as the request is actually sent
175+
/// @note The timeout time is valid if it is not 0 and the callback is valid if it is not a nullptr.
176+
/// Is not mean to be called explicitly by the user, because it is instead called when necessary by internal methods that handle the class instance
166177
void Start_Timeout_Timer();
167178

168-
/// @brief Stops the internal timeout timer, is called as soon as an answer is received from the cloud
169-
/// if it isn't we call the previously subscribed callback instead
179+
/// @brief Stops the internal timeout timer, is called as soon as an answer is received from the cloud.
180+
/// If this method is not called in time the initally subscribed callback will be used to inform the user of the timeout instead
181+
/// @note Is not mean to be called explicitly by the user, because it is instead called when necessary by internal methods that handle the class instance
170182
void Stop_Timeout_Timer();
171183

172-
/// @brief Sets the callback method that will be called upon request timeout (did not receive a response in the given timeout time)
184+
/// @brief Sets the callback method that will be called upon request timeout (did not receive a response from the cloud in the given timeout time)
173185
/// @param timeout_callback Callback function that will be called
174186
void Set_Timeout_Callback(Callback_Watchdog::function timeout_callback);
175187

0 commit comments

Comments
 (0)