flipper_file_i.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include <stdint.h>
  2. #include <storage/storage.h>
  3. struct FlipperFile {
  4. File* file;
  5. Storage* storage;
  6. };
  7. /**
  8. * Value write type callback
  9. */
  10. typedef bool (*flipper_file_cb)(File* file, const char* key, const void* data, uint16_t data_size);
  11. /**
  12. *
  13. * @param flipper_file
  14. * @param key
  15. * @param cb
  16. * @param cb_key
  17. * @param cb_data
  18. * @param cb_data_size
  19. * @return bool
  20. */
  21. bool flipper_file_delete_key_and_call(
  22. FlipperFile* flipper_file,
  23. const char* key,
  24. flipper_file_cb cb,
  25. const char* cb_key,
  26. const void* cb_data,
  27. const uint16_t cb_data_size);
  28. /**
  29. * Value types
  30. */
  31. typedef enum {
  32. FlipperFileValueHex,
  33. FlipperFileValueFloat,
  34. FlipperFileValueInt32,
  35. FlipperFileValueUint32,
  36. } FlipperFileValueType;
  37. /**
  38. * Internal write values function
  39. * @param file
  40. * @param key
  41. * @param _data
  42. * @param data_size
  43. * @param type
  44. * @return bool
  45. */
  46. bool flipper_file_write_internal(
  47. File* file,
  48. const char* key,
  49. const void* _data,
  50. const uint16_t data_size,
  51. FlipperFileValueType type);
  52. /**
  53. * Internal read values function
  54. * @param file
  55. * @param key
  56. * @param _data
  57. * @param data_size
  58. * @param type
  59. * @return bool
  60. */
  61. bool flipper_file_read_internal(
  62. File* file,
  63. const char* key,
  64. void* _data,
  65. const uint16_t data_size,
  66. FlipperFileValueType type);