/*
         * 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();
        }
Exemplo n.º 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());
            }
        }
Exemplo n.º 3
0
        public ActionResult Get()
        {
            // DOC: https://amagovpt.github.io/autenticacao.gov/manual_sdk.html#windows

            try
            {
                PTEID_ReaderContext readerContext = PTEID_ReaderSet.instance().getReader();
                PTEID_EIDCard       card          = readerContext.getEIDCard();

                var data = GetData(card);

                return(Ok(data));
            }
            catch (PTEID_ExNoCardPresent)
            {
                return(NotFound());
            }
        }