Skip to content

Commit 5d7a05c

Browse files
committed
Prepare handing over of sync callback via update function to be phased out
Currently the callback for a 'onSync' event is passed via update function. Since the signature of this sync function 'void(*fn)(void)' is not compatible with the cloud event sync function signature 'void(*fn)(void *)' it can not be registered via 'addCallback' as a normal cloud event sync function. Since the future way of adding callbacks is done via the 'addCallback' function we prepare the update functions in the wway shown in this commit for removing the capability of adding a sync callback function in the near future.
1 parent 3274a5b commit 5d7a05c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: src/ArduinoIoTCloud.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,16 @@ class ArduinoIoTCloudClass {
8383
int connect();
8484
bool disconnect();
8585

86-
void update(CallbackFunc onSyncCompleteCallback = NULL);
86+
inline void update() {
87+
update(NULL);
88+
}
89+
void update(CallbackFunc onSyncCompleteCallback) __attribute__((deprecated)); /* Attention: Function is deprecated - use 'addCallback(ArduinoIoTCloudConnectionEvent::SYNC, &onSync)' for adding a onSyncCallback instead */
8790

8891
// defined for users who want to specify max reconnections reties and timeout between them
89-
void update(int const reconnectionMaxRetries, int const reconnectionTimeoutMs, CallbackFunc onSyncCompleteCallback = NULL);
92+
inline void update(int const reconnectionMaxRetries, int const reconnectionTimeoutMs) {
93+
update(reconnectionMaxRetries, reconnectionTimeoutMs, NULL);
94+
}
95+
void update(int const reconnectionMaxRetries, int const reconnectionTimeoutMs, CallbackFunc onSyncCompleteCallback) __attribute__((deprecated)); /* Attention: Function is deprecated - use 'addCallback(ArduinoIoTCloudConnectionEvent::SYNC, &onSync)' for adding a onSyncCallback instead */
9096

9197
int connected();
9298
// Clean up existing Mqtt connection, create a new one and initialize it

0 commit comments

Comments
 (0)