/*
         * Initializes the SDK and sets main variables
         */
        public void Initiate()
        {
            //Must always be called in the beginning of the program
            PTEID_ReaderSet.initSDK();

            //Gets the set of connected readers, if there is any inserted
            readerSet = PTEID_ReaderSet.instance();

            //Gets the first reader
            //When multiple readers are connected, you should iterate through the various indexes with the methods getReaderName and getReaderByName
            readerContext = readerSet.getReader();

            //Gets the card instance
            eidCard = readerContext.getEIDCard();
        }
Пример #2
0
        public static void Init(String readerName)
        {
            try
            {
                PTEID_ReaderSet.initSDK();
                readerSet = PTEID_ReaderSet.instance();
                if (readerName == null || readerName == String.Empty)
                {
                    readerContext = readerSet.getReader();
                }
                else
                {
                    readerContext = readerSet.getReaderByName(readerName);
                }

                pteidlib_dotNet.setCompatReaderContext(readerContext);

                idCard = readerContext.getEIDCard();
            }
            catch (PTEID_ExNoReader)
            {
                throw new PteidException(SC_ERROR_NO_READERS_FOUND);
            }
            catch (PTEID_ExNoCardPresent)
            {
                throw new PteidException(SC_ERROR_CARD_NOT_PRESENT);
            }
            catch (PTEID_ExCardTypeUnknown)
            {
                throw new PteidException(SC_ERROR_INVALID_CARD);
            }
            catch (PTEID_Exception ex)
            {
                throw new PteidException(ex.GetError());
            }
        }