Ignore:
Timestamp:
01/11/10 19:30:52 (12 years ago)
Author:
alno
Message:

WebIf:

  • Merging revisions 1180-1185 of trunk
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/monitor-improvement/csctapi/icc_async.c

    r1180 r1189  
    7878        return ICC_ASYNC_IFD_ERROR;
    7979    /* Reset ICC */
     80#ifdef COOL
     81    if (ifd->io->com == RTYP_SCI) {
     82        if (!Cool_Reset(&(icc->atr)))
     83        {
     84            icc->atr = NULL;
     85            return ICC_ASYNC_IFD_ERROR;
     86        }
     87    }
     88    else
     89#endif
    8090    if (IFD_Towitoko_ResetAsyncICC (ifd, &(icc->atr)) != IFD_TOWITOKO_OK)
    8191    {
     
    8393        return ICC_ASYNC_IFD_ERROR;
    8494    }
    85    
    8695    /* Get ICC convention */
    8796    if (ATR_GetConvention (icc->atr, &(icc->convention)) != ATR_OK)
     
    257266}
    258267
    259 #ifdef COOL
    260 extern unsigned char cardbuffer[255];
    261 extern int cardbuflen;
    262 #endif
    263 
    264268int ICC_Async_Transmit (ICC_Async * icc, unsigned size, BYTE * data)
    265269{
     
    283287   
    284288#ifdef COOL
    285 //transmit buffer to SC and put answer in cardbuffer
    286289    if (icc->ifd->io->com == RTYP_SCI) {
    287 #define TIMEOUT 4000 //max 4294
    288     cardbuflen = 256;//it needs to know max buffer size to respond?
    289   if (cnxt_smc_read_write(handle, FALSE, sent, size, cardbuffer, &cardbuflen, TIMEOUT, 0))
    290         return ICC_ASYNC_IFD_ERROR;
    291 
    292 #ifdef DEBUG_IFD
    293   //usually done in IFD_Towitoko, for COOL do it here
    294     printf ("COOLIFD: Transmit: ");
    295     int i;
    296     for (i = 0; i < size; i++)
    297       printf ("%X ", sent[i]);
    298     printf ("\n");
    299 #endif
    300     }
    301     else
    302 #else
     290        if (!Cool_Transmit(sent, size))
     291            return ICC_ASYNC_IFD_ERROR;
     292    }
     293    else
     294#endif
    303295    if (IFD_Towitoko_Transmit (icc->ifd, &timings, size, sent) != IFD_TOWITOKO_OK)
    304296        return ICC_ASYNC_IFD_ERROR;
    305 #endif
    306297   
    307298    if (icc->convention == ATR_CONVENTION_INVERSE)
     
    319310   
    320311#ifdef COOL
    321 //receive  buffer to SC
    322     if (size > cardbuflen)
    323         size = cardbuflen; //never read past end of buffer
    324   memcpy(data,cardbuffer,size);
    325     cardbuflen -= size;
    326     memmove(cardbuffer,cardbuffer+size,cardbuflen);
    327 
    328 #ifdef DEBUG_IFD
    329   int i;
    330   printf ("COOLIFD: Receive: "); //I think
    331   for (i = 0; i < size; i++)
    332     printf ("%X ", data[i]);
    333   printf ("\n");
    334     fflush(stdout);
    335 #endif
    336   return ICC_ASYNC_OK;
     312    if (icc->ifd->io->com == RTYP_SCI) {
     313        if (!Cool_Receive(data, size))
     314            return ICC_ASYNC_IFD_ERROR;
     315    }
     316    else
    337317#else
    338318    if (IFD_Towitoko_Receive (icc->ifd, &timings, size, data) != IFD_TOWITOKO_OK)
Note: See TracChangeset for help on using the changeset viewer.