|
22 | 22 | #include "storage_usage.h" |
23 | 23 | #include "system_info.h" |
24 | 24 | #include "system_status.h" |
25 | | -#include "uuid.h" |
26 | 25 | #include "wifi_scan.h" |
27 | 26 |
|
28 | 27 | #include <stdlib.h> |
29 | 28 |
|
30 | 29 | #include <zephyr/kernel.h> |
31 | 30 | #include <zephyr/sys/util.h> |
| 31 | +#include <zephyr/sys/uuid.h> |
32 | 32 |
|
33 | 33 | #include <astarte_device_sdk/device.h> |
34 | 34 | #include <astarte_device_sdk/interface.h> |
@@ -292,10 +292,16 @@ edgehog_result_t edgehog_device_new( |
292 | 292 | } |
293 | 293 |
|
294 | 294 | // Step 5: Initialize the Edgehog device boot ID |
295 | | - char boot_id[UUID_STR_LEN + 1] = { 0 }; |
296 | | - eres = uuid_generate_v4_string(boot_id); |
297 | | - if (eres != EDGEHOG_RESULT_OK) { |
298 | | - EDGEHOG_LOG_ERR("Unable to generate edgehog boot id"); |
| 295 | + struct uuid boot_id = { 0 }; |
| 296 | + char boot_id_str[UUID_STR_LEN] = { 0 }; |
| 297 | + int res = uuid_generate_v4(&boot_id); |
| 298 | + if (res != 0) { |
| 299 | + EDGEHOG_LOG_ERR("Unable to generate Edgehog boot ID"); |
| 300 | + goto failure; |
| 301 | + } |
| 302 | + res = uuid_to_string(&boot_id, boot_id_str); |
| 303 | + if (res != 0) { |
| 304 | + EDGEHOG_LOG_ERR("Unable to generate Edgehog boot ID"); |
299 | 305 | goto failure; |
300 | 306 | } |
301 | 307 |
|
@@ -338,7 +344,7 @@ edgehog_result_t edgehog_device_new( |
338 | 344 |
|
339 | 345 | k_sem_init(&edgehog_device->sync_ota_ft_sem, 1, 1); |
340 | 346 |
|
341 | | - memcpy(edgehog_device->boot_id, boot_id, UUID_STR_LEN + 1); |
| 347 | + memcpy(edgehog_device->boot_id, boot_id_str, UUID_STR_LEN); |
342 | 348 | *edgehog_handle = edgehog_device; |
343 | 349 |
|
344 | 350 | // Step 8: Initialize the WiFi scan driver |
|
0 commit comments