Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned char * read_Miniate()
- {
- uchar *buffer = NULL;
- uchar buffer_fplength[16];
- uchar status;
- int lengthfp, totalrecorded;
- int count, i, numblocks, j=0;
- count=0;
- //reads length of Minutiae information
- status = MFRC522_Auth(AUTHENTICATION_TYPE, BLOCK_CFG, pkey, serNum);
- if (status == MI_OK)
- status = MFRC522_Read(BLOCK_CFG,buffer_fplength);
- lengthfp = buffer_fplength[0];
- lengthfp <<= 8;
- lengthfp += buffer_fplength[1];
- DPRINTF("READINGMINUTIAE: lengthfp: %d\n", lengthfp);
- numblocks = (ceil((float)(lengthfp)/16)); //catch how many blocks will be used
- DPRINTF("READINGMINUTIAE: numblocks: %d\n", numblocks);
- buffer = (char*) malloc(lengthfp);
- if(status == MI_OK){
- //numblocks = buffer_fplength[0];
- for (i=BLOCK_FPRINT; j<numblocks; i++)
- {
- if((i%4)<3)
- {
- status = MFRC522_Auth(AUTHENTICATION_TYPE, i, pkey, serNum);
- status = MFRC522_Read(i, (uchar*)(buffer+count));
- count += BLOCK_LENGTH;
- j++;
- }
- }
- }
- else
- {
- printf("Error reading fprint length\n");
- }
- DPRINTF("last block: %d\n", i);
- DPRINTF("last count: %d\n", count);
- fp = fopen("frameRD.xyt", "w");
- if(fp == NULL)
- {
- printf("Cannot create file\n");
- free(buffer);
- fclose(fp);
- return;
- }
- totalrecorded = fwrite(buffer, sizeof(char), lengthfp, fp);
- if(totalrecorded != lengthfp)
- {
- printf("Error writing minutiae file\n");
- free(buffer);
- fclose(fp);
- return;
- }
- printf("Minutiae read successfull\n");
- free(buffer);
- fclose(fp);
- //return buffer;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement