2021-06-30 17:43:29 +00:00
|
|
|
#include "../nfc_i.h"
|
[FL-2183] [FL-2209] Dolphin Deeds, Level up, assets generation, refactoring (#965)
* Desktop: cleanup headers
* Get loader pubsub via record
* [FL-2183] Dolphin refactoring 2022.01
* Restruct animations assets structure
* Rename assets
* Cleanup headers
* Update Recording animation
* Add BadBattery animation
* Provide loader's pubsub via record
* Fix load/unload animations
* Scripts: add flipper format support, initial dolphin packager rework. Assets: internal and external dolphin.
* Sync internal meta.txt and manifest.txt
* Reorder, rename dolphin assets
* Split essential generated assets
* Add ReadMe for dolphin assets
* Separate essential blocking animations
* Scripts: full dolphin validation before packaging
* Assets, Scripts: dolphin external resources packer
* Github: update codeowners
* Scripts: proper slots handling in dolphin animation meta
* Scripts: correct frames enumeration and fix compiled assets.
* [FL-2209] Add Dolphin Deeds points and many more
* Remove excess frame_rate
* Change dolphin assets directory
* Scripts: add internal resource support to dolphin compiler
* Scripts: add internal assets generation, renaming
* Scripts: correct assert, renaming
* Code cleanup, documentation, fixes
* Update Levelup animations
* Rename essential -> blocking
* Fix Unlocked hint
* Scripts: rewrite Templite compiller, replace regexps with token parser, split block types into code and variable blocks. Update dolphin templates.
* Documentation: add key combos description and use information
* Scripts: cleanup templit, more debug info and add dev comment
Co-authored-by: あく <alleteam@gmail.com>
2022-01-29 09:20:41 +00:00
|
|
|
#include <dolphin/dolphin.h>
|
2021-06-30 17:43:29 +00:00
|
|
|
|
2022-01-12 14:02:20 +00:00
|
|
|
void nfc_scene_read_card_success_widget_callback(
|
|
|
|
GuiButtonType result,
|
|
|
|
InputType type,
|
|
|
|
void* context) {
|
|
|
|
furi_assert(context);
|
|
|
|
Nfc* nfc = context;
|
|
|
|
if(type == InputTypeShort) {
|
|
|
|
view_dispatcher_send_custom_event(nfc->view_dispatcher, result);
|
|
|
|
}
|
2021-06-30 17:43:29 +00:00
|
|
|
}
|
|
|
|
|
2021-07-22 06:05:07 +00:00
|
|
|
void nfc_scene_read_card_success_on_enter(void* context) {
|
2021-06-30 17:43:29 +00:00
|
|
|
Nfc* nfc = (Nfc*)context;
|
2022-01-12 14:02:20 +00:00
|
|
|
string_t data_str;
|
|
|
|
string_t uid_str;
|
|
|
|
string_init(data_str);
|
|
|
|
string_init(uid_str);
|
[FL-2183] [FL-2209] Dolphin Deeds, Level up, assets generation, refactoring (#965)
* Desktop: cleanup headers
* Get loader pubsub via record
* [FL-2183] Dolphin refactoring 2022.01
* Restruct animations assets structure
* Rename assets
* Cleanup headers
* Update Recording animation
* Add BadBattery animation
* Provide loader's pubsub via record
* Fix load/unload animations
* Scripts: add flipper format support, initial dolphin packager rework. Assets: internal and external dolphin.
* Sync internal meta.txt and manifest.txt
* Reorder, rename dolphin assets
* Split essential generated assets
* Add ReadMe for dolphin assets
* Separate essential blocking animations
* Scripts: full dolphin validation before packaging
* Assets, Scripts: dolphin external resources packer
* Github: update codeowners
* Scripts: proper slots handling in dolphin animation meta
* Scripts: correct frames enumeration and fix compiled assets.
* [FL-2209] Add Dolphin Deeds points and many more
* Remove excess frame_rate
* Change dolphin assets directory
* Scripts: add internal resource support to dolphin compiler
* Scripts: add internal assets generation, renaming
* Scripts: correct assert, renaming
* Code cleanup, documentation, fixes
* Update Levelup animations
* Rename essential -> blocking
* Fix Unlocked hint
* Scripts: rewrite Templite compiller, replace regexps with token parser, split block types into code and variable blocks. Update dolphin templates.
* Documentation: add key combos description and use information
* Scripts: cleanup templit, more debug info and add dev comment
Co-authored-by: あく <alleteam@gmail.com>
2022-01-29 09:20:41 +00:00
|
|
|
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
|
2021-06-30 17:43:29 +00:00
|
|
|
|
|
|
|
// Send notification
|
|
|
|
notification_message(nfc->notifications, &sequence_success);
|
|
|
|
|
|
|
|
// Setup view
|
2021-11-08 21:55:06 +00:00
|
|
|
NfcDeviceCommonData* data = &nfc->dev->dev_data.nfc_data;
|
2022-01-12 14:02:20 +00:00
|
|
|
Widget* widget = nfc->widget;
|
|
|
|
string_set_str(data_str, nfc_get_dev_type(data->device));
|
|
|
|
string_set_str(uid_str, "UID:");
|
|
|
|
for(uint8_t i = 0; i < data->uid_len; i++) {
|
|
|
|
string_cat_printf(uid_str, " %02X", data->uid[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
widget_add_button_element(
|
|
|
|
widget, GuiButtonTypeLeft, "Retry", nfc_scene_read_card_success_widget_callback, nfc);
|
|
|
|
if(data->device == NfcDeviceNfca) {
|
|
|
|
widget_add_button_element(
|
|
|
|
widget, GuiButtonTypeRight, "More", nfc_scene_read_card_success_widget_callback, nfc);
|
|
|
|
widget_add_icon_element(widget, 8, 13, &I_Medium_chip_22x21);
|
|
|
|
string_cat_printf(data_str, " may be:");
|
|
|
|
widget_add_string_element(
|
|
|
|
widget, 37, 12, AlignLeft, AlignBottom, FontPrimary, string_get_cstr(data_str));
|
|
|
|
string_printf(
|
|
|
|
data_str,
|
|
|
|
"%s\nATQA: %02X%02X SAK: %02X",
|
2021-12-21 12:33:17 +00:00
|
|
|
nfc_guess_protocol(data->protocol),
|
2021-06-30 17:43:29 +00:00
|
|
|
data->atqa[0],
|
|
|
|
data->atqa[1],
|
2022-01-12 14:02:20 +00:00
|
|
|
data->sak);
|
|
|
|
widget_add_string_multiline_element(
|
|
|
|
widget, 37, 16, AlignLeft, AlignTop, FontSecondary, string_get_cstr(data_str));
|
|
|
|
widget_add_string_element(
|
|
|
|
widget, 64, 46, AlignCenter, AlignBottom, FontSecondary, string_get_cstr(uid_str));
|
|
|
|
} else {
|
|
|
|
widget_add_string_element(
|
|
|
|
widget, 64, 12, AlignCenter, AlignBottom, FontPrimary, string_get_cstr(data_str));
|
|
|
|
widget_add_string_element(
|
|
|
|
widget, 64, 32, AlignCenter, AlignCenter, FontSecondary, string_get_cstr(uid_str));
|
2021-06-30 17:43:29 +00:00
|
|
|
}
|
|
|
|
|
2022-01-12 14:02:20 +00:00
|
|
|
string_clear(data_str);
|
|
|
|
string_clear(uid_str);
|
|
|
|
|
|
|
|
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewWidget);
|
2021-06-30 17:43:29 +00:00
|
|
|
}
|
|
|
|
|
2021-09-21 09:34:16 +00:00
|
|
|
bool nfc_scene_read_card_success_on_event(void* context, SceneManagerEvent event) {
|
2021-06-30 17:43:29 +00:00
|
|
|
Nfc* nfc = (Nfc*)context;
|
2022-01-12 14:02:20 +00:00
|
|
|
NfcDeviceCommonData* data = &nfc->dev->dev_data.nfc_data;
|
|
|
|
bool consumed = false;
|
2021-06-30 17:43:29 +00:00
|
|
|
|
2021-07-12 18:56:14 +00:00
|
|
|
if(event.type == SceneManagerEventTypeCustom) {
|
2022-01-12 14:02:20 +00:00
|
|
|
if(event.event == GuiButtonTypeLeft) {
|
|
|
|
consumed = scene_manager_previous_scene(nfc->scene_manager);
|
|
|
|
} else if(data->device == NfcDeviceNfca && event.event == GuiButtonTypeRight) {
|
2021-10-05 05:14:19 +00:00
|
|
|
// Clear device name
|
2021-11-08 21:55:06 +00:00
|
|
|
nfc_device_set_name(nfc->dev, "");
|
2021-07-12 18:56:14 +00:00
|
|
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneCardMenu);
|
2022-01-12 14:02:20 +00:00
|
|
|
consumed = true;
|
2021-07-12 18:56:14 +00:00
|
|
|
}
|
2021-06-30 17:43:29 +00:00
|
|
|
}
|
2022-01-12 14:02:20 +00:00
|
|
|
return consumed;
|
2021-06-30 17:43:29 +00:00
|
|
|
}
|
|
|
|
|
2021-09-21 09:34:16 +00:00
|
|
|
void nfc_scene_read_card_success_on_exit(void* context) {
|
2021-06-30 17:43:29 +00:00
|
|
|
Nfc* nfc = (Nfc*)context;
|
2022-02-02 19:59:28 +00:00
|
|
|
widget_reset(nfc->widget);
|
2021-06-30 17:43:29 +00:00
|
|
|
}
|