Exemple #1
0
        /// <summary>
        /// Power On card
        /// </summary>
        public static string AnswerToReset(ref string response)
        {
            response = "";

            if (selectedReaderType == "")
            {
                // No reader manager selected
                return(lMan.GetString("noselreader"));
            }

            // create alias
            IReader rSelected = (IReader)ReaderManager[selectedReaderType];

            // check for smartmouse serial reader
            if (selectedReaderType == "SmartMouse Serial")
            {
                // Apply serial port settings
                ((SmartMouseReader)rSelected).PortDataBit        = SerialSettings.DataBits;
                ((SmartMouseReader)rSelected).PortName           = selectedReader;
                ((SmartMouseReader)rSelected).PortStopBit        = SerialSettings.StopBits;
                ((SmartMouseReader)rSelected).PortParity         = SerialSettings.Parity;
                ((SmartMouseReader)rSelected).PortSpeed          = SerialSettings.PortSpeedReset;
                ((SmartMouseReader)rSelected).IsDirectConvention = SerialSettings.IsDirectConvention;

                ret = ((SmartMouseReader)rSelected).ApplySettings();

                if (ret != "")
                {
                    // Error detected
                    return(ret);
                }
            }


            // Get ATR
            ret = rSelected.AnswerToReset(ref response);

            if (ret != "")
            {
                // Error detected
                return(ret);
            }

            response = AddSpace(response);

            // set selected reader powered
            isPowered = true;

            // check for smartmouse serial reader
            if (selectedReaderType == "SmartMouse Serial")
            {
                // change port speed after reset
                ((SmartMouseReader)rSelected).PortSpeed = SerialSettings.PortSpeed;
                ret = ((SmartMouseReader)rSelected).ApplySettings();

                if (ret != "")
                {
                    // error detected
                    return(ret);
                }
            }

            return("");
        }