application_manifest.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * @file application_manifest.h
  3. * Flipper application manifest
  4. */
  5. #pragma once
  6. #include <stdint.h>
  7. #include <stdbool.h>
  8. #include "elf/elf_api_interface.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #define FAP_MANIFEST_MAGIC 0x52474448
  13. #define FAP_MANIFEST_SUPPORTED_VERSION 1
  14. #define FAP_MANIFEST_MAX_APP_NAME_LENGTH 32
  15. #define FAP_MANIFEST_MAX_ICON_SIZE 32 // TODO: reduce size?
  16. #pragma pack(push, 1)
  17. typedef struct {
  18. uint32_t manifest_magic;
  19. uint32_t manifest_version;
  20. union {
  21. struct {
  22. uint16_t minor;
  23. uint16_t major;
  24. };
  25. uint32_t version;
  26. } api_version;
  27. uint16_t hardware_target_id;
  28. } FlipperApplicationManifestBase;
  29. typedef struct {
  30. FlipperApplicationManifestBase base;
  31. uint16_t stack_size;
  32. uint32_t app_version;
  33. char name[FAP_MANIFEST_MAX_APP_NAME_LENGTH];
  34. char has_icon;
  35. char icon[FAP_MANIFEST_MAX_ICON_SIZE];
  36. } FlipperApplicationManifestV1;
  37. typedef FlipperApplicationManifestV1 FlipperApplicationManifest;
  38. #pragma pack(pop)
  39. /**
  40. * @brief Check if manifest is valid
  41. *
  42. * @param manifest
  43. * @return bool
  44. */
  45. bool flipper_application_manifest_is_valid(const FlipperApplicationManifest* manifest);
  46. /**
  47. * @brief Check if manifest is compatible with current ELF API interface
  48. *
  49. * @param manifest
  50. * @param api_interface
  51. * @return bool
  52. */
  53. bool flipper_application_manifest_is_compatible(
  54. const FlipperApplicationManifest* manifest,
  55. const ElfApiInterface* api_interface);
  56. #ifdef __cplusplus
  57. }
  58. #endif