示例#1
0
        //设置
        private void btnSet_Click(object sender, EventArgs e)
        {
            CardPortBaudForm cardPortBaudForm = new CardPortBaudForm();

            if (cardPortBaudForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string card_port = cardPortBaudForm.card_port.ToString();
            string card_baud = cardPortBaudForm.card_baud.ToString();

            Int16 port = Convert.ToInt16(card_port);
            int   baud = Convert.ToInt32(card_baud);

            int icdev = IC.ic_init(port, baud);

            if (icdev < 0)
            {
                BathClass.printErrorMsg("设置读卡机失败,请重试!");
            }
            else
            {
                BathClass.printInformation("读卡机设置成功!");
                int st = IC.ic_exit(icdev);
            }
        }
示例#2
0
        //连接读卡机
        private static bool connect_card_machine(string cardType)
        {
            if (icdev > 0)
            {
                if (cardType == "SLE4442")
                {
                    IC.ic_exit(icdev);
                }
                else if (cardType == "M1")
                {
                    ICRF.rf_exit(icdev);
                }
            }

            string card_port = IOUtil.get_config_by_key(ConfigKeys.KEY_CARD_PORT);
            string card_baud = IOUtil.get_config_by_key(ConfigKeys.KEY_CARD_BAUD);
            string no_hint   = IOUtil.get_config_by_key(ConfigKeys.KEY_CARD_NOHINT);

            if ((card_port == "" || card_baud == ""))
            {
                CardPortBaudForm cardPortBaudForm = new CardPortBaudForm();
                if (cardPortBaudForm.ShowDialog() != DialogResult.OK)
                {
                    return(false);
                }

                card_port = cardPortBaudForm.card_port.ToString();
                card_baud = cardPortBaudForm.card_baud.ToString();
            }

            if (card_port == "" || card_baud == "")
            {
                return(false);
            }

            Int16 port = Convert.ToInt16(card_port);
            int   baud = Convert.ToInt32(card_baud);

            if (cardType == "SLE4442")
            {
                icdev = IC.ic_init(port, baud);
            }
            else if (cardType == "M1")
            {
                icdev = ICRF.rf_init(port, baud);
            }
            if (icdev <= 0)
            {
                BathClass.printErrorMsg("连接读卡器失败,请重试!");
                return(false);
            }
            return(true);
        }
示例#3
0
        //连接读卡机
        private static bool connect_card_machine(string cardType)
        {
            if (icdev > 0)
            {
                if (cardType == "SLE4442")
                    IC.ic_exit(icdev);
                else if (cardType == "M1")
                    ICRF.rf_exit(icdev);
            }

            string card_port = BathClass.get_config_by_key("card_port");
            string card_baud = BathClass.get_config_by_key("card_baud");
            string no_hint = BathClass.get_config_by_key("no_hint");
            if ((card_port == "" || card_baud == "") && (no_hint == "" || no_hint == "false"))
            {
                CardPortBaudForm cardPortBaudForm = new CardPortBaudForm();
                if (cardPortBaudForm.ShowDialog() != DialogResult.OK)
                    return false;

                card_port = cardPortBaudForm.card_port.ToString();
                card_baud = cardPortBaudForm.card_baud.ToString();
            }

            if (card_port == "" || card_baud == "")
                return false;

            Int16 port = Convert.ToInt16(card_port);
            int baud = Convert.ToInt32(card_baud);

            if (cardType == "SLE4442")
                icdev = IC.ic_init(port, baud);
            else if (cardType == "M1")
                icdev = ICRF.rf_init(port, baud);
            if (icdev <= 0)
            {
                BathClass.printErrorMsg("连接读卡器失败,请重试!");
                return false;
            }
            return true;
        }
示例#4
0
        //设置
        private void btnSet_Click(object sender, EventArgs e)
        {
            CardPortBaudForm cardPortBaudForm = new CardPortBaudForm();
            if (cardPortBaudForm.ShowDialog() != DialogResult.OK)
                return;

            string card_port = cardPortBaudForm.card_port.ToString();
            string card_baud = cardPortBaudForm.card_baud.ToString();

            Int16 port = Convert.ToInt16(card_port);
            int baud = Convert.ToInt32(card_baud);

            int icdev = IC.ic_init(port, baud);
            if (icdev < 0)
            {
                BathClass.printErrorMsg("设置读卡机失败,请重试!");
            }
            else
            {
                BathClass.printInformation("读卡机设置成功!");
                int st = IC.ic_exit(icdev);
            }
        }