Пример #1
0
        private void oDecodeAssembly_DecodeEvent(object sender, DecodeAssembly.DecodeEventArgs e)
        {
            //Log.Write(new LogEntry("HoneywellReader: oDecodeAssembly_DecodeEvent"));
            try {
                _lastResults = new ReaderResults();

                //--- Was the Decode Attempt Successful? ---
                if (e.ResultCode == DecodeAssembly.ResultCodes.Success)
                {
                    //Log.Write(new LogEntry("HoneywellReader: oDecodeAssembly_DecodeEvent -> Success"));
                    _lastResults.Status = ScannerStatus.Success;
                    _lastResults.Data   = e.Message;

                    //Helpers.Log.Write(string.Format("Read done:\nmessage: {0}, codeID: {1}, aimID: {2}, aimMod: {3}, length: {4}, result: {5}",e.Message, e.CodeId, e.AimId, e.AimModifier, e.Length.ToString(), e.ResultCode.ToString()));

                    //--- Play an SDK Provided Audible Sound ---
                    oDecodeAssembly.Sound.Play(Sound.SoundTypes.Success, true);
                }
                else
                {
                    //Log.Write(new LogEntry("HoneywellReader: oDecodeAssembly_DecodeEvent -> Failed"));
                    if (e.DecodeException != null)
                    {
                        //--- Async Decode Exception ---
                        switch (e.DecodeException.ResultCode)
                        {
                        case DecodeAssembly.ResultCodes.Cancel:                // Async Decode was Canceled
                            //Log.Write(new LogEntry("HoneywellReader: oDecodeAssembly_DecodeEvent -> Failed -> Cancel"));
                            return;

                        case DecodeAssembly.ResultCodes.NoDecode:              // Scan Timeout
                            //Log.Write(new LogEntry("HoneywellReader: oDecodeAssembly_DecodeEvent -> Failed -> NoDecode"));
                            break;

                        default:
                            //Log.Write(new LogEntry("HoneywellReader: oDecodeAssembly_DecodeEvent -> Failed -> Exception: " + e.DecodeException.Message));
                            break;
                        }
                    }
                    else
                    {
                        //--- Generic Async Exception ---
                        //Log.Write(new LogEntry("Generic async exception"));

                        //MessageBox.Show(e.Exception.Message);

                        _lastResults.Status = ScannerStatus.DeviceFailure;
                    }
                }

                NotifyStatus(GetState());
                NotifyRead(_lastResults);
            } catch (Exception ex) {
                //   MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void _reader_DecodeEvent(object sender, DecodeAssembly.DecodeEventArgs e)
        {
            if (e.ResultCode == DecodeAssembly.ResultCodes.Success && Scan != null)
            {
                System.Media.SystemSounds.Beep.Play();

                ScanEventArgs args = new ScanEventArgs();

                args.Data = e.Message;

                Scan(this, args);
            }
        }
Пример #3
0
        void xEng_DecodeEvent(object sender, DecodeAssembly.DecodeEventArgs e)
        {
            BCId   nCodeID  = BCId.NoData;
            string sBarCode = string.Empty;
            BarcodeScannerEventArgs ba;

            try
            {
                RightLEDOff();
                //--- Was the Decode Attempt Successful? ---
                if (e.ResultCode == DecodeAssembly.ResultCodes.Success)
                {
                    xEng.Device.SetLEDs(Device.LedSelect.RightGreen, Device.LedState.On, 0, 0);
                    //sBarCode = e.CodeId;
                    //switch (sBarCode)
                    //{
                    //    case "d":
                    //    case "D":
                    //        nCodeID = BCId.EAN13;
                    //        break;
                    //    case "j":
                    //        nCodeID = BCId.Code128;
                    //        break;
                    //    case "w":
                    //        nCodeID = BCId.DataMatrix;
                    //        break;
                    //    default:
                    //        break;
                    //}
                    nCodeID  = base.SetBarcodeType(e.CodeId);
                    sBarCode = e.Message;

                    //--- Play an SDK Provided Audible Sound ---
                    xEng.Sound.Play(Sound.SoundTypes.Success);
                }
                else
                {
                    if (e.DecodeException != null)
                    {
                        //--- Async Decode Exception ---
                        switch (e.DecodeException.ResultCode)
                        {
                        case DecodeAssembly.ResultCodes.Cancel:                // Async Decode was Canceled
                            return;

                        case DecodeAssembly.ResultCodes.NoDecode:              // Scan Timeout
                            //MessageBox.Show("Scan Timeout Exceeded");
                            break;

                        default:
                            //MessageBox.Show(e.DecodeException.Message);
                            break;
                        }
                    }
                    else
                    {
                        //--- Generic Async Exception ---
                        //MessageBox.Show(e.Exception.Message);
                    }
                    //xEng.Sound.Play(Sound.SoundTypes.Failure);
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
            }

            ba = new BarcodeScannerEventArgs(nCodeID, sBarCode, e.RawData, e.Length);
            OnBarcodeScan(ba);
            return;
        }