Получение uid карты

This commit is contained in:
dimoniche 2025-05-28 23:03:19 +03:00
parent bafedcd137
commit 39441483d2
2 changed files with 18 additions and 0 deletions

View File

@ -39,6 +39,19 @@ void set_abonement_data(abonement_data* data)
memcpy(&abonement, &data, sizeof(abonement_data)); memcpy(&abonement, &data, sizeof(abonement_data));
} }
uint32_t get_mifare_uid()
{
uint32_t card_uid = 0;
uid_struct * uid = get_uid();
if(uid->size == 4)
{
memcpy(&card_uid, &uid->uidByte[0], 4);
}
return card_uid;
}
/** /**
* Calculates the bit pattern needed for the specified access bits. In the [C1 C2 C3] tuples C1 is MSB (=4) and C3 is LSB (=1). * Calculates the bit pattern needed for the specified access bits. In the [C1 C2 C3] tuples C1 is MSB (=4) and C3 is LSB (=1).
*/ */
@ -287,6 +300,7 @@ mifaredata_t* init_mifare_card_data()
CPU_INT32U password; CPU_INT32U password;
GetData(&PassDescAdmin, &password, 0, DATA_FLAG_SYSTEM_INDEX); GetData(&PassDescAdmin, &password, 0, DATA_FLAG_SYSTEM_INDEX);
abonement.uid[0] = password; abonement.uid[0] = password;
abonement.number_abonement = get_mifare_uid();
return &mifare_card_data; return &mifare_card_data;
} }

View File

@ -41,4 +41,8 @@ extern bool is_empty_mifare_card();
extern bool need_clear_bonus(); extern bool need_clear_bonus();
extern void stop_card_working(); extern void stop_card_working();
/// @brief
/// @return
uint32_t get_mifare_uid();
#endif #endif