HW LED blink integration (#1310)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "furi/common_defines.h"
|
||||
|
||||
void nfc_scene_emulate_apdu_sequence_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
@@ -10,17 +11,14 @@ void nfc_scene_emulate_apdu_sequence_on_enter(void* context) {
|
||||
// Setup and start worker
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
|
||||
nfc_worker_start(nfc->worker, NfcWorkerStateEmulateApdu, &nfc->dev->dev_data, NULL, nfc);
|
||||
|
||||
nfc_blink_start(nfc);
|
||||
}
|
||||
|
||||
bool nfc_scene_emulate_apdu_sequence_on_event(void* context, SceneManagerEvent event) {
|
||||
Nfc* nfc = context;
|
||||
UNUSED(context);
|
||||
UNUSED(event);
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeTick) {
|
||||
notification_message(nfc->notifications, &sequence_blink_blue_10);
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
@@ -31,4 +29,6 @@ void nfc_scene_emulate_apdu_sequence_on_exit(void* context) {
|
||||
nfc_worker_stop(nfc->worker);
|
||||
// Clear view
|
||||
popup_reset(nfc->popup);
|
||||
|
||||
nfc_blink_stop(nfc);
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ void nfc_scene_emulate_mifare_classic_on_enter(void* context) {
|
||||
&nfc->dev->dev_data,
|
||||
nfc_emulate_mifare_classic_worker_callback,
|
||||
nfc);
|
||||
nfc_blink_start(nfc);
|
||||
}
|
||||
|
||||
bool nfc_scene_emulate_mifare_classic_on_event(void* context, SceneManagerEvent event) {
|
||||
@@ -39,7 +40,6 @@ bool nfc_scene_emulate_mifare_classic_on_event(void* context, SceneManagerEvent
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeTick) {
|
||||
notification_message(nfc->notifications, &sequence_blink_blue_10);
|
||||
consumed = true;
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
// Stop worker
|
||||
@@ -61,4 +61,6 @@ void nfc_scene_emulate_mifare_classic_on_exit(void* context) {
|
||||
|
||||
// Clear view
|
||||
popup_reset(nfc->popup);
|
||||
|
||||
nfc_blink_stop(nfc);
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ void nfc_scene_emulate_mifare_ul_on_enter(void* context) {
|
||||
&nfc->dev->dev_data,
|
||||
nfc_emulate_mifare_ul_worker_callback,
|
||||
nfc);
|
||||
nfc_blink_start(nfc);
|
||||
}
|
||||
|
||||
bool nfc_scene_emulate_mifare_ul_on_event(void* context, SceneManagerEvent event) {
|
||||
@@ -39,7 +40,6 @@ bool nfc_scene_emulate_mifare_ul_on_event(void* context, SceneManagerEvent event
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeTick) {
|
||||
notification_message(nfc->notifications, &sequence_blink_blue_10);
|
||||
consumed = true;
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
// Stop worker
|
||||
@@ -61,4 +61,6 @@ void nfc_scene_emulate_mifare_ul_on_exit(void* context) {
|
||||
|
||||
// Clear view
|
||||
popup_reset(nfc->popup);
|
||||
|
||||
nfc_blink_stop(nfc);
|
||||
}
|
||||
|
@@ -80,6 +80,8 @@ void nfc_scene_emulate_uid_on_enter(void* context) {
|
||||
&nfc->dev->dev_data,
|
||||
nfc_emulate_uid_worker_callback,
|
||||
nfc);
|
||||
|
||||
nfc_blink_start(nfc);
|
||||
}
|
||||
|
||||
bool nfc_scene_emulate_uid_on_event(void* context, SceneManagerEvent event) {
|
||||
@@ -89,7 +91,6 @@ bool nfc_scene_emulate_uid_on_event(void* context, SceneManagerEvent event) {
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeTick) {
|
||||
notification_message(nfc->notifications, &sequence_blink_blue_10);
|
||||
consumed = true;
|
||||
} else if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == NfcCustomEventWorkerExit) {
|
||||
@@ -141,4 +142,6 @@ void nfc_scene_emulate_uid_on_exit(void* context) {
|
||||
widget_reset(nfc->widget);
|
||||
text_box_reset(nfc->text_box);
|
||||
string_reset(nfc->text_box_store);
|
||||
|
||||
nfc_blink_stop(nfc);
|
||||
}
|
||||
|
@@ -20,6 +20,8 @@ void nfc_scene_read_card_on_enter(void* context) {
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
|
||||
nfc_worker_start(
|
||||
nfc->worker, NfcWorkerStateDetect, &nfc->dev->dev_data, nfc_read_card_worker_callback, nfc);
|
||||
|
||||
nfc_blink_start(nfc);
|
||||
}
|
||||
|
||||
bool nfc_scene_read_card_on_event(void* context, SceneManagerEvent event) {
|
||||
@@ -32,7 +34,6 @@ bool nfc_scene_read_card_on_event(void* context, SceneManagerEvent event) {
|
||||
consumed = true;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeTick) {
|
||||
notification_message(nfc->notifications, &sequence_blink_blue_10);
|
||||
consumed = true;
|
||||
}
|
||||
return consumed;
|
||||
@@ -45,4 +46,6 @@ void nfc_scene_read_card_on_exit(void* context) {
|
||||
nfc_worker_stop(nfc->worker);
|
||||
// Clear view
|
||||
popup_reset(nfc->popup);
|
||||
|
||||
nfc_blink_stop(nfc);
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ void nfc_scene_read_emv_app_on_enter(void* context) {
|
||||
&nfc->dev->dev_data,
|
||||
nfc_read_emv_app_worker_callback,
|
||||
nfc);
|
||||
nfc_blink_start(nfc);
|
||||
}
|
||||
|
||||
bool nfc_scene_read_emv_app_on_event(void* context, SceneManagerEvent event) {
|
||||
@@ -38,7 +39,6 @@ bool nfc_scene_read_emv_app_on_event(void* context, SceneManagerEvent event) {
|
||||
consumed = true;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeTick) {
|
||||
notification_message(nfc->notifications, &sequence_blink_blue_10);
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
@@ -53,4 +53,6 @@ void nfc_scene_read_emv_app_on_exit(void* context) {
|
||||
|
||||
// Clear view
|
||||
popup_reset(nfc->popup);
|
||||
|
||||
nfc_blink_stop(nfc);
|
||||
}
|
||||
|
@@ -26,6 +26,8 @@ void nfc_scene_read_emv_data_on_enter(void* context) {
|
||||
&nfc->dev->dev_data,
|
||||
nfc_read_emv_data_worker_callback,
|
||||
nfc);
|
||||
|
||||
nfc_blink_start(nfc);
|
||||
}
|
||||
|
||||
bool nfc_scene_read_emv_data_on_event(void* context, SceneManagerEvent event) {
|
||||
@@ -40,7 +42,6 @@ bool nfc_scene_read_emv_data_on_event(void* context, SceneManagerEvent event) {
|
||||
consumed = true;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeTick) {
|
||||
notification_message(nfc->notifications, &sequence_blink_blue_10);
|
||||
consumed = true;
|
||||
}
|
||||
return consumed;
|
||||
@@ -53,4 +54,6 @@ void nfc_scene_read_emv_data_on_exit(void* context) {
|
||||
nfc_worker_stop(nfc->worker);
|
||||
// Clear view
|
||||
popup_reset(nfc->popup);
|
||||
|
||||
nfc_blink_stop(nfc);
|
||||
}
|
||||
|
@@ -33,17 +33,15 @@ void nfc_scene_read_mifare_classic_on_enter(void* context) {
|
||||
&nfc->dev->dev_data,
|
||||
nfc_read_mifare_classic_worker_callback,
|
||||
nfc);
|
||||
|
||||
nfc_blink_start(nfc);
|
||||
}
|
||||
|
||||
bool nfc_scene_read_mifare_classic_on_event(void* context, SceneManagerEvent event) {
|
||||
Nfc* nfc = context;
|
||||
bool consumed = false;
|
||||
|
||||
uint32_t state = scene_manager_get_scene_state(nfc->scene_manager, NfcSceneReadMifareClassic);
|
||||
if(event.type == SceneManagerEventTypeTick) {
|
||||
if(state == NfcSceneReadMifareClassicStateInProgress) {
|
||||
notification_message(nfc->notifications, &sequence_blink_blue_10);
|
||||
}
|
||||
consumed = true;
|
||||
} else if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == NfcCustomEventDictAttackDone) {
|
||||
@@ -70,12 +68,14 @@ bool nfc_scene_read_mifare_classic_on_event(void* context, SceneManagerEvent eve
|
||||
} else if(event.event == NfcWorkerEventSuccess) {
|
||||
scene_manager_set_scene_state(
|
||||
nfc->scene_manager, NfcSceneReadMifareClassic, NfcSceneReadMifareClassicStateDone);
|
||||
nfc_blink_stop(nfc);
|
||||
notification_message(nfc->notifications, &sequence_success);
|
||||
dict_attack_set_result(nfc->dict_attack, true);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventFail) {
|
||||
scene_manager_set_scene_state(
|
||||
nfc->scene_manager, NfcSceneReadMifareClassic, NfcSceneReadMifareClassicStateDone);
|
||||
nfc_blink_stop(nfc);
|
||||
dict_attack_set_result(nfc->dict_attack, false);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventNoDictFound) {
|
||||
@@ -91,4 +91,6 @@ void nfc_scene_read_mifare_classic_on_exit(void* context) {
|
||||
// Stop worker
|
||||
nfc_worker_stop(nfc->worker);
|
||||
dict_attack_reset(nfc->dict_attack);
|
||||
|
||||
nfc_blink_stop(nfc);
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ void nfc_scene_read_mifare_desfire_on_enter(void* context) {
|
||||
&nfc->dev->dev_data,
|
||||
nfc_read_mifare_desfire_worker_callback,
|
||||
nfc);
|
||||
nfc_blink_start(nfc);
|
||||
}
|
||||
|
||||
bool nfc_scene_read_mifare_desfire_on_event(void* context, SceneManagerEvent event) {
|
||||
@@ -33,12 +34,11 @@ bool nfc_scene_read_mifare_desfire_on_event(void* context, SceneManagerEvent eve
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == NfcCustomEventWorkerExit) {
|
||||
notification_message(nfc->notifications, &sequence_success);
|
||||
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneReadMifareDesfireSuccess);
|
||||
consumed = true;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeTick) {
|
||||
notification_message(nfc->notifications, &sequence_blink_blue_10);
|
||||
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
|
||||
consumed = true;
|
||||
}
|
||||
return consumed;
|
||||
@@ -51,4 +51,6 @@ void nfc_scene_read_mifare_desfire_on_exit(void* context) {
|
||||
nfc_worker_stop(nfc->worker);
|
||||
// Clear view
|
||||
popup_reset(nfc->popup);
|
||||
|
||||
nfc_blink_stop(nfc);
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ void nfc_scene_read_mifare_ul_on_enter(void* context) {
|
||||
&nfc->dev->dev_data,
|
||||
nfc_read_mifare_ul_worker_callback,
|
||||
nfc);
|
||||
nfc_blink_start(nfc);
|
||||
}
|
||||
|
||||
bool nfc_scene_read_mifare_ul_on_event(void* context, SceneManagerEvent event) {
|
||||
@@ -36,7 +37,6 @@ bool nfc_scene_read_mifare_ul_on_event(void* context, SceneManagerEvent event) {
|
||||
consumed = true;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeTick) {
|
||||
notification_message(nfc->notifications, &sequence_blink_blue_10);
|
||||
consumed = true;
|
||||
}
|
||||
return consumed;
|
||||
@@ -49,4 +49,6 @@ void nfc_scene_read_mifare_ul_on_exit(void* context) {
|
||||
nfc_worker_stop(nfc->worker);
|
||||
// Clear view
|
||||
popup_reset(nfc->popup);
|
||||
|
||||
nfc_blink_stop(nfc);
|
||||
}
|
||||
|
Reference in New Issue
Block a user