environment.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #include "environment.h"
  2. struct SubGhzEnvironment {
  3. SubGhzKeystore* keystore;
  4. const char* came_atomo_rainbow_table_file_name;
  5. const char* nice_flor_s_rainbow_table_file_name;
  6. };
  7. SubGhzEnvironment* subghz_environment_alloc() {
  8. SubGhzEnvironment* instance = malloc(sizeof(SubGhzEnvironment));
  9. instance->keystore = subghz_keystore_alloc();
  10. instance->came_atomo_rainbow_table_file_name = NULL;
  11. instance->nice_flor_s_rainbow_table_file_name = NULL;
  12. return instance;
  13. }
  14. void subghz_environment_free(SubGhzEnvironment* instance) {
  15. furi_assert(instance);
  16. subghz_keystore_free(instance->keystore);
  17. free(instance);
  18. }
  19. bool subghz_environment_load_keystore(SubGhzEnvironment* instance, const char* filename) {
  20. furi_assert(instance);
  21. return subghz_keystore_load(instance->keystore, filename);
  22. }
  23. SubGhzKeystore* subghz_environment_get_keystore(SubGhzEnvironment* instance) {
  24. furi_assert(instance);
  25. return instance->keystore;
  26. }
  27. void subghz_environment_set_came_atomo_rainbow_table_file_name(
  28. SubGhzEnvironment* instance,
  29. const char* filename) {
  30. furi_assert(instance);
  31. instance->came_atomo_rainbow_table_file_name = filename;
  32. }
  33. const char*
  34. subghz_environment_get_came_atomo_rainbow_table_file_name(SubGhzEnvironment* instance) {
  35. furi_assert(instance);
  36. return instance->came_atomo_rainbow_table_file_name;
  37. }
  38. void subghz_environment_set_nice_flor_s_rainbow_table_file_name(
  39. SubGhzEnvironment* instance,
  40. const char* filename) {
  41. furi_assert(instance);
  42. instance->nice_flor_s_rainbow_table_file_name = filename;
  43. }
  44. const char*
  45. subghz_environment_get_nice_flor_s_rainbow_table_file_name(SubGhzEnvironment* instance) {
  46. furi_assert(instance);
  47. return instance->nice_flor_s_rainbow_table_file_name;
  48. }