2021-04-19 19:30:25 +03:00
|
|
|
#pragma once
|
|
|
|
|
2021-10-16 14:25:32 +03:00
|
|
|
#include <stdint.h>
|
2022-04-13 23:50:25 +03:00
|
|
|
#include <stdbool.h>
|
2022-08-14 05:34:54 +03:00
|
|
|
#include <stddef.h>
|
2021-10-16 14:25:32 +03:00
|
|
|
|
2021-04-19 19:30:25 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct Version Version;
|
|
|
|
|
2021-10-16 14:25:32 +03:00
|
|
|
/** Get current running firmware version handle.
|
|
|
|
*
|
|
|
|
* You can store it somewhere. But if you want to retrieve data, you have to use
|
|
|
|
* 'version_*_get()' set of functions. Also, 'version_*_get()' imply to use this
|
2021-04-19 19:30:25 +03:00
|
|
|
* handle if no handle (NULL_PTR) provided.
|
|
|
|
*
|
2021-10-16 14:25:32 +03:00
|
|
|
* @return pointer to Version data.
|
2021-04-19 19:30:25 +03:00
|
|
|
*/
|
|
|
|
const Version* version_get(void);
|
|
|
|
|
2021-10-16 14:25:32 +03:00
|
|
|
/** Get git commit hash.
|
2021-04-19 19:30:25 +03:00
|
|
|
*
|
2021-10-16 14:25:32 +03:00
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
|
|
|
*
|
|
|
|
* @return git hash
|
2021-04-19 19:30:25 +03:00
|
|
|
*/
|
|
|
|
const char* version_get_githash(const Version* v);
|
|
|
|
|
2021-10-16 14:25:32 +03:00
|
|
|
/** Get git branch.
|
|
|
|
*
|
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
2021-04-19 19:30:25 +03:00
|
|
|
*
|
2021-10-16 14:25:32 +03:00
|
|
|
* @return git branch
|
2021-04-19 19:30:25 +03:00
|
|
|
*/
|
|
|
|
const char* version_get_gitbranch(const Version* v);
|
|
|
|
|
2021-10-16 14:25:32 +03:00
|
|
|
/** Get number of commit in git branch.
|
2021-04-19 19:30:25 +03:00
|
|
|
*
|
2021-10-16 14:25:32 +03:00
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
|
|
|
*
|
|
|
|
* @return number of commit
|
2021-04-19 19:30:25 +03:00
|
|
|
*/
|
|
|
|
const char* version_get_gitbranchnum(const Version* v);
|
|
|
|
|
2021-10-16 14:25:32 +03:00
|
|
|
/** Get build date.
|
|
|
|
*
|
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
2021-04-19 19:30:25 +03:00
|
|
|
*
|
2021-10-16 14:25:32 +03:00
|
|
|
* @return build date
|
2021-04-19 19:30:25 +03:00
|
|
|
*/
|
|
|
|
const char* version_get_builddate(const Version* v);
|
|
|
|
|
2021-10-16 14:25:32 +03:00
|
|
|
/** Get build version. Build version is last tag in git history.
|
2021-04-19 19:30:25 +03:00
|
|
|
*
|
2021-10-16 14:25:32 +03:00
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
|
|
|
*
|
|
|
|
* @return build date
|
2021-04-19 19:30:25 +03:00
|
|
|
*/
|
|
|
|
const char* version_get_version(const Version* v);
|
|
|
|
|
2022-08-14 05:34:54 +03:00
|
|
|
/** Get custom flipper name if set in ENV
|
|
|
|
*
|
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
|
|
|
*
|
|
|
|
* @return custom name or NULL
|
|
|
|
*/
|
|
|
|
const char* version_get_custom_name(const Version* v);
|
|
|
|
|
2021-10-16 14:25:32 +03:00
|
|
|
/** Get hardware target this firmware was built for
|
|
|
|
*
|
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
2021-04-19 19:30:25 +03:00
|
|
|
*
|
2021-10-16 14:25:32 +03:00
|
|
|
* @return build date
|
2021-04-19 19:30:25 +03:00
|
|
|
*/
|
2022-04-13 23:50:25 +03:00
|
|
|
uint8_t version_get_target(const Version* v);
|
|
|
|
|
|
|
|
/** Get flag indicating if this build is "dirty" (source code had uncommited changes)
|
|
|
|
*
|
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
|
|
|
*
|
|
|
|
* @return build date
|
|
|
|
*/
|
|
|
|
bool version_get_dirty_flag(const Version* v);
|
2021-04-19 19:30:25 +03:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2022-05-06 16:37:10 +03:00
|
|
|
#endif
|