/*******************************************************************************
 *
 *  Module:         mastercard.h
 *
 ******************************************************************************/
#ifndef __EMERGENCY_CARD_H
#define __EMERGENCY_CARD_H

// definice doby po ktere se zapne rezim EMERGENCY karet pokud neprobiha komunikace s masterem
#define PRESET_COMMUNICATION_TIMEOUT		10		// timeout [sec]
#define PRESET_UNIT_START_DELAY				10		// timeout [sec] - doba nabehu po startu, pak odesle paket UNIT_START
#define PRESET_BLOCK_MEASURE_PACKET_DELAY	15		// doba blokovani measure paketu po startu

#define PRESET_ONEWIRE_PRESENCE_COUNTER		5		// detekce odpojeni cidla, pocet mereni
  
#define MAX_NUMBER_EMERGENCY_CARDS			10		// maximalni vyhrazeny prostor pro emergency karty




tUInt GetMaxIndex(void);
unsigned int WriteEmergencyCard(tUChar *UID, tUInt PIN, tUChar position);
unsigned int ReadEmergencyCard(tUChar *UID, tUInt *PIN, tUChar position);

unsigned int RemoveEmergencyCard(tUChar position);
tUInt ClearAllEmergencyCards(void);

tUInt EmergencyCardIsEmpty(tUChar position);
tUInt CheckEmergencyAccess(tUChar *card);
void DoEmergencyAccess(void);

//tUInt CardMemoryIsFormated(void);	
tUInt FormatCardMemory(tUChar formatSize);
tUInt CardMemoryIsEmpty(void);

#endif
