2021-04-19 16:30:25 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-10-16 11:25:32 +00:00
|
|
|
#include <stdint.h>
|
2022-04-13 20:50:25 +00:00
|
|
|
#include <stdbool.h>
|
2021-10-16 11:25:32 +00:00
|
|
|
|
2021-04-19 16:30:25 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct Version Version;
|
|
|
|
|
2021-10-16 11:25:32 +00: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 16:30:25 +00:00
|
|
|
* handle if no handle (NULL_PTR) provided.
|
|
|
|
*
|
2021-10-16 11:25:32 +00:00
|
|
|
* @return pointer to Version data.
|
2021-04-19 16:30:25 +00:00
|
|
|
*/
|
|
|
|
const Version* version_get(void);
|
|
|
|
|
2021-10-16 11:25:32 +00:00
|
|
|
/** Get git commit hash.
|
2021-04-19 16:30:25 +00:00
|
|
|
*
|
2021-10-16 11:25:32 +00:00
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
|
|
|
*
|
|
|
|
* @return git hash
|
2021-04-19 16:30:25 +00:00
|
|
|
*/
|
|
|
|
const char* version_get_githash(const Version* v);
|
|
|
|
|
2021-10-16 11:25:32 +00:00
|
|
|
/** Get git branch.
|
|
|
|
*
|
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
2021-04-19 16:30:25 +00:00
|
|
|
*
|
2021-10-16 11:25:32 +00:00
|
|
|
* @return git branch
|
2021-04-19 16:30:25 +00:00
|
|
|
*/
|
|
|
|
const char* version_get_gitbranch(const Version* v);
|
|
|
|
|
2021-10-16 11:25:32 +00:00
|
|
|
/** Get number of commit in git branch.
|
2021-04-19 16:30:25 +00:00
|
|
|
*
|
2021-10-16 11:25:32 +00:00
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
|
|
|
*
|
|
|
|
* @return number of commit
|
2021-04-19 16:30:25 +00:00
|
|
|
*/
|
|
|
|
const char* version_get_gitbranchnum(const Version* v);
|
|
|
|
|
2021-10-16 11:25:32 +00:00
|
|
|
/** Get build date.
|
|
|
|
*
|
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
2021-04-19 16:30:25 +00:00
|
|
|
*
|
2021-10-16 11:25:32 +00:00
|
|
|
* @return build date
|
2021-04-19 16:30:25 +00:00
|
|
|
*/
|
|
|
|
const char* version_get_builddate(const Version* v);
|
|
|
|
|
2021-10-16 11:25:32 +00:00
|
|
|
/** Get build version. Build version is last tag in git history.
|
2021-04-19 16:30:25 +00:00
|
|
|
*
|
2021-10-16 11:25:32 +00:00
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
|
|
|
*
|
|
|
|
* @return build date
|
2021-04-19 16:30:25 +00:00
|
|
|
*/
|
|
|
|
const char* version_get_version(const Version* v);
|
|
|
|
|
2021-10-16 11:25:32 +00:00
|
|
|
/** Get hardware target this firmware was built for
|
|
|
|
*
|
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
2021-04-19 16:30:25 +00:00
|
|
|
*
|
2021-10-16 11:25:32 +00:00
|
|
|
* @return build date
|
2021-04-19 16:30:25 +00:00
|
|
|
*/
|
2022-04-13 20:50:25 +00: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 16:30:25 +00:00
|
|
|
|
2023-05-29 16:40:56 +00:00
|
|
|
/**
|
|
|
|
* Get firmware origin. "Official" for mainline firmware, fork name for forks.
|
|
|
|
* Set by FIRMWARE_ORIGIN fbt argument.
|
|
|
|
*/
|
|
|
|
const char* version_get_firmware_origin(const Version* v);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get git repo origin
|
|
|
|
*/
|
|
|
|
const char* version_get_git_origin(const Version* v);
|
|
|
|
|
2021-04-19 16:30:25 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2022-05-06 13:37:10 +00:00
|
|
|
#endif
|