Code example for MifareClassic

Methods: blockToSector, isConnected

-1
	 * @return int lastSectorIndex 
	 * @throws FsgException 
	 */ 
	public int getLastSector(MifareClassic tag) throws FsgException{
		int lastSectorIndex = 1;
		if (tag.isConnected()){
			lastSectorIndex = tag.blockToSector(getEmptyBlock(tag));
		} else { 
			System.out.println("Tag disconnected!");
		} 
		return lastSectorIndex;
	} 
	 
	public void cleanTag(Intent intent) throws FsgException{
		//System.out.println("Cleaning Tag..."); 
		byte[] rights = new byte[4];
		rights[0] = setBit(rights[0], 0);
		rights[0] = setBit(rights[0], 1);
		rights[0] = setBit(rights[0], 2);
		rights[0] = setBit(rights[0], 3);
		rights[0] = setBit(rights[0], 4);