1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
tm_xmas.tm_mon = 12 - 1;
tm_xmas.tm_mday = 25;
// ajustement
{
time_t xmas = mktime (&tm_xmas);
strftime (s, sizeof s, "%d/%m/%Y", &tm_xmas);
printf ("Noel : %s\n", s);
{
time_t diff = difftime (xmas, now);
struct tm tm_diff = *gmtime (&diff);
printf ("Plus que %d jours avant Noel\n", tm_diff.tm_yday);
}
}
}
//------------------------------------------------------------------------------
/*------------RECHERCHE ET OUVERTURE COMMUNICATION-------------*/
ret=CSC_SearchCSC();
if (ret!=RCSC_Ok) //Test d'ouverture
{
printf("COMMUNICATION IMPOSSIBLE\n");
}
else
{
ret=CSC_CardStartSearch(); //Recherche d'une carte
}
if(ret==RCSC_Ok)
{
ret=CSC_SearchCardExt(&SearchExt,search_mask,FORGET,TIMEOUT,&COM,&respLength,response);
if(ret==RCSC_Ok)
{
printf("--------- COMMUNICATION OK & PRESENCE D'UNE CARTE ---------\n") ;
}
else
{
printf("--------- COMMUNICATION OK & AUCUNE CARTE ---------\n") ;
}
/*-------------------------------------------------------------*/
/*--------------------VERSION DU COUPLEUR----------------------*/
ret=CSC_VersionCSC(version); // display SW version
if (ret!=RCSC_Ok)
{
printf("\nERREUR DE LECTURE DE LA VERSION DU COUPLEUR\n");
}
else
{
printf("\nVERSION DU COUPLEUR :\n%s\n\n",version); // print SW version
}
/*-------------------------------------------------------------*/
/*--------------------LECTURE DES DONNEES----------------------*/
if(ret!=RCSC_Ok)
{
printf("LECTURE FAILED\n");
}
else
{
do
{
ret=CSC_SearchCSC();
ret=CSC_CardStartSearch(); //Recherche d'une carte
ret=CSC_SearchCardExt(&SearchExt,search_mask,FORGET,TIMEOUT,&COM,&respLength,response);
printf("\nLecture des donnees....................................\n\nNumero de serie [Hexa]: 0");
for (indice=0; indice<REC_LENGTH; indice++) //Incrémentation
{
printf("%x", response[indice]);
}
printf("\n\n....................................Lecture effectuee avec succes\n\n");
printf("Voulez vous testez une autre carte ?(PRESS ENTRER ou n)");
}
while (getchar()!= 'n');
}
}
/*-------------------------------------------------------------*/
/*-------------------FERMETURE COMMUNICATION-------------------*/
CSC_Close() ;
/*-------------------------------------------------------------*/
} |
Partager