public bool WriteReport(HidReport report, int timeout)
 {
     return Write(report.GetBytes(), timeout);
 }
 public void WriteReport(HidReport report, WriteCallback callback)
 {
     var writeReportDelegate = new WriteReportDelegate(WriteReport);
     var asyncState = new HidAsyncState(writeReportDelegate, callback);
     writeReportDelegate.BeginInvoke(report, EndWriteReport, asyncState);
 }
 public bool WriteReport(HidReport report)
 {
     return WriteReport(report, 0);
 }
        private void ReadProcess(HidReport report)
        {
            if (CodeRead != null)
            {
                CurrentCode = GetCode(report.Data);

                if (CurrentCode != null)
                {

                    if ((LastCodeScanned != null && LastCodeScanned.TextData == CurrentCode.TextData) && (System.Environment.TickCount - _LastCodeScannedTickcount < SEQUENTIAL_READ_INTERVAL_MAX) && LastCodeScanned.Symbology == CurrentCode.Symbology)
                    {
                        //Swallow dead read
                        //Debug.Print("Dead read detected reading");
                        Console.WriteLine("Dead read detected reading");
                    }
                    else
                    {
                        //Add it to to our string array
                        _Results.Add(CurrentCode.TextData);

                        //Console.WriteLine("myThreadCount=" + report._myThreadCount);

                        //Multithread on long barcodes so we will form the final result by concatenating
                        string strReturn = "";
                        foreach (var s in _Results)
                        {
                            strReturn += s;
                        }

                        if (RAISE_CODE_FOR_SINGLE_CHARS || (CurrentCode.TextData.Length > 1 || strReturn.Length > 1))
                        { //The addition of OR is for 64+1 condition - compatibility with long barcodes

                            if (!CurrentCode.PartialSegment)
                            {
                                CurrentCode.TextData = strReturn;
                                if (_Results.Count != 0)
                                {
                                    _Results.Clear();
                                    LastCodeScanned = CurrentCode;
                                    _LastCodeScannedTickcount = System.Environment.TickCount;
                                    this.RaiseEventOnUIThread(CodeRead, new object[] { CurrentCode }); // CodeRead(CurrentCode);
                                }
                            }
                        }
                    }
                }
                else
                    System.Diagnostics.Debug.WriteLine("empty code");
            }

            if (_Active)
            {
                foreach (var s in _Scanners)
               {
                   s.ReadReport(ReadProcess);
               }

            }
        }