示例#1
0
s16 emvPoll()
{
    emvTypeA = 0;
    emvTypeB = 0;

    /* Poll as long as no cards are found. */
    while (1)
    {
        if (emvStopRequestReceived())
            return EMV_ERR_STOPPED;

        if (emvTypeA != 0)
		{
			LOG("has a A card");
            break;

		}

        /* Wait for t_p. */
        emvHalSleepMilliseconds(EMV_T_P);
        if (emvTypeACardPresent())
        {
            /* ISO14443-A card(s) found. */
            emvTypeA = 1;
			
            /* Send HLTA command. */
            u8 hltaCommand[2] = { 0x50, 0x00 };
			
            emvHalTransceive(hltaCommand, sizeof(hltaCommand), NULL, 0, NULL, EMV_HLTA_FDT, EMV_HAL_TRANSCEIVE_WITH_CRC);
        }
        if (emvTypeB != 0)
		{
			LOG("has a B card");
            break;

		}

        /* Wait for t_p. */
        emvHalSleepMilliseconds (EMV_T_P);

        if (emvTypeBCardPresent())
        {
            /* ISO14443-B card(s) found. */
            emvTypeB = 1;
        }
    }

    return EMV_ERR_OK;
}
示例#2
0
void emvPollSingleIteration()
{
    emvTypeA = 0;
    emvTypeB = 0;

    emvHalSleepMilliseconds(EMV_T_P);
    if (emvTypeACardPresent())
    {
        /* ISO14443-A card(s) found. */
        emvTypeA = 1;

        /* Send HLTA command. */
        u8 hltaCommand[2] = { 0x50, 0x00 };
        emvHalTransceive(hltaCommand, sizeof(hltaCommand), NULL, 0, NULL, EMV_HLTA_FDT, EMV_HAL_TRANSCEIVE_WITH_CRC);
    }

    emvHalSleepMilliseconds(EMV_T_P);
    if (emvTypeBCardPresent())
    {
        /* ISO14443-B card(s) found. */
        emvTypeB = 1;
    }
}
示例#3
0
s16 emvPollSingleIteration()
{
    int count = 1;
   emvTypeA = 0;
    emvTypeB = 0;

    
    while(count--) 
    {
      //sxl 13/10/08  每100ms开一次场强,发送一次命令
        emvHalActivateField(FALSE);
        DelayMs(100);
        emvHalActivateField(TRUE);

        if (emvStopRequestReceived())
            return EMV_ERR_STOPPED;

        if (emvTypeA != 0)
          {
		   
	       return EMV_ERR_OK;
          
		}     
              
        emvHalSleepMilliseconds(EMV_T_P);
      //s_UartPrint("emvTypeACardPresent = %d\r\n", emvTypeACardPresent());//sxl
        
        if (emvTypeACardPresent())
        {
           
            emvTypeA = 1;
           LOG("has a A card");
            /* Send HLTA command. */
            u8 hltaCommand[2] = { 0x50, 0x00 };
            emvHalTransceive(hltaCommand, sizeof(hltaCommand), NULL, 0, NULL, EMV_HLTA_FDT, EMV_HAL_TRANSCEIVE_WITH_CRC);
            
        }

        if (emvTypeB != 0)
          {
			;
	        return EMV_ERR_OK;
      

		} 
         
        emvHalSleepMilliseconds (EMV_T_P);
     //s_UartPrint("emvTypeBCardPresent = %d\r\n", emvTypeBCardPresent());//sxl
        
        if (emvTypeBCardPresent())
        {
          emvTypeB = 1;
          LOG("has a B card");
            
        }
    }
	if (emvTypeB != 0 || emvTypeA != 0)
	{
        return EMV_ERR_OK;

	}
	return EMV_ERR_TIMEOUT;
}