mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-16 14:46:04 +00:00
UpdateHub is an enterprise-grade solution which makes simple to remotely update all your embedded devices in the field. It handles all aspects related to sending Firmware Over-the-Air(FOTA) updates with maximum security and efficiency, while you focus in adding value to your product. Signed-off-by: Christian Tavares <christian.tavares@ossystems.com.br> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
30 lines
573 B
C
30 lines
573 B
C
/*
|
|
* Copyright (c) 2018 O.S.Systems
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#include "updatehub_device.h"
|
|
|
|
bool updatehub_get_device_identity(char *id, int id_max_len)
|
|
{
|
|
int i, id_len = 0, buf_len = 0;
|
|
char buf[3];
|
|
u8_t hwinfo_id[id_max_len];
|
|
size_t length;
|
|
|
|
length = hwinfo_get_device_id(hwinfo_id, sizeof(hwinfo_id) - 1);
|
|
if (length <= 0) {
|
|
return false;
|
|
}
|
|
|
|
memset(id, 0, id_max_len);
|
|
|
|
for (i = 0; i < length; i++) {
|
|
snprintk(buf, sizeof(buf), "%02x", hwinfo_id[i]);
|
|
id_len = strlen(id);
|
|
strncat(id, buf, id_max_len - id_len);
|
|
}
|
|
|
|
return true;
|
|
}
|