2021-06-25 13:52:27 +00:00
|
|
|
#pragma once
|
2021-08-19 00:18:42 +00:00
|
|
|
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "irda_app_file_parser.h"
|
2021-08-19 00:18:42 +00:00
|
|
|
|
|
|
|
#include <unordered_map>
|
2021-07-22 00:07:00 +00:00
|
|
|
#include <memory>
|
2021-06-25 13:52:27 +00:00
|
|
|
|
|
|
|
class IrdaAppBruteForce {
|
|
|
|
const char* universal_db_filename;
|
|
|
|
std::string current_record;
|
2021-07-22 00:07:00 +00:00
|
|
|
std::unique_ptr<IrdaAppFileParser> file_parser;
|
2021-06-25 13:52:27 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int index;
|
|
|
|
int amount;
|
|
|
|
} Record;
|
|
|
|
|
|
|
|
// 'key' is record name, because we have to search by both, index and name,
|
|
|
|
// but index search has place once per button press, and should not be
|
|
|
|
// noticed, but name search should occur during entering universal menu,
|
|
|
|
// and will go through container for every record in file, that's why
|
|
|
|
// more critical to have faster search by record name.
|
|
|
|
std::unordered_map<std::string, Record> records;
|
|
|
|
|
|
|
|
public:
|
|
|
|
bool calculate_messages();
|
|
|
|
void stop_bruteforce();
|
2021-07-16 16:43:54 +00:00
|
|
|
bool send_next_bruteforce();
|
2021-06-25 13:52:27 +00:00
|
|
|
bool start_bruteforce(int index, int& record_amount);
|
|
|
|
void add_record(int index, const char* name);
|
|
|
|
|
2021-08-11 17:51:06 +00:00
|
|
|
IrdaAppBruteForce(const char* filename)
|
|
|
|
: universal_db_filename(filename) {
|
|
|
|
}
|
|
|
|
~IrdaAppBruteForce() {
|
|
|
|
}
|
2021-06-25 13:52:27 +00:00
|
|
|
};
|