2021-08-03 20:24:20 +03:00
|
|
|
#include "../nfc_i.h"
|
2022-07-20 13:56:33 +03:00
|
|
|
#include <core/common_defines.h>
|
2021-08-03 20:24:20 +03:00
|
|
|
|
2021-09-21 12:34:16 +03:00
|
|
|
void nfc_scene_emulate_apdu_sequence_on_enter(void* context) {
|
2022-04-19 18:23:58 +03:00
|
|
|
Nfc* nfc = context;
|
2021-08-03 20:24:20 +03:00
|
|
|
|
|
|
|
// Setup view
|
|
|
|
Popup* popup = nfc->popup;
|
|
|
|
popup_set_header(popup, "Run APDU reader", 64, 31, AlignCenter, AlignTop);
|
|
|
|
|
|
|
|
// Setup and start worker
|
|
|
|
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
|
2021-11-09 00:55:06 +03:00
|
|
|
nfc_worker_start(nfc->worker, NfcWorkerStateEmulateApdu, &nfc->dev->dev_data, NULL, nfc);
|
2022-06-13 04:08:28 +03:00
|
|
|
|
2022-09-15 18:49:10 +03:00
|
|
|
nfc_blink_emulate_start(nfc);
|
2021-08-03 20:24:20 +03:00
|
|
|
}
|
|
|
|
|
2021-09-21 12:34:16 +03:00
|
|
|
bool nfc_scene_emulate_apdu_sequence_on_event(void* context, SceneManagerEvent event) {
|
2022-06-13 04:08:28 +03:00
|
|
|
UNUSED(context);
|
|
|
|
UNUSED(event);
|
2022-04-19 18:23:58 +03:00
|
|
|
bool consumed = false;
|
|
|
|
return consumed;
|
2021-08-03 20:24:20 +03:00
|
|
|
}
|
|
|
|
|
2021-09-21 12:34:16 +03:00
|
|
|
void nfc_scene_emulate_apdu_sequence_on_exit(void* context) {
|
2022-04-19 18:23:58 +03:00
|
|
|
Nfc* nfc = context;
|
2021-08-03 20:24:20 +03:00
|
|
|
|
|
|
|
// Stop worker
|
|
|
|
nfc_worker_stop(nfc->worker);
|
|
|
|
// Clear view
|
2022-04-19 18:23:58 +03:00
|
|
|
popup_reset(nfc->popup);
|
2022-06-13 04:08:28 +03:00
|
|
|
|
|
|
|
nfc_blink_stop(nfc);
|
2021-08-03 20:24:20 +03:00
|
|
|
}
|