Skip to content

Commit c602cea

Browse files
committed
Initialize client library before resource creation
Device Management client 4.4.0 release has a bug concerning resource initializion (specifically factory reset/device resources) which has a dependency to timers. Initializing client before resource generators ensures that also timers have been initialized.
1 parent 876ca5d commit c602cea

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

main.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@ int main(void)
200200
return -1;
201201
}
202202

203+
#ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE
204+
cloud_client = new MbedCloudClient(client_registered, client_unregistered, client_error, NULL, update_progress);
205+
#else
206+
cloud_client = new MbedCloudClient(client_registered, client_unregistered, client_error);
207+
#endif // MBED_CLOUD_CLIENT_SUPPORT_UPDATE
208+
209+
// Initialize client
210+
cloud_client->init();
211+
203212
printf("Create resources\n");
204213
M2MObjectList m2m_obj_list;
205214

@@ -252,12 +261,6 @@ int main(void)
252261

253262
printf("Register Pelion Device Management Client\n\n");
254263

255-
#ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE
256-
cloud_client = new MbedCloudClient(client_registered, client_unregistered, client_error, NULL, update_progress);
257-
#else
258-
cloud_client = new MbedCloudClient(client_registered, client_unregistered, client_error);
259-
#endif // MBED_CLOUD_CLIENT_SUPPORT_UPDATE
260-
261264
cloud_client->on_registration_updated(client_registration_updated);
262265

263266
cloud_client->add_objects(m2m_obj_list);

0 commit comments

Comments
 (0)