コード例 #1
0
        /// <summary>
        /// 初始化串口
        /// </summary>
        /// <returns></returns>
        public bool Open()
        {
            //固定值====
            int parg0;
            int parg1;

            GetPargs(out parg0, out parg1);
            //==========
            Byte pCmd   = CMD_INIT_PORT;
            int  result = 0;

            try
            {
                result = IDCardDriver_SS.UCommand1(ref pCmd, ref parg0, ref parg1, PARAM_PAEG2);
            }
            catch (Exception ex)
            {
                OnReadFailed("设备连接失败," + ex.Message);
                return(false);
            }
            InitSucceed = result == CODE_SUCCESS_ID1;
            if (!InitSucceed)
            {
                string errorMsg = string.Empty;
                if (IDCardDriver_SS.ErrorMsg.ContainsKey(result))
                {
                    errorMsg = IDCardDriver_SS.ErrorMsg[result];
                }
                OnReadFailed("连接设备失败:" + errorMsg);
            }
            return(InitSucceed);
        }
コード例 #2
0
        /// <summary>
        /// 验证卡
        /// </summary>
        /// <returns></returns>
        private int VerifyIDCard()
        {
            byte bCmd = CMD_VERIFY_CARD;//验证信息
            int  parg0;
            int  parg1;

            GetPargs(out parg0, out parg1);
            return(IDCardDriver_SS.UCommand1(ref bCmd, ref parg0, ref parg1, PARAM_PAEG2));// 验证卡
        }
コード例 #3
0
        /// <summary>
        /// 读取卡内信息,保存到本地文件
        /// </summary>
        /// <returns></returns>
        private int ReadCardInner()
        {
            //读取卡信息
            byte bCmd = CMD_READ_BASE_INFO;// '0x44 读卡内信息
            int  parg0;
            int  parg1;

            GetPargs(out parg0, out parg1);
            byte[] parg2 = System.Text.Encoding.Default.GetBytes(_saveFilePath);

            return(IDCardDriver_SS.UCommand1(ref bCmd, ref parg0, ref parg1, parg2));// '读卡内信息
        }
コード例 #4
0
        public void Close()
        {
            //固定值====
            int parg0;
            int parg1;

            GetPargs(out parg0, out parg1);
            //==========
            Byte pCmd = CMD_CLOSE_PORT;

            try
            {
                IDCardDriver_SS.UCommand1(ref pCmd, ref parg0, ref parg1, PARAM_PAEG2);
            }
            catch { }
        }