Пример #1
0
        /**m* SCardChannel/Disconnect
         *
         * NAME
         *   SCardChannel.Disconnect()
         *
         * SYNOPSIS
         *   bool Disconnect()
         *   bool Disconnect(uint disposition)
         *
         * DESCRIPTION
         *   Close the connection channel
         *
         * INPUTS
         *   The disposition parameter must take one of the following values:
         *   - SCARD.EJECT_CARD
         *   - SCARD.UNPOWER_CARD
         *   - SCARD.RESET_CARD
         *   - SCARD.LEAVE_CARD
         *   If this parameter is omitted, it defaults to SCARD.RESET_CARD
         *
         * SEE ALSO
         *   SCardChannel.Connect
         *
         **/

        public virtual bool Disconnect(uint disposition)
        {
            uint rc;

            Trace.WriteLine("Disconnect, disposition=" + disposition);

            rc = SCARD.Disconnect(_hCard, disposition);
            if (rc != SCARD.S_SUCCESS)
            {
                _last_error = rc;
            }

            _hCard = IntPtr.Zero;

            if (rc != SCARD.S_SUCCESS)
            {
                return(false);
            }

            return(true);
        }