1 /*
2  * Copyright (c) 2020 Linumiz
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #include "hawkbit_device.h"
7 #include <string.h>
8 
hawkbit_get_device_identity(char * id,int id_max_len)9 bool hawkbit_get_device_identity(char *id, int id_max_len)
10 {
11 	uint8_t hwinfo_id[DEVICE_ID_BIN_MAX_SIZE];
12 	ssize_t length;
13 
14 	length = hwinfo_get_device_id(hwinfo_id, DEVICE_ID_BIN_MAX_SIZE);
15 	if (length <= 0) {
16 		return false;
17 	}
18 
19 	memset(id, 0, id_max_len);
20 	length = bin2hex(hwinfo_id, (size_t)length, id, id_max_len);
21 
22 	return length > 0;
23 }
24