[FL-2456] App notifications update (#1175)

* Notifications update: SubGHz
* Notifications: ibutton, infrared, rfid
This commit is contained in:
Nikolay Minaylov
2022-04-28 20:20:59 +03:00
committed by GitHub
parent af5e03ecb7
commit 4526503d81
29 changed files with 138 additions and 99 deletions

View File

@@ -211,46 +211,12 @@ void InfraredApp::notify_success() {
notification_message(notification, &sequence_success);
}
void InfraredApp::notify_red_blink() {
notification_message(notification, &sequence_blink_red_10);
void InfraredApp::notify_blink_read() {
notification_message(notification, &sequence_blink_cyan_10);
}
void InfraredApp::notify_click() {
static const NotificationSequence sequence = {
&message_click,
&message_delay_1,
&message_sound_off,
NULL,
};
notification_message_block(notification, &sequence);
}
void InfraredApp::notify_click_and_green_blink() {
static const NotificationSequence sequence = {
&message_click,
&message_delay_1,
&message_sound_off,
&message_green_255,
&message_delay_10,
&message_green_0,
&message_do_not_reset,
NULL,
};
notification_message_block(notification, &sequence);
}
void InfraredApp::notify_blink_green() {
static const NotificationSequence sequence = {
&message_green_255,
&message_delay_10,
&message_green_0,
&message_do_not_reset,
NULL,
};
notification_message(notification, &sequence);
void InfraredApp::notify_blink_send() {
notification_message(notification, &sequence_blink_magenta_10);
}
DialogsApp* InfraredApp::get_dialogs() {
@@ -279,5 +245,5 @@ void InfraredApp::set_received_signal(const InfraredAppSignal& signal) {
void InfraredApp::signal_sent_callback(void* context) {
InfraredApp* app = static_cast<InfraredApp*>(context);
app->notify_blink_green();
app->notify_blink_send();
}

View File

@@ -217,17 +217,13 @@ public:
/** Play success notification */
void notify_success();
/** Play red blink notification */
void notify_red_blink();
void notify_blink_read();
/** Light green */
void notify_green_on();
/** Disable green light */
void notify_green_off();
/** Play click sound */
void notify_click();
/** Play click and green notification */
void notify_click_and_green_blink();
/** Blink green light */
void notify_blink_green();
/** Blink on send */
void notify_blink_send();
/** Get Dialogs instance */
DialogsApp* get_dialogs();

View File

@@ -51,7 +51,7 @@ bool InfraredAppSceneLearn::on_event(InfraredApp* app, InfraredAppEvent* event)
switch(event->type) {
case InfraredAppEvent::Type::Tick:
consumed = true;
app->notify_red_blink();
app->notify_blink_read();
break;
case InfraredAppEvent::Type::InfraredMessageReceived:
app->notify_success();

View File

@@ -95,7 +95,6 @@ bool InfraredAppSceneLearnSuccess::on_event(InfraredApp* app, InfraredAppEvent*
case DialogExPressCenter:
if(!button_pressed) {
button_pressed = true;
app->notify_click_and_green_blink();
auto signal = app->get_received_signal();
if(signal.is_raw()) {

View File

@@ -72,14 +72,12 @@ bool InfraredAppSceneRemote::on_event(InfraredApp* app, InfraredAppEvent* event)
switch(event->payload.menu_index) {
case ButtonIndexPlus:
furi_assert(event->type == InfraredAppEvent::Type::MenuSelected);
app->notify_click();
buttonmenu_item_selected = event->payload.menu_index;
app->set_learn_new_remote(false);
app->switch_to_next_scene(InfraredApp::Scene::Learn);
break;
case ButtonIndexEdit:
furi_assert(event->type == InfraredAppEvent::Type::MenuSelected);
app->notify_click();
buttonmenu_item_selected = event->payload.menu_index;
app->switch_to_next_scene(InfraredApp::Scene::Edit);
break;
@@ -89,7 +87,6 @@ bool InfraredAppSceneRemote::on_event(InfraredApp* app, InfraredAppEvent* event)
if(pressed && !button_pressed) {
button_pressed = true;
app->notify_click_and_green_blink();
auto button_signal =
app->get_remote_manager()->get_button_data(event->payload.menu_index);

View File

@@ -56,6 +56,7 @@ bool InfraredAppSceneUniversalCommon::on_event(InfraredApp* app, InfraredAppEven
if(brute_force_started) {
if(event->type == InfraredAppEvent::Type::Tick) {
auto view_manager = app->get_view_manager();
app->notify_blink_send();
InfraredAppEvent tick_event = {.type = InfraredAppEvent::Type::Tick};
view_manager->send_event(&tick_event);
bool result = brute_force.send_next_bruteforce();
@@ -81,6 +82,7 @@ bool InfraredAppSceneUniversalCommon::on_event(InfraredApp* app, InfraredAppEven
DOLPHIN_DEED(DolphinDeedIrBruteForce);
brute_force_started = true;
show_popup(app, record_amount);
app->notify_blink_send();
} else {
app->switch_to_previous_scene();
}