Ejemplo n.º 1
0
        /// <summary>
        /// Reads and validates each line of config file
        /// </summary>
        /// <param name="filePath"></param>
        internal static void ReadFile(string filePath)
        {
            string[] lines = File.ReadAllLines(filePath);

            string        dataSetLabel = null;
            List <string> epcs         = new List <string>();

            foreach (string line in lines)
            {
                if (ConfigFilesMediator.IgnoreLine(line))
                {
                    if (dataSetLabel != null)
                    {
                        EPCsComparer.AddDataSet(dataSetLabel, epcs.ToList());

                        dataSetLabel = null;
                        epcs.Clear();
                    }

                    continue;
                }

                LineValidations(ref dataSetLabel, line);

                ReadLine(line, epcs);
            }

            if (dataSetLabel != null)
            {
                EPCsComparer.AddDataSet(dataSetLabel, epcs);
            }
        }
Ejemplo n.º 2
0
        private void UpdateUIEPCDatasets()
        {
            comboBoxEPCDatasets.Items.Clear();

            comboBoxEPCDatasets.Items.AddRange(EPCsComparer.GetDatasetsLabels());

            comboBoxEPCDatasets.SelectedItem = EPCsComparer.SelectedDataset;
        }
Ejemplo n.º 3
0
        private void ButtonRunCompare_Click(object sender, EventArgs e)
        {
            string s = richTextBoxInsertTags.Text;

            string[]      array = s.Split('\n');
            List <string> list  = new List <string>(array);

            EPCsComparer.GetEpcsNotInList(list, out List <string> newList);

            string news = string.Join("\n", newList.ToArray());

            news += String.Format("\n{0}", newList.Count);

            richTextBoxGetTags.Text = news;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Fills Excel with list os metatags of reader and other useful information about the reads process
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="oSheetData"></param>
        /// <param name="columnStart"></param>
        /// <param name="readerNum"></param>
        private static void FillExcelWithReaderInfo(UHFReader reader, Excel._Worksheet oSheetData, int columnStart, int readerNum)
        {
            if (reader == null)
            {
                return;
            }

            if (readerNum == 1)
            {
                /// format Reader 1 cells

                Excel.Range newRng = oSheetData.get_Range(String.Format("A1:E{0}", reader.MetaTagsDictionary.Count + 21));

                newRng.Interior.Color = Excel.XlRgbColor.rgbOrange;

                newRng.Borders.get_Item(Excel.XlBordersIndex.xlEdgeLeft).LineStyle   = Excel.XlLineStyle.xlContinuous;
                newRng.Borders.get_Item(Excel.XlBordersIndex.xlEdgeRight).LineStyle  = Excel.XlLineStyle.xlContinuous;
                newRng.Borders.get_Item(Excel.XlBordersIndex.xlEdgeTop).LineStyle    = Excel.XlLineStyle.xlContinuous;
                newRng.Borders.get_Item(Excel.XlBordersIndex.xlEdgeBottom).LineStyle = Excel.XlLineStyle.xlContinuous;
            }
            else
            {
                /// format Reader 2 cells

                Excel.Range newRng = oSheetData.get_Range(String.Format("G1:K{0}", reader.MetaTagsDictionary.Count + 21));

                newRng.Interior.Color = Excel.XlRgbColor.rgbOrchid;

                newRng.Borders.get_Item(Excel.XlBordersIndex.xlEdgeLeft).LineStyle   = Excel.XlLineStyle.xlContinuous;
                newRng.Borders.get_Item(Excel.XlBordersIndex.xlEdgeRight).LineStyle  = Excel.XlLineStyle.xlContinuous;
                newRng.Borders.get_Item(Excel.XlBordersIndex.xlEdgeTop).LineStyle    = Excel.XlLineStyle.xlContinuous;
                newRng.Borders.get_Item(Excel.XlBordersIndex.xlEdgeBottom).LineStyle = Excel.XlLineStyle.xlContinuous;
            }

            #region Initialize local vareables

            /// UHFReader Inventory counter
            UHFReaderInvCounter ric = reader.RIC;

            /// UHFReader Inventory parameters
            UHFReaderInvParams rip = reader.InvParams;

            /// List with MetaTags
            List <MetaTag> lmt = new List <MetaTag>();

            /// Dictionary that represents the line number on Excel for the EPC of this Reader
            /// Key => EPC
            /// Value => counter
            Dictionary <string, int> dic = new Dictionary <string, int>();

            /// Represents line number on Excel
            int counter = 1;

            #endregion

            foreach (string epc in reader.MetaTagsDictionary.Keys)
            {
                /// Add MetaTag
                lmt.Add(reader.MetaTagsDictionary[epc]);

                /// Add EPC with line number on Excel
                dic.Add(epc, counter++);
            }

            lmt.Sort();

            /// Reader line number on Excel
            int rcL = 1;

            oSheetData.Cells[rcL++, columnStart - 1] = String.Format("R{0}", readerNum);

            oSheetData.Cells[rcL++, columnStart] = String.Format("Frequency min: {0} MHz", reader.MinFrequency);
            oSheetData.Cells[rcL++, columnStart] = String.Format("Frequency Max: {0} MHz", reader.MaxFrequency);
            oSheetData.Cells[rcL++, columnStart] = String.Format("Power: {0} dBm", reader.PowerDbm);

            rcL++;

            oSheetData.Cells[rcL++, columnStart] = String.Format("Q: {0}", rip.QValue);
            oSheetData.Cells[rcL++, columnStart] = String.Format("S: {0}", rip.Session);
            oSheetData.Cells[rcL++, columnStart] = String.Format("T: {0}", rip.Target);
            oSheetData.Cells[rcL++, columnStart] = String.Format("Commute: {0}", rip.ConvertTagFlagWhenFailedReads);

            rcL++;

            oSheetData.Cells[rcL++, columnStart] = String.Format("Invs (no Tags): {0}", ric.invsWithoutTags);
            oSheetData.Cells[rcL++, columnStart] = String.Format("Invs (with Tags): {0}", ric.invsWithTags);

            /// Total number of Inventaries that were gotten by Reader
            int totalInvsReader = ric.invsWithoutTags + ric.invsWithTags;

            oSheetData.Cells[rcL++, columnStart] = String.Format("Invs (Total): {0} => {1:0.00}%/{2:0.00}%",
                                                                 totalInvsReader,
                                                                 (double)ric.invsWithTags / totalInvsReader * 100,
                                                                 (double)ric.invsWithoutTags / totalInvsReader * 100);

            rcL++;

            oSheetData.Cells[rcL++, columnStart] = String.Format("Nº tags: {0}", ric.numTagsFound);
            oSheetData.Cells[rcL++, columnStart] = String.Format("MIN tags: {0}", ric.numTagsFoundMin);
            oSheetData.Cells[rcL++, columnStart] = String.Format("AVG tags: {0:0.00}", ric.GetTagsAvg());
            oSheetData.Cells[rcL++, columnStart] = String.Format("MAX tags: {0}", ric.numTagsFoundMax);

            rcL++;

            oSheetData.Cells[rcL, columnStart - 1] = "#";
            oSheetData.Cells[rcL, columnStart]     = "EPC";
            oSheetData.Cells[rcL, columnStart + 1] = "Times";
            oSheetData.Cells[rcL, columnStart + 2] = "RSSI";
            oSheetData.Cells[rcL, columnStart + 3] = "RSSI_AVG";
            oSheetData.get_Range(String.Format("A{0}:N{0}", rcL)).Columns.EntireColumn.AutoFit();
            oSheetData.get_Range(String.Format("A{0}:N{0}", rcL)).Font.Bold = true;

            rcL++;

            /// The summation of the times that each MetaTag was read
            int sumTimes = 0;

            foreach (MetaTag mt in lmt)
            {
                oSheetData.Cells[rcL, columnStart - 1] = dic[mt.EPC];
                oSheetData.Cells[rcL, columnStart]     = mt.EPC;
                oSheetData.Cells[rcL, columnStart + 1] = mt.RSSICounter;
                oSheetData.Cells[rcL, columnStart + 2] = mt.RSSI;
                oSheetData.Cells[rcL, columnStart + 3] = mt.RSSIAvg;

                sumTimes += mt.RSSICounter;

                rcL++;
            }
            oSheetData.Cells[rcL, columnStart - 1] = lmt.Count;
            oSheetData.Cells[rcL, columnStart + 1] = sumTimes;

            //-------------

            rcL += 2;

            /// newList gets all EPCs that are on dataset, but not in the lmt
            EPCsComparer.GetEpcsNotInList(lmt, out List <string> newList);

            /// EPC line number on Excel
            int newCounter = 1;

            /// Put Dataset label on Excel
            oSheetData.Cells[rcL++, columnStart] = newList[0];

            /// Remove Dataset Label
            newList.RemoveAt(0);

            foreach (string s in newList)
            {
                oSheetData.Cells[rcL, columnStart - 1] = newCounter++;
                oSheetData.Cells[rcL++, columnStart]   = s;
            }
        }
Ejemplo n.º 5
0
 private void ComboBoxEPCDatasets_SelectedIndexChanged(object sender, EventArgs e)
 {
     EPCsComparer.ChangeSelectedDataSet(comboBoxEPCDatasets.SelectedItem.ToString());
 }