コード例 #1
0
        private void btnMSR_Click(object sender, EventArgs e)
        {
            msr = new OPOSMSR();
            int nRC = msr.Open("DefaultPOSMSR");

            if (nRC == (int)OPOS_Constants.OPOS_SUCCESS)
            {
                msr.TracksToRead = (int)OPOSMSRConstants.MSR_TR_2;

                nRC = msr.ClaimDevice(5000);

                msr.DeviceEnabled    = true;
                msr.DataEventEnabled = true;
                msr.DataEvent       += new _IOPOSMSREvents_DataEventEventHandler(msr_DataEvent);
            }
            else
            {
                MessageBox.Show("Error");
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override DeviceStatus Open()
        {
            if (Status == DeviceStatus.Opened)
            {
                return(Status);
            }

            if (!UseYN)
            {
                throw new Exception("MSR 사용 안함.");
            }

            Status = DeviceStatus.Closed;
            try
            {
                var rc = m_device.Open(Config.LogicalName);
                if (rc == (int)OPOS_Constants.OPOS_SUCCESS)
                {
                    rc = m_device.ClaimDevice(5000);
                    if (rc == (int)OPOS_Constants.OPOS_SUCCESS)
                    {
                        Status = DeviceStatus.Opened;
                    }
                    else
                    {
                        Status = DeviceStatus.InitError;
                    }
                }
                else
                {
                    Status = DeviceStatus.OpenError;
                }
            }
            catch (Exception ex)
            {
                throw new Exception("MSR 오픈 오류.", ex);
            }

            base.Open();
            return(Status);
        }