mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2025-02-17 05:48:33 +00:00
explicit nodata message when no data parsed from card
This commit is contained in:
parent
a9de06d6f2
commit
809e1b3aff
1 changed files with 22 additions and 7 deletions
|
@ -73,11 +73,11 @@ static bool emv_parse(const NfcDevice* device, FuriString* parsed_data) {
|
||||||
const EmvApplication app = data->emv_application;
|
const EmvApplication app = data->emv_application;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if(strlen(app.application_label))
|
if(strlen(app.application_label)) {
|
||||||
furi_string_cat_printf(parsed_data, "\e#%s\n", app.application_label);
|
furi_string_cat_printf(parsed_data, "\e#%s\n", app.application_label);
|
||||||
else if(strlen(app.application_name))
|
} else if(strlen(app.application_name)) {
|
||||||
furi_string_cat_printf(parsed_data, "\e#%s\n", app.application_name);
|
furi_string_cat_printf(parsed_data, "\e#%s\n", app.application_name);
|
||||||
else
|
} else
|
||||||
furi_string_cat_printf(parsed_data, "\e#%s\n", "EMV");
|
furi_string_cat_printf(parsed_data, "\e#%s\n", "EMV");
|
||||||
|
|
||||||
if(app.pan_len) {
|
if(app.pan_len) {
|
||||||
|
@ -93,10 +93,13 @@ static bool emv_parse(const NfcDevice* device, FuriString* parsed_data) {
|
||||||
furi_string_cat(parsed_data, pan);
|
furi_string_cat(parsed_data, pan);
|
||||||
|
|
||||||
furi_string_free(pan);
|
furi_string_free(pan);
|
||||||
|
parsed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strlen(app.cardholder_name))
|
if(strlen(app.cardholder_name)) {
|
||||||
furi_string_cat_printf(parsed_data, "Cardholder name: %s\n", app.cardholder_name);
|
furi_string_cat_printf(parsed_data, "Cardholder name: %s\n", app.cardholder_name);
|
||||||
|
parsed = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(app.effective_month) {
|
if(app.effective_month) {
|
||||||
char day[] = "??";
|
char day[] = "??";
|
||||||
|
@ -112,6 +115,8 @@ static bool emv_parse(const NfcDevice* device, FuriString* parsed_data) {
|
||||||
day,
|
day,
|
||||||
app.effective_month,
|
app.effective_month,
|
||||||
app.effective_year);
|
app.effective_year);
|
||||||
|
|
||||||
|
parsed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(app.exp_month) {
|
if(app.exp_month) {
|
||||||
|
@ -124,21 +129,31 @@ static bool emv_parse(const NfcDevice* device, FuriString* parsed_data) {
|
||||||
|
|
||||||
furi_string_cat_printf(
|
furi_string_cat_printf(
|
||||||
parsed_data, "Expires: %s.%02X.20%02X\n", day, app.exp_month, app.exp_year);
|
parsed_data, "Expires: %s.%02X.20%02X\n", day, app.exp_month, app.exp_year);
|
||||||
|
|
||||||
|
parsed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FuriString* str = furi_string_alloc();
|
FuriString* str = furi_string_alloc();
|
||||||
bool storage_readed = emv_get_country_name(app.country_code, str);
|
bool storage_readed = emv_get_country_name(app.country_code, str);
|
||||||
|
|
||||||
if(storage_readed)
|
if(storage_readed) {
|
||||||
furi_string_cat_printf(parsed_data, "Country: %s\n", furi_string_get_cstr(str));
|
furi_string_cat_printf(parsed_data, "Country: %s\n", furi_string_get_cstr(str));
|
||||||
|
parsed = true;
|
||||||
|
}
|
||||||
|
|
||||||
storage_readed = emv_get_currency_name(app.currency_code, str);
|
storage_readed = emv_get_currency_name(app.currency_code, str);
|
||||||
if(storage_readed)
|
if(storage_readed) {
|
||||||
furi_string_cat_printf(parsed_data, "Currency: %s\n", furi_string_get_cstr(str));
|
furi_string_cat_printf(parsed_data, "Currency: %s\n", furi_string_get_cstr(str));
|
||||||
|
parsed = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(app.pin_attempts_counter != 0xFF)
|
if(app.pin_attempts_counter != 0xFF) {
|
||||||
furi_string_cat_printf(
|
furi_string_cat_printf(
|
||||||
parsed_data, "PIN attempts left: %d\n", app.pin_attempts_counter);
|
parsed_data, "PIN attempts left: %d\n", app.pin_attempts_counter);
|
||||||
|
parsed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!parsed) furi_string_cat_printf(parsed_data, "No data was parsed\n");
|
||||||
|
|
||||||
parsed = true;
|
parsed = true;
|
||||||
} while(false);
|
} while(false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue