NFC refactoring (#3050)
"A long time ago in a galaxy far, far away...." we started NFC subsystem refactoring.
Starring:
- @gornekich - NFC refactoring project lead, architect, senior developer
- @gsurkov - architect, senior developer
- @RebornedBrain - senior developer
Supporting roles:
- @skotopes, @DrZlo13, @hedger - general architecture advisors, code review
- @Astrrra, @doomwastaken, @Hellitron, @ImagineVagon333 - quality assurance
Special thanks:
@bettse, @pcunning, @nxv, @noproto, @AloneLiberty and everyone else who has been helping us all this time and contributing valuable knowledges, ideas and source code.
2023-10-24 03:08:09 +00:00
|
|
|
#include "../helpers/protocol_support/nfc_protocol_support.h"
|
|
|
|
|
2024-01-30 20:03:39 +00:00
|
|
|
#include "nfc_app_i.h"
|
|
|
|
|
|
|
|
#define NFC_EMULATION_TIME_MAX_MS (5 * 60 * 1000)
|
|
|
|
|
2024-01-30 22:32:57 +00:00
|
|
|
FuriTimer* timer_auto_exit;
|
2024-01-30 20:03:39 +00:00
|
|
|
|
|
|
|
void nfc_scene_emulate_timer_callback(void* context) {
|
|
|
|
NfcApp* instance = context;
|
|
|
|
|
|
|
|
view_dispatcher_send_custom_event(
|
|
|
|
instance->view_dispatcher, NfcCustomEventEmulationTimeExpired);
|
|
|
|
}
|
|
|
|
|
NFC refactoring (#3050)
"A long time ago in a galaxy far, far away...." we started NFC subsystem refactoring.
Starring:
- @gornekich - NFC refactoring project lead, architect, senior developer
- @gsurkov - architect, senior developer
- @RebornedBrain - senior developer
Supporting roles:
- @skotopes, @DrZlo13, @hedger - general architecture advisors, code review
- @Astrrra, @doomwastaken, @Hellitron, @ImagineVagon333 - quality assurance
Special thanks:
@bettse, @pcunning, @nxv, @noproto, @AloneLiberty and everyone else who has been helping us all this time and contributing valuable knowledges, ideas and source code.
2023-10-24 03:08:09 +00:00
|
|
|
void nfc_scene_emulate_on_enter(void* context) {
|
2024-01-30 20:03:39 +00:00
|
|
|
NfcApp* instance = context;
|
|
|
|
|
NFC refactoring (#3050)
"A long time ago in a galaxy far, far away...." we started NFC subsystem refactoring.
Starring:
- @gornekich - NFC refactoring project lead, architect, senior developer
- @gsurkov - architect, senior developer
- @RebornedBrain - senior developer
Supporting roles:
- @skotopes, @DrZlo13, @hedger - general architecture advisors, code review
- @Astrrra, @doomwastaken, @Hellitron, @ImagineVagon333 - quality assurance
Special thanks:
@bettse, @pcunning, @nxv, @noproto, @AloneLiberty and everyone else who has been helping us all this time and contributing valuable knowledges, ideas and source code.
2023-10-24 03:08:09 +00:00
|
|
|
nfc_protocol_support_on_enter(NfcProtocolSupportSceneEmulate, context);
|
2024-01-30 20:03:39 +00:00
|
|
|
|
2024-01-30 22:32:57 +00:00
|
|
|
timer_auto_exit =
|
|
|
|
furi_timer_alloc(nfc_scene_emulate_timer_callback, FuriTimerTypeOnce, instance);
|
2024-01-31 11:14:05 +00:00
|
|
|
|
|
|
|
if(!furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug))
|
|
|
|
furi_timer_start(timer_auto_exit, NFC_EMULATION_TIME_MAX_MS);
|
NFC refactoring (#3050)
"A long time ago in a galaxy far, far away...." we started NFC subsystem refactoring.
Starring:
- @gornekich - NFC refactoring project lead, architect, senior developer
- @gsurkov - architect, senior developer
- @RebornedBrain - senior developer
Supporting roles:
- @skotopes, @DrZlo13, @hedger - general architecture advisors, code review
- @Astrrra, @doomwastaken, @Hellitron, @ImagineVagon333 - quality assurance
Special thanks:
@bettse, @pcunning, @nxv, @noproto, @AloneLiberty and everyone else who has been helping us all this time and contributing valuable knowledges, ideas and source code.
2023-10-24 03:08:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool nfc_scene_emulate_on_event(void* context, SceneManagerEvent event) {
|
2024-01-30 20:03:39 +00:00
|
|
|
NfcApp* instance = context;
|
|
|
|
|
|
|
|
if(event.type == SceneManagerEventTypeCustom) {
|
|
|
|
if(event.event == NfcCustomEventEmulationTimeExpired) {
|
|
|
|
if(!scene_manager_previous_scene(instance->scene_manager)) {
|
|
|
|
scene_manager_stop(instance->scene_manager);
|
|
|
|
view_dispatcher_stop(instance->view_dispatcher);
|
|
|
|
} else {
|
|
|
|
scene_manager_previous_scene(instance->scene_manager);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
NFC refactoring (#3050)
"A long time ago in a galaxy far, far away...." we started NFC subsystem refactoring.
Starring:
- @gornekich - NFC refactoring project lead, architect, senior developer
- @gsurkov - architect, senior developer
- @RebornedBrain - senior developer
Supporting roles:
- @skotopes, @DrZlo13, @hedger - general architecture advisors, code review
- @Astrrra, @doomwastaken, @Hellitron, @ImagineVagon333 - quality assurance
Special thanks:
@bettse, @pcunning, @nxv, @noproto, @AloneLiberty and everyone else who has been helping us all this time and contributing valuable knowledges, ideas and source code.
2023-10-24 03:08:09 +00:00
|
|
|
return nfc_protocol_support_on_event(NfcProtocolSupportSceneEmulate, context, event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void nfc_scene_emulate_on_exit(void* context) {
|
2024-01-30 22:32:57 +00:00
|
|
|
furi_timer_stop(timer_auto_exit);
|
|
|
|
furi_timer_free(timer_auto_exit);
|
NFC refactoring (#3050)
"A long time ago in a galaxy far, far away...." we started NFC subsystem refactoring.
Starring:
- @gornekich - NFC refactoring project lead, architect, senior developer
- @gsurkov - architect, senior developer
- @RebornedBrain - senior developer
Supporting roles:
- @skotopes, @DrZlo13, @hedger - general architecture advisors, code review
- @Astrrra, @doomwastaken, @Hellitron, @ImagineVagon333 - quality assurance
Special thanks:
@bettse, @pcunning, @nxv, @noproto, @AloneLiberty and everyone else who has been helping us all this time and contributing valuable knowledges, ideas and source code.
2023-10-24 03:08:09 +00:00
|
|
|
nfc_protocol_support_on_exit(NfcProtocolSupportSceneEmulate, context);
|
|
|
|
}
|