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

LONG IFDOpenIFD ( READER_CONTEXT *  rContext  ) 

Open a communication channel to the IFD.

Definition at line 120 of file ifdwrapper.c.

References IFDHCreateChannel(), and IFDHCreateChannelByName().

{
      RESPONSECODE rv = 0;

#ifndef PCSCLITE_STATIC_DRIVER
      RESPONSECODE(*IO_create_channel) (DWORD) = NULL;
      RESPONSECODE(*IFDH_create_channel) (DWORD, DWORD) = NULL;
      RESPONSECODE(*IFDH_create_channel_by_name) (DWORD, LPSTR) = NULL;

      if (rContext->version == IFD_HVERSION_1_0)
            IO_create_channel =
                  rContext->psFunctions.psFunctions_v1.pvfCreateChannel;
      else
            if (rContext->version == IFD_HVERSION_2_0)
                  IFDH_create_channel =
                        rContext->psFunctions.psFunctions_v2.pvfCreateChannel;
            else
            {
                  IFDH_create_channel =
                        rContext->psFunctions.psFunctions_v3.pvfCreateChannel;
                  IFDH_create_channel_by_name =
                        rContext->psFunctions.psFunctions_v3.pvfCreateChannelByName;
            }
#endif

      /* LOCK THIS CODE REGION */
      (void)pthread_mutex_lock(rContext->mMutex);

#ifndef PCSCLITE_STATIC_DRIVER
      if (rContext->version == IFD_HVERSION_1_0)
      {
            rv = (*IO_create_channel) (rContext->port);
      } else if (rContext->version == IFD_HVERSION_2_0)
      {
            rv = (*IFDH_create_channel) (rContext->slot, rContext->port);
      } else
      {
            /* use device name only if defined */
            if (rContext->lpcDevice[0] != '\0')
                  rv = (*IFDH_create_channel_by_name) (rContext->slot, rContext->lpcDevice);
            else
                  rv = (*IFDH_create_channel) (rContext->slot, rContext->port);
      }
#else
#ifdef IFDHANDLERv1
      rv = IO_Create_Channel(rContext->port);
#elif defined(IFDHANDLERv2)
      rv = IFDHCreateChannel(rContext->slot, rContext->port);
#else
      {
            /* Use device name only if defined */
            if (rContext->lpcDevice[0] != '\0')
                  rv = IFDHCreateChannelByName(rContext->slot, rContext->lpcDevice);
            else
                  rv = IFDHCreateChannel(rContext->slot, rContext->port);
      }
#endif
#endif

      /* END OF LOCKED REGION */
      (void)pthread_mutex_unlock(rContext->mMutex);

      return rv;
}


Generated by  Doxygen 1.6.0   Back to index