lfrfid_raw_file.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #pragma once
  2. #include <furi.h>
  3. #include <storage/storage.h>
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. typedef struct LFRFIDRawFile LFRFIDRawFile;
  8. /**
  9. * @brief Allocate a new LFRFIDRawFile instance
  10. *
  11. * @param storage
  12. * @return LFRFIDRawFile*
  13. */
  14. LFRFIDRawFile* lfrfid_raw_file_alloc(Storage* storage);
  15. /**
  16. * @brief Free a LFRFIDRawFile instance
  17. *
  18. * @param file
  19. */
  20. void lfrfid_raw_file_free(LFRFIDRawFile* file);
  21. /**
  22. * @brief Open RAW file for writing
  23. *
  24. * @param file
  25. * @param file_path
  26. * @return bool
  27. */
  28. bool lfrfid_raw_file_open_write(LFRFIDRawFile* file, const char* file_path);
  29. /**
  30. * @brief Open RAW file for reading
  31. * @param file
  32. * @param file_path
  33. * @return bool
  34. */
  35. bool lfrfid_raw_file_open_read(LFRFIDRawFile* file, const char* file_path);
  36. /**
  37. * @brief Write RAW file header
  38. *
  39. * @param file
  40. * @param frequency
  41. * @param duty_cycle
  42. * @param max_buffer_size
  43. * @return bool
  44. */
  45. bool lfrfid_raw_file_write_header(
  46. LFRFIDRawFile* file,
  47. float frequency,
  48. float duty_cycle,
  49. uint32_t max_buffer_size);
  50. /**
  51. * @brief Write data to RAW file
  52. *
  53. * @param file
  54. * @param buffer_data
  55. * @param buffer_size
  56. * @return bool
  57. */
  58. bool lfrfid_raw_file_write_buffer(LFRFIDRawFile* file, uint8_t* buffer_data, size_t buffer_size);
  59. /**
  60. * @brief Read RAW file header
  61. *
  62. * @param file
  63. * @param frequency
  64. * @param duty_cycle
  65. * @return bool
  66. */
  67. bool lfrfid_raw_file_read_header(LFRFIDRawFile* file, float* frequency, float* duty_cycle);
  68. /**
  69. * @brief Read varint-encoded pair from RAW file
  70. *
  71. * @param file
  72. * @param duration
  73. * @param pulse
  74. * @param pass_end file was wrapped around, can be NULL
  75. * @return bool
  76. */
  77. bool lfrfid_raw_file_read_pair(
  78. LFRFIDRawFile* file,
  79. uint32_t* duration,
  80. uint32_t* pulse,
  81. bool* pass_end);
  82. #ifdef __cplusplus
  83. }
  84. #endif