flip_store_apps.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef FLIP_STORE_APPS_H
  2. #define FLIP_STORE_APPS_H
  3. #include <flip_downloader.h>
  4. #include <flip_storage/flip_store_storage.h>
  5. #include <callback/flip_store_callback.h>
  6. // Define maximum limits
  7. #define MAX_APP_NAME_LENGTH 32
  8. #define MAX_ID_LENGTH 32
  9. #define MAX_APP_COUNT 50
  10. #define MAX_APP_DESCRIPTION_LENGTH 100
  11. #define MAX_APP_VERSION_LENGTH 5
  12. #define MAX_RECEIVED_APPS 4
  13. // define the list of categories
  14. extern char *category_ids[];
  15. extern char *categories[];
  16. extern int catalog_iteration;
  17. typedef struct
  18. {
  19. char app_name[MAX_APP_NAME_LENGTH];
  20. char app_id[MAX_APP_NAME_LENGTH];
  21. char app_build_id[MAX_ID_LENGTH];
  22. char app_version[MAX_APP_VERSION_LENGTH];
  23. char app_description[MAX_APP_DESCRIPTION_LENGTH];
  24. size_t count;
  25. int iteration;
  26. } FlipStoreAppInfo;
  27. extern FlipStoreAppInfo *flip_catalog;
  28. extern uint32_t app_selected_index;
  29. extern uint32_t flip_store_category_index;
  30. enum ObjectState
  31. {
  32. OBJECT_EXPECT_KEY,
  33. OBJECT_EXPECT_COLON,
  34. OBJECT_EXPECT_VALUE,
  35. OBJECT_EXPECT_COMMA_OR_END
  36. };
  37. FlipStoreAppInfo *flip_catalog_alloc();
  38. void flip_catalog_free();
  39. // Utility function to parse JSON incrementally from a file
  40. bool flip_store_process_app_list(FlipperHTTP *fhttp);
  41. // function to handle the entire installation process "asynchronously"
  42. bool flip_store_install_app(FlipperHTTP *fhttp, char *category);
  43. #endif // FLIP_STORE_APPS_H