flipper_file_i.h 1.4 KB

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