2022-06-21 15:45:50 +03:00
|
|
|
#include "infrared_remote_button.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
struct InfraredRemoteButton {
|
2022-10-05 18:15:23 +03:00
|
|
|
FuriString* name;
|
2022-06-21 15:45:50 +03:00
|
|
|
InfraredSignal* signal;
|
|
|
|
};
|
|
|
|
|
|
|
|
InfraredRemoteButton* infrared_remote_button_alloc() {
|
|
|
|
InfraredRemoteButton* button = malloc(sizeof(InfraredRemoteButton));
|
2022-10-05 18:15:23 +03:00
|
|
|
button->name = furi_string_alloc();
|
2022-06-21 15:45:50 +03:00
|
|
|
button->signal = infrared_signal_alloc();
|
|
|
|
return button;
|
|
|
|
}
|
|
|
|
|
|
|
|
void infrared_remote_button_free(InfraredRemoteButton* button) {
|
2022-10-05 18:15:23 +03:00
|
|
|
furi_string_free(button->name);
|
2022-06-21 15:45:50 +03:00
|
|
|
infrared_signal_free(button->signal);
|
|
|
|
free(button);
|
|
|
|
}
|
|
|
|
|
|
|
|
void infrared_remote_button_set_name(InfraredRemoteButton* button, const char* name) {
|
2022-10-05 18:15:23 +03:00
|
|
|
furi_string_set(button->name, name);
|
2022-06-21 15:45:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
const char* infrared_remote_button_get_name(InfraredRemoteButton* button) {
|
2022-10-05 18:15:23 +03:00
|
|
|
return furi_string_get_cstr(button->name);
|
2022-06-21 15:45:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void infrared_remote_button_set_signal(InfraredRemoteButton* button, InfraredSignal* signal) {
|
|
|
|
infrared_signal_set_signal(button->signal, signal);
|
|
|
|
}
|
|
|
|
|
|
|
|
InfraredSignal* infrared_remote_button_get_signal(InfraredRemoteButton* button) {
|
|
|
|
return button->signal;
|
|
|
|
}
|