[FL-1972], [FL-1920] Mifare Ultralight and NTAG separation (#918)
* nfc: rename read mifare ultralight menu * nfc: separate ntag and mifare ultralight * nfc: save Mifare Ultralight type * nfc: add valid ack and nack messages * nfc: add compatible write command implementation * nfc: support f6 target
This commit is contained in:
@@ -44,15 +44,15 @@ void nfc_scene_delete_on_enter(void* context) {
|
||||
}
|
||||
widget_add_string_element(nfc->widget, 64, 21, AlignCenter, AlignTop, FontSecondary, uid_str);
|
||||
|
||||
if(data->protocol > NfcDeviceProtocolUnknown) {
|
||||
const char* protocol_name = NULL;
|
||||
if(data->protocol == NfcDeviceProtocolEMV) {
|
||||
protocol_name = nfc_guess_protocol(data->protocol);
|
||||
} else if(data->protocol == NfcDeviceProtocolMifareUl) {
|
||||
protocol_name = nfc_mf_ul_type(nfc->dev->dev_data.mf_ul_data.type, false);
|
||||
}
|
||||
if(protocol_name) {
|
||||
widget_add_string_element(
|
||||
nfc->widget,
|
||||
10,
|
||||
32,
|
||||
AlignLeft,
|
||||
AlignTop,
|
||||
FontSecondary,
|
||||
nfc_get_protocol(data->protocol));
|
||||
nfc->widget, 10, 32, AlignLeft, AlignTop, FontSecondary, protocol_name);
|
||||
}
|
||||
// TODO change dinamically
|
||||
widget_add_string_element(nfc->widget, 118, 32, AlignRight, AlignTop, FontSecondary, "NFC-A");
|
||||
|
@@ -68,15 +68,15 @@ void nfc_scene_device_info_on_enter(void* context) {
|
||||
}
|
||||
widget_add_string_element(nfc->widget, 64, 21, AlignCenter, AlignTop, FontSecondary, uid_str);
|
||||
|
||||
if(data->protocol > NfcDeviceProtocolUnknown) {
|
||||
const char* protocol_name = NULL;
|
||||
if(data->protocol == NfcDeviceProtocolEMV) {
|
||||
protocol_name = nfc_guess_protocol(data->protocol);
|
||||
} else if(data->protocol == NfcDeviceProtocolMifareUl) {
|
||||
protocol_name = nfc_mf_ul_type(nfc->dev->dev_data.mf_ul_data.type, false);
|
||||
}
|
||||
if(protocol_name) {
|
||||
widget_add_string_element(
|
||||
nfc->widget,
|
||||
10,
|
||||
32,
|
||||
AlignLeft,
|
||||
AlignTop,
|
||||
FontSecondary,
|
||||
nfc_get_protocol(data->protocol));
|
||||
nfc->widget, 10, 32, AlignLeft, AlignTop, FontSecondary, protocol_name);
|
||||
}
|
||||
// TODO change dinamically
|
||||
widget_add_string_element(nfc->widget, 118, 32, AlignRight, AlignTop, FontSecondary, "NFC-A");
|
||||
|
@@ -27,7 +27,7 @@ void nfc_scene_read_card_success_on_enter(void* context) {
|
||||
nfc,
|
||||
NFC_SCENE_READ_SUCCESS_SHIFT "%s\n" NFC_SCENE_READ_SUCCESS_SHIFT
|
||||
"ATQA: %02X%02X SAK: %02X\nUID: %02X %02X %02X %02X",
|
||||
nfc_get_protocol(data->protocol),
|
||||
nfc_guess_protocol(data->protocol),
|
||||
data->atqa[0],
|
||||
data->atqa[1],
|
||||
data->sak,
|
||||
@@ -41,7 +41,7 @@ void nfc_scene_read_card_success_on_enter(void* context) {
|
||||
NFC_SCENE_READ_SUCCESS_SHIFT
|
||||
"%s\n" NFC_SCENE_READ_SUCCESS_SHIFT
|
||||
"ATQA: %02X%02X SAK: %02X\nUID: %02X %02X %02X %02X %02X %02X %02X",
|
||||
nfc_get_protocol(data->protocol),
|
||||
nfc_guess_protocol(data->protocol),
|
||||
data->atqa[0],
|
||||
data->atqa[1],
|
||||
data->sak,
|
||||
|
@@ -28,11 +28,13 @@ void nfc_scene_read_mifare_ul_success_on_enter(void* context) {
|
||||
|
||||
// Setup dialog view
|
||||
NfcDeviceCommonData* data = &nfc->dev->dev_data.nfc_data;
|
||||
MifareUlData* mf_ul_data = &nfc->dev->dev_data.mf_ul_data;
|
||||
DialogEx* dialog_ex = nfc->dialog_ex;
|
||||
dialog_ex_set_left_button_text(dialog_ex, "Retry");
|
||||
dialog_ex_set_right_button_text(dialog_ex, "More");
|
||||
dialog_ex_set_center_button_text(dialog_ex, "Data");
|
||||
dialog_ex_set_header(dialog_ex, "Mifare Ultralight", 22, 8, AlignLeft, AlignCenter);
|
||||
dialog_ex_set_header(
|
||||
dialog_ex, nfc_mf_ul_type(mf_ul_data->type, true), 64, 8, AlignCenter, AlignCenter);
|
||||
dialog_ex_set_icon(dialog_ex, 8, 13, &I_Medium_chip_22x21);
|
||||
// Display UID
|
||||
nfc_text_store_set(
|
||||
@@ -54,7 +56,6 @@ void nfc_scene_read_mifare_ul_success_on_enter(void* context) {
|
||||
dialog_ex_set_result_callback(dialog_ex, nfc_scene_read_mifare_ul_success_dialog_callback);
|
||||
|
||||
// Setup TextBox view
|
||||
MifareUlData* mf_ul_data = &nfc->dev->dev_data.mf_ul_data;
|
||||
TextBox* text_box = nfc->text_box;
|
||||
text_box_set_context(text_box, nfc);
|
||||
text_box_set_exit_callback(text_box, nfc_scene_read_mifare_ul_success_text_box_callback);
|
||||
|
@@ -23,7 +23,7 @@ void nfc_scene_scripts_menu_on_enter(void* context) {
|
||||
nfc);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Read Mifare Ultralight",
|
||||
"Read Mifare Ultral/Ntag",
|
||||
SubmenuIndexMifareUltralight,
|
||||
nfc_scene_scripts_menu_submenu_callback,
|
||||
nfc);
|
||||
|
Reference in New Issue
Block a user