//////////////////////////////////////////////////////////////////// // // Mifare Card Explorer for Mac // // Created by Francesco Germinara // // Freeware (c) 2005-2006 SofTech di F.Germinara - www.germinara.it. // // For information please contact me at info@germinara.it //////////////////////////////////////////////////////////////////// // History: // // Description: // //////////////////////////////////////////////////////////////////// #import #import "FGMifareCard.h" @interface FGMifareObj : NSObject { bool bIsDebug; //bIsDebug Debug mode NSString* msgErr;//Error message int nDelayWaitCard;//Dalay Time for test if a card is RF range unsigned char ATQ[2],ATS; unsigned char ChipID[TRIPLE_UID_BYTES]; unsigned char ChipIDSize; SESSION_HANDLE hSess; //Session int nCardsInRF; //Number of card in RF field FGMifareCard *paCard; //A selected card it's a temporary object NSMutableArray *saMifareCardTypes; //Array of MIFARE card type supported NSMutableArray *saGemini2kReader; //Array of Gemini2kReader supported int nIDGemini2kReader; //Reader to use selected by user @public NSMutableArray *paCards; //List of all selected card in the field } -(void) initialize; //Initialize -(void) FillCFGMifareCardInfo; //Fill Card Info -(void) HaltTheCard; //Halt communication with the card -(BOOL) SearchCard:(FGMifareCard *)pSelectedCard; //Check if a card was already registered. -(void) ClearData; //Clear all data card -(void) SetDebugMode:(BOOL) bSts; //For internal Use only -(void) SetReaderToUse:(int) nIndex; //0=Use the first reader how specified in saGemini2kReader array 1=The second and so on... -(void) SetDelayForWaitCard:(int) nMilliSec; //Set the delay time for loop check of card presence in RF field -(int) DelayForWaitCard; //Get the delay time for loop check of card presence in RF field -(bool) ConnectToReader; //Try to open a session and connect to the USB reader //X501 on USB_0 -(bool) ConnectToReader:(int)nIDGemini2k withPort:(NSString*) usbPortName; //Try to open a session and connect to the USB reader //X501 on USB_0 -(void) DisconnectToReader; //Disconnect to the USB reader and release session -(void) DisplayMsgErr; //Helper function to display error message if present and if bIsDebug==TRUE -(void) SetErrorMsg:(NSString*) newMsg; //Set new error message -(void) ForceDisplayMsgErr; //Always display error message, also if not in Debug Mode -(int) SelectAidleCard; //Select Idle Card -(int) NumberOfRegisteredCards; //Return Number of registered card //UI helper -(int) SelectACard:(FGMifareCard *)pSelectedCard; //Select a Card -(void) RemoveCard:(FGMifareCard *)pSelectedCard; //Remove specified card from internal list //Access Data on Card //As Block -(int) ReadBlock :(FGMifareCard *) pSelectedCard forBlock:(int) nBlock usingKeyNum:(int) usingKey dataRead :(unsigned char *)BlockData; //Read a single Block -(int) WriteBlock:(FGMifareCard *) pSelectedCard forBlock:(int) nBlock usingKeyNum:(int) usingKey dataToWrite:(unsigned char *)BlockData; //Write a single Block -(int) EraseBlock:(FGMifareCard *) pSelectedCard forBlock:(int) nBlock usingKeyNum:(int) usingKey; //Erase a single Block //As Sector -(int) ReadSector:(FGMifareCard *) pSelectedCard forSector:(int) nSector usingKeyNum:(int) usingKey dataRead:(unsigned char *)SecData numBytes:(int*) bytesRead; //Read a single sector -(int) WriteSector:(FGMifareCard *) pSelectedCard forSector:(int) nSector usingKeyNum:(int) usingKey dataToWrite:(unsigned char *)SecData; //Write a single sector -(int) EraseSector:(FGMifareCard *) pSelectedCard forSector:(int) nSector usingKeyNum:(int) usingKey;//Erase a single sector -(int) ReadAllSector:(FGMifareCard *) pSelectedCard dataRead:(NSMutableData*) dataOnCard usingKeyNum:(int) usingKey; //Read all data on the card -(int) WriteAllSector:(FGMifareCard *) pSelectedCard withData:(NSMutableData*) dataToWrite usingKeyNum:(int) usingKey; //Write all data to the card -(int) ReadACL:(FGMifareCard *) pSelectedCard forSector:(int) nSector usingKeyNum:(int) usingKey dataRead:(unsigned char *) pACL keyRead:(MIF_KEY*) theKeyB; //Read 4 BYTES ACL -(int) WriteACL:(FGMifareCard *) pSelectedCard forSector:(int)nSector withKey:(MIF_KEY*) theWriteKey dataWrite:(unsigned char *)pACL keyA:(MIF_KEY*) theKeyA keyB:(MIF_KEY*) theKeyB; //Write 4 BYTES ACL @end