[FL-3677, FL-3798] RFID Improvements (#3524)

* Update saved_info and read_success scenes
* Update EM4100 rendering
* Update HIDExt rendering
* Update Gallagher rendering
* Update HidProx rendering
* Update IOProx rendering
* Update H10301 rendering
* Update PAC/Stanley rendering
* Add strcasecmp() to API, better manufacturer/name handling
* Update Viking rendering
* Update FDX-A rendering
* Update Pyramid rendering
* Update Indala26 rendering
* Update Idteck rendering
* Update Keri rendering
* Update Nexwatch rendering
* Update Jablotron rendering
* Update Paradox rendering
* Truncate long Hex string on scene_read_suceess
* Fix formatting
* Update AWID rendering
* Update FDX-B rendering
* Tweak string formatting in various screens
* More read_success view tweaks
* Fix formatting
* Fix Pyramid brief rendering
* Reset saved key menu when going back
* Reset other menus on back where applicable
* Update confirmation scenes
* Update emulation scene
* Update delete scene
* Update raw read info screen
* Update raw read scene, fix crash
* Update raw read success scene
* Update write scene
* Always return to SceneSelectKey after saving
* Update SceneWriteSuccess and SceneDeleteSuccess
* Replace closing parens with dots
* FL-3798: Fix special formatting in text_box
* Simplify SceneReadSuccess
* Fix crash when having a trailing newline in text_box
* Bump API symbols version
* Make PVS happy
* Format sources

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Georgii Surkov
2024-03-29 06:32:43 +03:00
committed by GitHub
parent c353182353
commit 64bd2f9c84
41 changed files with 512 additions and 352 deletions

View File

@@ -1,6 +1,6 @@
#include "../lfrfid_i.h"
#define RAW_READ_TIME 5000
#define RAW_READ_TIME_MS (5000UL)
typedef struct {
FuriString* string_file_name;
@@ -29,24 +29,28 @@ void lfrfid_scene_raw_read_on_enter(void* context) {
LfRfid* app = context;
Popup* popup = app->popup;
LfRfidReadRawState* state = malloc(sizeof(LfRfidReadRawState));
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneRawRead, (uint32_t)state);
state->string_file_name = furi_string_alloc();
popup_set_icon(popup, 0, 0, &I_NFC_dolphin_emulation_51x64);
popup_set_header(popup, "Reading ASK", 91, 16, AlignCenter, AlignTop);
popup_set_text(popup, "Don't move\nfor 5 sec.", 91, 29, AlignCenter, AlignTop);
popup_set_icon(popup, 0, 3, &I_RFIDDolphinReceive_97x61);
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
lfrfid_worker_start_thread(app->lfworker);
lfrfid_make_app_folder(app);
LfRfidReadRawState* state = malloc(sizeof(LfRfidReadRawState));
state->string_file_name = furi_string_alloc();
state->timer = furi_timer_alloc(timer_callback, FuriTimerTypeOnce, app);
furi_timer_start(state->timer, RAW_READ_TIME);
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneRawRead, (uint32_t)state);
furi_string_printf(
state->string_file_name,
"%s/%s%s",
LFRFID_SD_FOLDER,
furi_string_get_cstr(app->raw_file_name),
LFRFID_APP_RAW_ASK_EXTENSION);
popup_set_header(popup, "Reading\nRAW RFID\nASK", 89, 30, AlignCenter, AlignTop);
lfrfid_make_app_folder(app);
lfrfid_worker_start_thread(app->lfworker);
lfrfid_worker_read_raw_start(
app->lfworker,
furi_string_get_cstr(state->string_file_name),
@@ -54,6 +58,7 @@ void lfrfid_scene_raw_read_on_enter(void* context) {
lfrfid_read_callback,
app);
furi_timer_start(state->timer, RAW_READ_TIME_MS);
notification_message(app->notifications, &sequence_blink_start_cyan);
state->is_psk = false;
@@ -70,41 +75,53 @@ bool lfrfid_scene_raw_read_on_event(void* context, SceneManagerEvent event) {
furi_assert(state);
if(event.type == SceneManagerEventTypeCustom) {
if(event.event == LfRfidEventReadError) {
consumed = true;
state->error = true;
popup_set_header(
popup, "Reading\nRAW RFID\nFile error", 89, 30, AlignCenter, AlignTop);
notification_message(app->notifications, &sequence_blink_start_red);
if(event.event == LfRfidEventReadError || event.event == LfRfidEventReadOverrun) {
furi_timer_stop(state->timer);
popup_set_icon(popup, 83, 22, &I_WarningDolphinFlip_45x42);
popup_set_header(popup, "RAW Reading error!", 64, 0, AlignCenter, AlignTop);
popup_set_text(
popup, "This may be\ncaused by SD\ncard issues", 0, 13, AlignLeft, AlignTop);
notification_message(app->notifications, &sequence_blink_start_red);
state->error = true;
} else if(event.event == LfRfidEventReadDone) {
consumed = true;
if(!state->error) {
if(state->is_psk) {
notification_message(app->notifications, &sequence_success);
scene_manager_next_scene(app->scene_manager, LfRfidSceneRawSuccess);
} else {
popup_set_header(
popup, "Reading\nRAW RFID\nPSK", 89, 30, AlignCenter, AlignTop);
notification_message(app->notifications, &sequence_blink_start_yellow);
lfrfid_worker_stop(app->lfworker);
lfrfid_worker_stop_thread(app->lfworker);
state->is_psk = true;
furi_string_printf(
state->string_file_name,
"%s/%s%s",
LFRFID_SD_FOLDER,
furi_string_get_cstr(app->raw_file_name),
LFRFID_APP_RAW_PSK_EXTENSION);
lfrfid_worker_start_thread(app->lfworker);
lfrfid_worker_read_raw_start(
app->lfworker,
furi_string_get_cstr(state->string_file_name),
LFRFIDWorkerReadTypePSKOnly,
lfrfid_read_callback,
app);
furi_timer_start(state->timer, RAW_READ_TIME);
state->is_psk = true;
furi_timer_start(state->timer, RAW_READ_TIME_MS);
popup_set_header(popup, "Reading PSK", 91, 16, AlignCenter, AlignTop);
notification_message(app->notifications, &sequence_blink_start_yellow);
}
}
}
consumed = true;
}
return consumed;
@@ -115,12 +132,13 @@ void lfrfid_scene_raw_read_on_exit(void* context) {
LfRfidReadRawState* state =
(LfRfidReadRawState*)scene_manager_get_scene_state(app->scene_manager, LfRfidSceneRawRead);
notification_message(app->notifications, &sequence_blink_stop);
popup_reset(app->popup);
lfrfid_worker_stop(app->lfworker);
lfrfid_worker_stop_thread(app->lfworker);
furi_timer_free(state->timer);
furi_timer_free(state->timer);
furi_string_free(state->string_file_name);
free(state);
popup_reset(app->popup);
notification_message(app->notifications, &sequence_blink_stop);
}