Astarte device API for Zephyr 0.7.2
Astarte device SDK for Zephyr RTOS
Loading...
Searching...
No Matches

Functions for the generation of Astarte device identifiers. More...

Macros

#define ASTARTE_DEVICE_ID_LEN   22
 Number of characters in the string version of an Astarte device ID.
 
#define ASTARTE_DEVICE_ID_NAMESPACE_SIZE   16
 Size in bytes for the namespace used to generate a deterministic device IDs.
 

Functions

astarte_result_t astarte_device_id_generate_random (char out[static ASTARTE_DEVICE_ID_LEN+1])
 Generate a random Astarte device ID.
 
astarte_result_t astarte_device_id_generate_deterministic (const uint8_t namespace[static ASTARTE_DEVICE_ID_NAMESPACE_SIZE], const uint8_t *name, size_t name_size, char out[static ASTARTE_DEVICE_ID_LEN+1])
 Generate a deterministic Astarte device ID.
 

Detailed Description

Functions for the generation of Astarte device identifiers.

Macro Definition Documentation

◆ ASTARTE_DEVICE_ID_LEN

#define ASTARTE_DEVICE_ID_LEN   22

Number of characters in the string version of an Astarte device ID.

The Astarte device IDs are 128 bit identifiers. Their string representation is a base 64 (RFC 4648 sec. 5) URL and filename safe encoding.

◆ ASTARTE_DEVICE_ID_NAMESPACE_SIZE

#define ASTARTE_DEVICE_ID_NAMESPACE_SIZE   16

Size in bytes for the namespace used to generate a deterministic device IDs.

Function Documentation

◆ astarte_device_id_generate_deterministic()

astarte_result_t astarte_device_id_generate_deterministic ( const uint8_t namespace[static ASTARTE_DEVICE_ID_NAMESPACE_SIZE],
const uint8_t * name,
size_t name_size,
char out[static ASTARTE_DEVICE_ID_LEN+1] )

Generate a deterministic Astarte device ID.

The Astarte device ID will be generated using an UUIDv5. An UUIDv5 is created hasing a namespace and name. The namespace is an UUID itself (of any version).

Parameters
[in]namespaceThe namespace used to generate the device ID.
[in]nameThe name used to generate the device ID.
[in]name_sizeThe size of the name buffer.
[out]outA buffer where the result will be written.
Returns
ASTARTE_RESULT_OK if successful, otherwise an error code.

◆ astarte_device_id_generate_random()

astarte_result_t astarte_device_id_generate_random ( char out[static ASTARTE_DEVICE_ID_LEN+1])

Generate a random Astarte device ID.

The Astarte device ID will be generated using an UUIDv4.

Parameters
[out]outA buffer where the result will be written.
Returns
ASTARTE_RESULT_OK if successful, otherwise an error code.