Skip to content

Commit 00a2f6b

Browse files
committed
Initialize _get_ota_confirmation within constructor and chage type name
1 parent 6e9113c commit 00a2f6b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/ArduinoIoTCloudTCP.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ ArduinoIoTCloudTCP::ArduinoIoTCloudTCP()
9696
, _ota_url{""}
9797
, _ota_req{false}
9898
, _ask_user_before_executing_ota{false}
99+
, _get_ota_confirmation{nullptr}
99100
#endif /* OTA_ENABLED */
100101
{
101102

src/ArduinoIoTCloudTCP.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ static uint16_t const DEFAULT_BROKER_PORT_SECURE_AUTH = 8883;
4949
static char const DEFAULT_BROKER_ADDRESS_USER_PASS_AUTH[] = "mqtts-up.iot.arduino.cc";
5050
static uint16_t const DEFAULT_BROKER_PORT_USER_PASS_AUTH = 8884;
5151

52-
typedef bool (*otaConfirmationStatus)(void);
52+
/******************************************************************************
53+
* TYPEDEF
54+
******************************************************************************/
55+
56+
typedef bool (*onOTARequestCallbackFunc)(void);
5357

5458
/******************************************************************************
5559
* CLASS DECLARATION
@@ -87,7 +91,7 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
8791
* It should return true when the OTA can be applied or false otherwise.
8892
* See example ArduinoIoTCloud-DeferredOTA.ino
8993
*/
90-
void onOTARequestCb(otaConfirmationStatus cb) {
94+
void onOTARequestCb(onOTARequestCallbackFunc cb) {
9195
_get_ota_confirmation = cb;
9296
_ask_user_before_executing_ota = true;
9397
}
@@ -143,6 +147,7 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
143147
String _ota_url;
144148
bool _ota_req;
145149
bool _ask_user_before_executing_ota;
150+
onOTARequestCallbackFunc _get_ota_confirmation;
146151
#endif /* OTA_ENABLED */
147152

148153
inline String getTopic_shadowout() { return ( getThingId().length() == 0) ? String("") : String("/a/t/" + getThingId() + "/shadow/o"); }
@@ -167,7 +172,6 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
167172
void onOTARequest();
168173
#endif
169174

170-
otaConfirmationStatus _get_ota_confirmation = {nullptr};
171175
};
172176

173177
/******************************************************************************

0 commit comments

Comments
 (0)