Skip to content

Commit

Permalink
Prepare handing over of sync callback via update function to be phase…
Browse files Browse the repository at this point in the history
…d 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.
  • Loading branch information
aentinger committed Apr 17, 2019
1 parent 3274a5b commit 5d7a05c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ArduinoIoTCloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,16 @@ class ArduinoIoTCloudClass {
int connect();
bool disconnect();

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

// defined for users who want to specify max reconnections reties and timeout between them
void update(int const reconnectionMaxRetries, int const reconnectionTimeoutMs, CallbackFunc onSyncCompleteCallback = NULL);
inline void update(int const reconnectionMaxRetries, int const reconnectionTimeoutMs) {
update(reconnectionMaxRetries, reconnectionTimeoutMs, NULL);
}
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 */

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

0 comments on commit 5d7a05c

Please sign in to comment.