Code cleanup

This commit is contained in:
Methodius 2024-01-06 03:18:32 +09:00
parent 1bae3d19ee
commit d2549b3b1a
No known key found for this signature in database
GPG key ID: 122FA99A00B41679
3 changed files with 14 additions and 98 deletions

View file

@ -101,15 +101,6 @@ App(
sources=["plugins/supported_cards/metromoney.c"],
)
App(
appid="washcity_parser",
apptype=FlipperAppType.PLUGIN,
entry_point="washcity_plugin_ep",
targets=["f7"],
requires=["nfc"],
sources=["plugins/supported_cards/washcity.c"],
)
App(
appid="kazan_parser",
apptype=FlipperAppType.PLUGIN,
@ -164,6 +155,15 @@ App(
sources=["plugins/supported_cards/hid.c"],
)
App(
appid="washcity_parser",
apptype=FlipperAppType.PLUGIN,
entry_point="washcity_plugin_ep",
targets=["f7"],
requires=["nfc"],
sources=["plugins/supported_cards/washcity.c"],
)
App(
appid="nfc_start",
targets=["f7"],

View file

@ -26,7 +26,6 @@
#include <nfc/nfc_device.h>
#include <nfc/helpers/nfc_util.h>
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
#include <stdint.h>
#define TAG "WashCity"
@ -151,27 +150,21 @@ static bool washcity_parse(const NfcDevice* device, FuriString* parsed_data) {
uint32_t balance = nfc_util_bytes2num(block_start_ptr + 2, 2);
uint32_t balance_eur = balance / 100;
uint32_t balance_usd = balance / 100;
uint8_t balance_cents = balance % 100;
size_t uid_len = 0;
const uint8_t* uid = mf_classic_get_uid(data, &uid_len);
// Card Number is printed in HEX (equal to UID)
char card_number[2 * uid_len + 1];
for(size_t i = 0; i < uid_len; ++i) {
card_number[2 * i] = "0123456789ABCDEF"[uid[i] >> 4];
card_number[2 * i + 1] = "0123456789ABCDEF"[uid[i] & 0xF];
}
card_number[2 * uid_len] = '\0';
uint64_t card_number = nfc_util_bytes2num(uid, uid_len);
furi_string_printf(
parsed_data,
"\e#WashCity\nCard number: %s\nBalance: %lu.%02u EUR",
"\e#WashCity\nCard number: %0*llX\nBalance: %lu.%02u USD",
uid_len * 2,
card_number,
balance_eur,
balance_usd,
balance_cents);
parsed = true;
} while(false);

View file

@ -1,77 +0,0 @@
Filetype: Flipper NFC device
Version: 3
# Nfc device type can be UID, Mifare Ultralight, Mifare Classic or ISO15693
Device type: Mifare Classic
# UID is common for all formats
UID: 96 00 CA FE
# ISO14443 specific fields
ATQA: 00 04
SAK: 08
# Mifare Classic specific data
Mifare Classic type: 1K
Data format version: 2
# Mifare Classic blocks, '??' means unknown data
Block 0: 96 00 CA FE A2 08 04 00 01 B4 B9 86 13 27 F8 1D
Block 1: FF 00 00 02 00 02 00 02 00 02 00 02 00 02 00 02
Block 2: 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 3: A0 A1 A2 A3 A4 A5 78 77 88 81 01 01 55 01 01 00
Block 4: 02 E4 07 D0 80 01 00 00 00 00 00 00 00 00 00 01
Block 5: 00 00 00 00 00 00 00 00 1B 93 CD 00 00 00 00 FF
Block 6: 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 01
Block 7: C7 8A 3D 0E 1B CD FF 07 80 69 FF FF FF FF FF FF
Block 8: 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00
Block 9: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF
Block 10: 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 01
Block 11: C7 8A 3D 0E 00 00 FF 07 80 69 FF FF FF FF FF FF
Block 12: 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00
Block 13: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF
Block 14: 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 01
Block 15: C7 8A 3D 0E 00 00 FF 07 80 69 FF FF FF FF FF FF
Block 16: 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00
Block 17: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF
Block 18: 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 01
Block 19: C7 8A 3D 0E 00 00 FF 07 80 69 FF FF FF FF FF FF
Block 20: 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00
Block 21: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF
Block 22: 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 01
Block 23: C7 8A 3D 0E 00 00 FF 07 80 69 FF FF FF FF FF FF
Block 24: 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00
Block 25: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF
Block 26: 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 01
Block 27: C7 8A 3D 0E 00 00 FF 07 80 69 FF FF FF FF FF FF
Block 28: 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00
Block 29: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF
Block 30: 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 01
Block 31: C7 8A 3D 0E 00 00 FF 07 80 69 FF FF FF FF FF FF
Block 32: 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00
Block 33: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF
Block 34: 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 01
Block 35: C7 8A 3D 0E 00 00 FF 07 80 69 FF FF FF FF FF FF
Block 36: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 37: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 38: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 39: 01 01 55 01 01 00 FF 07 80 69 FF FF FF FF FF FF
Block 40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 41: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 42: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 43: 01 01 55 01 01 00 FF 07 80 69 FF FF FF FF FF FF
Block 44: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 45: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 46: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 47: 01 01 55 01 01 00 FF 07 80 69 FF FF FF FF FF FF
Block 48: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 49: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 51: 01 01 55 01 01 00 FF 07 80 69 FF FF FF FF FF FF
Block 52: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 53: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 54: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 55: 01 01 55 01 01 00 FF 07 80 69 FF FF FF FF FF FF
Block 56: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 57: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 58: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 59: 01 01 55 01 01 00 FF 07 80 69 FF FF FF FF FF FF
Block 60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 61: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 62: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 63: 01 01 55 01 01 00 FF 07 80 69 FF FF FF FF FF FF