Logo Search packages:      
Sourcecode: pcsc-lite version File versions  Download package

LONG IFDSetPTS ( PREADER_CONTEXT  rContext,
DWORD  dwProtocol,
UCHAR  ucFlags,
UCHAR  ucPTS1,
UCHAR  ucPTS2,
UCHAR  ucPTS3 
)

Set the protocol type selection (PTS). This function sets the appropriate protocol to be used on the card.

Definition at line 36 of file ifdwrapper.c.

References IFDSetCapabilities(), and SCARD_E_UNSUPPORTED_FEATURE.

Referenced by PHSetProtocol().

{
      RESPONSECODE rv = IFD_SUCCESS;
      UCHAR ucValue[1];

#ifndef PCSCLITE_STATIC_DRIVER
      RESPONSECODE(*IFD_set_protocol_parameters) (DWORD, UCHAR, UCHAR,
            UCHAR, UCHAR) = NULL;
      RESPONSECODE(*IFDH_set_protocol_parameters) (DWORD, DWORD, UCHAR,
            UCHAR, UCHAR, UCHAR) = NULL;

      if (rContext->dwVersion == IFD_HVERSION_1_0)
      {
            IFD_set_protocol_parameters = (RESPONSECODE(*)(DWORD, UCHAR, UCHAR,
                  UCHAR, UCHAR)) rContext->psFunctions.psFunctions_v1.pvfSetProtocolParameters;

            if (NULL == IFD_set_protocol_parameters)
                  return SCARD_E_UNSUPPORTED_FEATURE;
      }
      else
      {
            IFDH_set_protocol_parameters = (RESPONSECODE(*)(DWORD, DWORD, UCHAR,
                  UCHAR, UCHAR, UCHAR))
                  rContext->psFunctions.psFunctions_v2.pvfSetProtocolParameters;

            if (NULL == IFDH_set_protocol_parameters)
                  return SCARD_E_UNSUPPORTED_FEATURE;
      }
#endif

      /*
       * Locking is done in winscard.c SCardConnect() and SCardReconnect()
       *
       * This avoids to renegociate the protocol and confuse the card
       * Error returned by CCID driver is: CCID_Receive Procedure byte conflict
       */

      ucValue[0] = rContext->dwSlot;

#ifndef PCSCLITE_STATIC_DRIVER
      if (rContext->dwVersion == IFD_HVERSION_1_0)
      {
              ucValue[0] = rContext->dwSlot;
              (void)IFDSetCapabilities(rContext, TAG_IFD_SLOTNUM, 1, ucValue);
              rv = (*IFD_set_protocol_parameters) (dwProtocol,
                  ucFlags, ucPTS1, ucPTS2, ucPTS3);
      }
      else
      {
            rv = (*IFDH_set_protocol_parameters) (rContext->dwSlot,
                                          dwProtocol,
                                          ucFlags, ucPTS1,
                                          ucPTS2, ucPTS3);
      }
#else
      if (rContext->dwVersion == IFD_HVERSION_1_0)
      {
              ucValue[0] = rContext->dwSlot;
              (void)IFDSetCapabilities(rContext, TAG_IFD_SLOTNUM, 1, ucValue);
            rv = IFD_Set_Protocol_Parameters(dwProtocol, ucFlags, ucPTS1,
                  ucPTS2, ucPTS3);
      }
      else
      {
            rv = IFDHSetProtocolParameters(rContext->dwSlot, dwProtocol,
                  ucFlags, ucPTS1, ucPTS2, ucPTS3);
      }
#endif

      return rv;
}


Generated by  Doxygen 1.6.0   Back to index