Exemplo n.º 1
0
 /// <summary>
 /// Closes a connection with MSR.
 /// </summary>
 public void Close()
 {
     if (this.oposMsr != null)
     {
         this.oposMsr.DataEvent  -= this.OnMsrDataEvent;
         this.oposMsr.ErrorEvent -= this.OnMsrErrorEvent;
         this.oposMsr.ReleaseDevice();
         this.oposMsr.Close();
         this.oposMsr = null;
     }
 }
Exemplo n.º 2
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");
            }
        }
Exemplo n.º 3
0
            /// <summary>
            /// Opens a peripheral.
            /// </summary>
            /// <param name="peripheralName">Name of the peripheral.</param>
            /// <param name="peripheralConfig">Configuration parameters of the peripheral.</param>
            public void Open(string peripheralName, PeripheralConfiguration peripheralConfig)
            {
                this.oposMsr = new OPOSMSR();

                // Open
                this.oposMsr.Open(peripheralName);
                OposHelper.CheckResultCode(this, this.oposMsr.ResultCode);

                // Claim
                this.oposMsr.ClaimDevice(OposHelper.ClaimTimeOut);
                OposHelper.CheckResultCode(this, this.oposMsr.ResultCode);

                // Enable/Configure
                this.oposMsr.DeviceEnabled = true;

                // Set the decode data - so that the device decodes the scanned data
                this.oposMsr.DecodeData = true;

                // Note: there are two properties that look similar
                // ParseDecodedData and ParseDecodeData
                // Both do the same as per the OPOS spec.
                // Setting this property makes the device return data
                // in individual fields.
                this.oposMsr.ParseDecodedData = true;

                // Set Transmit Sentinels to true
                // so that when the data is sent, we can get the sentenels
                // and can parse the data of the tracks.
                this.oposMsr.TransmitSentinels = true;

                // Plug in handlers for data eevents
                this.oposMsr.DataEvent  += this.OnMsrDataEvent;
                this.oposMsr.ErrorEvent += this.OnMsrErrorEvent;

                // Set autodisable to false
                this.oposMsr.AutoDisable = false;

                // Enable data events
                this.oposMsr.DataEventEnabled = true;
            }
Exemplo n.º 4
0
 public POSMsr()
 {
     m_device = new OPOSMSR();
 }