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>
|
2022-08-14 02:34:54 +00:00
|
|
|
#include <stddef.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);
|
|
|
|
|
2023-05-14 02:38:00 +00:00
|
|
|
/** Get custom flipper name if set in version_set_custom_name
|
2022-08-14 02:34:54 +00:00
|
|
|
*
|
|
|
|
* @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);
|
|
|
|
|
2023-05-14 02:38:00 +00:00
|
|
|
/** Set custom flipper name
|
|
|
|
*
|
|
|
|
* @param v pointer to Version data. NULL for currently running
|
|
|
|
* software.
|
|
|
|
* @param name Custom name or NULL
|
|
|
|
*/
|
|
|
|
void version_set_custom_name(Version* v, const char* name);
|
|
|
|
|
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
|