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

LONG IFDOpenIFD ( PREADER_CONTEXT  rContext  ) 

Open a communication channel to the IFD.

Definition at line 112 of file ifdwrapper.c.

{
      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->dwVersion == IFD_HVERSION_1_0)
            IO_create_channel =
                  rContext->psFunctions.psFunctions_v1.pvfCreateChannel;
      else
            if (rContext->dwVersion == 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)SYS_MutexLock(rContext->mMutex);

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

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

      return rv;
}


Generated by  Doxygen 1.6.0   Back to index