[FL-2369] NFC refactoring (#1095)
* nfc: clean up scenes * nfc worker: remove field on from worker * nfc worker: move full data exchange to furi hal * nfc_device: check UID length * nfc protocol: introduce mifare common API * nfc: move common data to furi hal nfc * nfc: rename emv_decoder -> emv * nfc: move emv data structure to emv lib * nfc: remove deactivate after detection * nfc: rework furi hal nfc detect * nfc: clean up CLI commands and type * nfc: remove unused includes and function * nfc: add TxRxType enum * nfc: read mifare ultralight refactoring * nfc: refactore mifare ultralight start * rfal: fix custom data exchange * nfc: refactor read bank card * nfc: refactor read emv application * nfc: refactor emv test emulation * nfc: refactor uid emulation * nfc: add limit to uid emulation logger * fix source formatting * furi_hal_nfc: fix data exchange full * nfc: fix mifare ultralight type load Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
#define NFC_SCENE_EMULATE_UID_LOG_SIZE_MAX (200)
|
||||
|
||||
enum {
|
||||
NfcSceneEmulateUidStateWidget,
|
||||
NfcSceneEmulateUidStateTextBox,
|
||||
@@ -28,7 +30,7 @@ void nfc_emulate_uid_textbox_callback(void* context) {
|
||||
|
||||
// Add widget with device name or inform that data received
|
||||
static void nfc_scene_emulate_uid_widget_config(Nfc* nfc, bool data_received) {
|
||||
NfcDeviceCommonData* data = &nfc->dev->dev_data.nfc_data;
|
||||
FuriHalNfcDevData* data = &nfc->dev->dev_data.nfc_data;
|
||||
Widget* widget = nfc->widget;
|
||||
widget_reset(widget);
|
||||
string_t info_str;
|
||||
@@ -95,13 +97,15 @@ bool nfc_scene_emulate_uid_on_event(void* context, SceneManagerEvent event) {
|
||||
nfc_scene_emulate_uid_widget_config(nfc, true);
|
||||
}
|
||||
// Update TextBox data
|
||||
string_cat_printf(nfc->text_box_store, "R:");
|
||||
for(uint16_t i = 0; i < reader_data->size; i++) {
|
||||
string_cat_printf(nfc->text_box_store, " %02X", reader_data->data[i]);
|
||||
if(string_size(nfc->text_box_store) < NFC_SCENE_EMULATE_UID_LOG_SIZE_MAX) {
|
||||
string_cat_printf(nfc->text_box_store, "R:");
|
||||
for(uint16_t i = 0; i < reader_data->size; i++) {
|
||||
string_cat_printf(nfc->text_box_store, " %02X", reader_data->data[i]);
|
||||
}
|
||||
string_push_back(nfc->text_box_store, '\n');
|
||||
text_box_set_text(nfc->text_box, string_get_cstr(nfc->text_box_store));
|
||||
}
|
||||
string_push_back(nfc->text_box_store, '\n');
|
||||
memset(reader_data, 0, sizeof(NfcReaderRequestData));
|
||||
text_box_set_text(nfc->text_box, string_get_cstr(nfc->text_box_store));
|
||||
consumed = true;
|
||||
} else if(event.event == GuiButtonTypeCenter && state == NfcSceneEmulateUidStateWidget) {
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewTextBox);
|
||||
|
Reference in New Issue
Block a user