subghz.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* Reduced variant of the Flipper Zero SubGhz Class */
  2. #include "subghz_i.h"
  3. //#include "../meal_pager_storage.h"
  4. static SubGhz* subghz_alloc() {
  5. SubGhz* subghz = malloc(sizeof(SubGhz));
  6. subghz->file_path = furi_string_alloc();
  7. subghz->txrx = subghz_txrx_alloc();
  8. return subghz;
  9. }
  10. static void subghz_free(SubGhz* subghz) {
  11. //TxRx
  12. subghz_txrx_free(subghz->txrx);
  13. // Furi strings
  14. furi_string_free(subghz->file_path);
  15. // The rest
  16. free(subghz);
  17. }
  18. void subghz_send(void* context) {
  19. UNUSED(context);
  20. SubGhz* subghz = subghz_alloc();
  21. subghz_load_protocol_from_file(subghz);
  22. /*Storage* storage = furi_record_open(RECORD_STORAGE);
  23. FlipperFormat* ff = flipper_format_file_alloc(storage);
  24. if(!flipper_format_file_open_existing(ff, MEAL_PAGER_TMP_FILE)) {
  25. //totp_close_config_file(fff_file);
  26. FURI_LOG_E(TAG, "Error reading Temp File %s", MEAL_PAGER_TMP_FILE);
  27. furi_record_close(RECORD_STORAGE);
  28. return;
  29. }*/
  30. //subghz_txrx_tx_start(subghz->txrx, ff);
  31. subghz_txrx_tx_start(subghz->txrx, subghz_txrx_get_fff_data(subghz->txrx)); //Seems like it must be done this way
  32. /*flipper_format_rewind(ff);
  33. flipper_format_file_close(ff);
  34. flipper_format_free(ff);
  35. furi_record_close(RECORD_STORAGE);*/
  36. subghz_free(subghz);
  37. }