flipperzero-firmware/applications/irda/irda-app-brute-force.h
Albert Kharisov 5f6aff2255
[FL-1472, FL-1596, FL-1673] IRDA: stability improvements (#655)
- Restrict with 31 bytes length for remote and signal name
- Don't stuck for 0 PWM cycle timings
- Support timings > 65535 PWM cycles
- Fix remote file open error
- Add IRDA TX debug redirect
- Add remote parse error print, improve parsing, support tabs
- Fix stucks with uncorrect RAW signal values, long strings in remote file, etc
- Fix HAL signals capturing (save previous read value)
- Fix leak in case of failed parsing
2021-08-19 03:18:42 +03:00

38 lines
1.1 KiB
C++

#pragma once
#include "irda-app-file-parser.h"
#include <unordered_map>
#include <memory>
class IrdaAppBruteForce {
const char* universal_db_filename;
std::string current_record;
std::unique_ptr<IrdaAppFileParser> file_parser;
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();
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() {
}
};