This commit changes how the controllerId is generated based on device id, and disentangles the two. The controllerId is what hawkbit uses to uniquely identify a device, and is not necessarily the same as the device id, and should be fully customizeable by the user if needed. Previously, all custom device ids were being prepended with `CONFIG_BOARD`. When a user selects `CONFIG_HAWKBIT_CUSTOM_DEVICE_ID`, they should be able to specify the full controllerId used with hawkbit, without a forced prepend. Signed-off-by: Neal Jackson <neal@blueirislabs.com>
24 lines
619 B
C
24 lines
619 B
C
/*
|
|
* Copyright (c) 2020 Linumiz
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef __HAWKBIT_DEVICE_H__
|
|
#define __HAWKBIT_DEVICE_H__
|
|
|
|
#include <zephyr/kernel.h>
|
|
#include <zephyr/drivers/hwinfo.h>
|
|
|
|
#ifdef CONFIG_HAWKBIT_CUSTOM_DEVICE_ID
|
|
#define DEVICE_ID_BIN_MAX_SIZE (CONFIG_HAWKBIT_DEVICE_ID_MAX_LENGTH / 2)
|
|
#define DEVICE_ID_HEX_MAX_SIZE (CONFIG_HAWKBIT_DEVICE_ID_MAX_LENGTH + 1)
|
|
#else
|
|
#define DEVICE_ID_BIN_MAX_SIZE 16
|
|
#define DEVICE_ID_HEX_MAX_SIZE (sizeof(CONFIG_BOARD) + (DEVICE_ID_BIN_MAX_SIZE * 2) + 1)
|
|
#endif
|
|
|
|
bool hawkbit_get_device_identity(char *id, int id_max_len);
|
|
|
|
#endif /* __HAWKBIT_DEVICE_H__ */
|