irda_app_brute_force.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include <unordered_map>
  3. #include <memory>
  4. #include <flipper_file.h>
  5. class IrdaAppBruteForce {
  6. const char* universal_db_filename;
  7. std::string current_record;
  8. FlipperFile* ff;
  9. typedef struct {
  10. int index;
  11. int amount;
  12. } Record;
  13. // 'key' is record name, because we have to search by both, index and name,
  14. // but index search has place once per button press, and should not be
  15. // noticed, but name search should occur during entering universal menu,
  16. // and will go through container for every record in file, that's why
  17. // more critical to have faster search by record name.
  18. std::unordered_map<std::string, Record> records;
  19. public:
  20. bool calculate_messages();
  21. void stop_bruteforce();
  22. bool send_next_bruteforce();
  23. bool start_bruteforce(int index, int& record_amount);
  24. void add_record(int index, const char* name);
  25. IrdaAppBruteForce(const char* filename)
  26. : universal_db_filename(filename) {
  27. }
  28. ~IrdaAppBruteForce() {
  29. }
  30. };