unleashed-firmware/applications/irda/irda-app-brute-force.hpp
Albert Kharisov c583cce5bd
[FL-1401] Add Universal TV remote (#539)
* Remove excess headers
* Add ButtonPanel
* Add Popup
* Move FileReader to standalone object
* Universal remote (part 1)
* Universal remote (part 2)
* Global rename tranciever/file_parser
* Compile assets
* syntax fix
* English: rename tranceiver to transceiver.

Co-authored-by: あく <alleteam@gmail.com>
2021-06-25 16:52:27 +03:00

39 lines
1.1 KiB
C++

#pragma once
#include "furi/check.h"
#include <unordered_map>
#include "irda-app-file-parser.hpp"
#include "irda-app-transceiver.hpp"
class IrdaAppBruteForce {
const char* universal_db_filename;
IrdaAppFileParser file_parser;
File file;
std::string current_record;
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();
bool send_next_bruteforce(const IrdaAppSignalTransceiver& receiver);
bool start_bruteforce(int index, int& record_amount);
void add_record(int index, const char* name);
IrdaAppBruteForce(const char* filename) : universal_db_filename (filename) {}
~IrdaAppBruteForce() {
stop_bruteforce();
}
};