990a065bd0
* IR app move to FFF * [FL-2164] Hide unimplemented submenus * Fix brute force fail * Fix FFF endless reading * Reformat TV bruteforce lib to FFF * fixes & cleanup * Infrared: switch to constexpr. Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
69 lines
1.5 KiB
C++
69 lines
1.5 KiB
C++
#pragma once
|
|
#include <irda_worker.h>
|
|
#include <stdint.h>
|
|
#include <string>
|
|
#include <irda.h>
|
|
|
|
class IrdaAppSignal {
|
|
public:
|
|
typedef struct {
|
|
size_t timings_cnt;
|
|
uint32_t* timings;
|
|
uint32_t frequency;
|
|
float duty_cycle;
|
|
} RawSignal;
|
|
|
|
private:
|
|
bool raw_signal;
|
|
union {
|
|
IrdaMessage message;
|
|
RawSignal raw;
|
|
} payload;
|
|
|
|
void
|
|
copy_raw_signal(const uint32_t* timings, size_t size, uint32_t frequency, float duty_cycle);
|
|
void clear_timings();
|
|
|
|
public:
|
|
IrdaAppSignal() {
|
|
raw_signal = false;
|
|
payload.message.protocol = IrdaProtocolUnknown;
|
|
}
|
|
|
|
~IrdaAppSignal() {
|
|
clear_timings();
|
|
}
|
|
|
|
IrdaAppSignal(
|
|
const uint32_t* timings,
|
|
size_t timings_cnt,
|
|
uint32_t frequency,
|
|
float duty_cycle);
|
|
IrdaAppSignal(const IrdaMessage* irda_message);
|
|
|
|
IrdaAppSignal(const IrdaAppSignal& other);
|
|
IrdaAppSignal(IrdaAppSignal&& other);
|
|
|
|
IrdaAppSignal& operator=(const IrdaAppSignal& signal);
|
|
|
|
void set_message(const IrdaMessage* irda_message);
|
|
void
|
|
set_raw_signal(uint32_t* timings, size_t timings_cnt, uint32_t frequency, float duty_cycle);
|
|
|
|
void transmit() const;
|
|
|
|
bool is_raw(void) const {
|
|
return raw_signal;
|
|
}
|
|
|
|
const IrdaMessage& get_message(void) const {
|
|
furi_assert(!raw_signal);
|
|
return payload.message;
|
|
}
|
|
|
|
const RawSignal& get_raw_signal(void) const {
|
|
furi_assert(raw_signal);
|
|
return payload.raw;
|
|
}
|
|
};
|