version.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #pragma once
  2. #include <stdint.h>
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. typedef struct Version Version;
  7. /** Get current running firmware version handle.
  8. *
  9. * You can store it somewhere. But if you want to retrieve data, you have to use
  10. * 'version_*_get()' set of functions. Also, 'version_*_get()' imply to use this
  11. * handle if no handle (NULL_PTR) provided.
  12. *
  13. * @return pointer to Version data.
  14. */
  15. const Version* version_get(void);
  16. /** Get git commit hash.
  17. *
  18. * @param v pointer to Version data. NULL for currently running
  19. * software.
  20. *
  21. * @return git hash
  22. */
  23. const char* version_get_githash(const Version* v);
  24. /** Get git branch.
  25. *
  26. * @param v pointer to Version data. NULL for currently running
  27. * software.
  28. *
  29. * @return git branch
  30. */
  31. const char* version_get_gitbranch(const Version* v);
  32. /** Get number of commit in git branch.
  33. *
  34. * @param v pointer to Version data. NULL for currently running
  35. * software.
  36. *
  37. * @return number of commit
  38. */
  39. const char* version_get_gitbranchnum(const Version* v);
  40. /** Get build date.
  41. *
  42. * @param v pointer to Version data. NULL for currently running
  43. * software.
  44. *
  45. * @return build date
  46. */
  47. const char* version_get_builddate(const Version* v);
  48. /** Get build version. Build version is last tag in git history.
  49. *
  50. * @param v pointer to Version data. NULL for currently running
  51. * software.
  52. *
  53. * @return build date
  54. */
  55. const char* version_get_version(const Version* v);
  56. /** Get hardware target this firmware was built for
  57. *
  58. * @param v pointer to Version data. NULL for currently running
  59. * software.
  60. *
  61. * @return build date
  62. */
  63. const uint8_t version_get_target(const Version* v);
  64. #ifdef __cplusplus
  65. }
  66. #endif