NFC: parsers minor cleanup (#3329)
* WashCity cards parser cleanup * umarsh includes cleanup Co-authored-by: gornekich <n.gorbadey@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
3452fbc351
commit
4d99a454fd
@ -32,8 +32,7 @@
|
|||||||
#include <nfc/nfc_device.h>
|
#include <nfc/nfc_device.h>
|
||||||
#include <nfc/helpers/nfc_util.h>
|
#include <nfc/helpers/nfc_util.h>
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <furi_hal_rtc.h>
|
#include <furi_hal_rtc.h>
|
||||||
|
|
||||||
#define TAG "Umarsh"
|
#define TAG "Umarsh"
|
||||||
|
|||||||
@ -26,7 +26,6 @@
|
|||||||
#include <nfc/nfc_device.h>
|
#include <nfc/nfc_device.h>
|
||||||
#include <nfc/helpers/nfc_util.h>
|
#include <nfc/helpers/nfc_util.h>
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define TAG "WashCity"
|
#define TAG "WashCity"
|
||||||
|
|
||||||
@ -158,18 +157,12 @@ static bool washcity_parse(const NfcDevice* device, FuriString* parsed_data) {
|
|||||||
const uint8_t* uid = mf_classic_get_uid(data, &uid_len);
|
const uint8_t* uid = mf_classic_get_uid(data, &uid_len);
|
||||||
|
|
||||||
// Card Number is printed in HEX (equal to UID)
|
// Card Number is printed in HEX (equal to UID)
|
||||||
char card_number[2 * uid_len + 1];
|
uint64_t card_number = nfc_util_bytes2num(uid, uid_len);
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
furi_string_printf(
|
furi_string_printf(
|
||||||
parsed_data,
|
parsed_data,
|
||||||
"\e#WashCity\nCard number: %s\nBalance: %lu.%02u EUR",
|
"\e#WashCity\nCard number: %0*llX\nBalance: %lu.%02u EUR",
|
||||||
|
uid_len * 2,
|
||||||
card_number,
|
card_number,
|
||||||
balance_eur,
|
balance_eur,
|
||||||
balance_cents);
|
balance_cents);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user