diff --git a/include/lsl/streaminfo.h b/include/lsl/streaminfo.h index 109fe1ac..b6428477 100644 --- a/include/lsl/streaminfo.h +++ b/include/lsl/streaminfo.h @@ -125,6 +125,14 @@ extern LIBLSL_C_API double lsl_get_created_at(lsl_streaminfo info); */ extern LIBLSL_C_API const char *lsl_get_uid(lsl_streaminfo info); +/** + * Reset the UID of the stream info to a new random value. + * + * This can be used to generate a UID if one doesn't exist. + * @return An immutable library-owned pointer to the new string value. @sa lsl_destroy_string() + */ +extern LIBLSL_C_API const char *lsl_reset_uid(lsl_streaminfo info); + /** * Session ID for the given stream. * diff --git a/src/lsl_streaminfo_c.cpp b/src/lsl_streaminfo_c.cpp index 968501bc..2493c711 100644 --- a/src/lsl_streaminfo_c.cpp +++ b/src/lsl_streaminfo_c.cpp @@ -49,6 +49,10 @@ LIBLSL_C_API const char *lsl_get_source_id(lsl_streaminfo info) { LIBLSL_C_API int32_t lsl_get_version(lsl_streaminfo info) { return info->version(); } LIBLSL_C_API double lsl_get_created_at(lsl_streaminfo info) { return info->created_at(); } LIBLSL_C_API const char *lsl_get_uid(lsl_streaminfo info) { return info->uid().c_str(); } +LIBLSL_C_API const char *lsl_reset_uid(lsl_streaminfo info) { + return info->reset_uid().c_str(); + +} LIBLSL_C_API const char *lsl_get_session_id(lsl_streaminfo info) { return info->session_id().c_str(); }