예제 #1
0
        /// <summary>
        /// Update display forms(TagTableForm, RSSIGraphForm...) once receiving a new tag report from RFID reader
        /// </summary>
        /// <param name="tagInfo">an object containing all information of a tag in one tag report</param>
        public void UpdateDisplayForms(TagInfo tagInfo, bool isSimulation)
        {
            if (tagInfo.TotalTagCount == 1)
            {
                _firstReportTime = tagInfo.FirstSeenTime;
            }
            tagInfo.TimeStamp = tagInfo.FirstSeenTime - _firstReportTime;

            // Update status strip in MainForm
            UpdateStatusStrip(tagInfo, isSimulation);

            // Update Tag Filter in ReaderSettingsFrom
            if (_readerSettingsForm.Visible)
            {
                _readerSettingsForm.UpdateTagFilter(tagInfo);
            }

            // Update TagTableForm
            if (_tagTableForm.Visible)
            {
                _tagTableForm.UpdateTagTable(tagInfo);
            }

            // Update RSSIGraphForm
            if (_rssiGraphForm.Visible)
            {
                _rssiGraphForm.UpdateRSSIGraph(tagInfo);
            }

            // Update PhaseGraphForm
            if (_phaseGraphForm.Visible)
            {
                _phaseGraphForm.UpdatePhaseGraph(tagInfo);
            }

            _tagsTable.AddTagInfo(tagInfo);
        }
예제 #2
0
파일: MainForm.cs 프로젝트: aaana/rfid
        /// <summary>
        /// Update display forms(TagTableForm, RSSIGraphForm...) once receiving a new tag report from RFID reader
        /// </summary>
        /// <param name="tagInfo">an object containing all information of a tag in one tag report</param>
        public void UpdateDisplayForms(TagInfo tagInfo, bool isSimulation)
        {
            if (tagInfo.TotalTagCount == 1)
            {
                _firstReportTime = tagInfo.FirstSeenTime;
            }
            tagInfo.TimeStamp = tagInfo.FirstSeenTime - _firstReportTime;

            // Update status strip in MainForm
            UpdateStatusStrip(tagInfo, isSimulation);

            // Update Tag Filter in ReaderSettingsFrom
            if (_readerSettingsForm.Visible)
            {
                _readerSettingsForm.UpdateTagFilter(tagInfo);
            }

            // Update TagTableForm
            if (_tagTableForm.Visible)
            {
                _tagTableForm.UpdateTagTable(tagInfo);
            }

            // Update RSSIGraphForm
            if (_rssiGraphForm.Visible)
            {
                _rssiGraphForm.UpdateRSSIGraph(tagInfo);
            }

            // Update PhaseGraphForm
            if (_phaseGraphForm.Visible)
            {
                _phaseGraphForm.UpdatePhaseGraph(tagInfo);
            }

            _tagsTable.AddTagInfo(tagInfo);

            /* tagInfoQueue.Enqueue(tagInfo);
             * if (vitalSignsTiming >= 3)
             * {
             *   tagInfoQueue.Dequeue();
             * }
             * if (isFinish)
             * {
             *   tagInfos = tagInfoQueue.ToList<TagInfo>();
             * }*/
            try
            {
                IVitalSignsService vitalSignsService = ServiceManager.getOneVitalSignsService();
                long   timestamp = (long)tagInfo.TimeStamp;
                double phase     = tagInfo.AcutalPhaseInRadian;
                int    frequency = tagInfo.Frequency;
                string epc       = tagInfo.EPC;
                vitalSignsService.addTagInfo(timestamp, phase, frequency, epc);
                if (vitalSignsTiming >= DELAY_TIME_SECOND)
                {
                    vitalSignsService.removeHead();
                }
                ServiceManager.closeService(vitalSignsService);
            }catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
예제 #3
0
        /// <summary>
        /// Update basic information ListView Once receiving a new tag report from RFID reader
        /// </summary>
        /// <param name="tagInfo">an object containing all information of a tag in one tag report</param>
        public void UpdateListView(TagInfo tagInfo)
        {
            //Update counter in status strip
            tsslblCounter.Text = tagInfo.TotalTagCount.ToString();
            //Update run time in status strip
            UpdateRunTime();

            _tagsTable.AddTagInfo(tagInfo);

            ListViewItem foundItem = lvBasicInfo.FindItemWithText(tagInfo.EPC);

            if (foundItem != null)
            {
                // Tag already exists
                foundItem.SubItems[2].Text = tagInfo.Antenna.ToString();
                foundItem.SubItems[3].Text = tagInfo.ChannelIndex.ToString();
                foundItem.SubItems[4].Text = tagInfo.RSSI.ToString();
                foundItem.SubItems[5].Text = tagInfo.AcutalPhaseInRadian.ToString();
                foundItem.SubItems[6].Text = tagInfo.DopplerShift.ToString();
                foundItem.SubItems[7].Text = tagInfo.Velocity.ToString();
                foundItem.SubItems[8].Text = Convert.ToString(Convert.ToInt32(foundItem.SubItems[8].Text) + 1);
                //if (tabControlChart.SelectedTab.Text != "Holographics")

                chartRSSI.Series[foundItem.Index].Points.AddXY((tagInfo.FirstSeenTime - _firstReportTime) / 1000, tagInfo.RSSI);
                chartPhase.Series[foundItem.Index].Points.AddXY((tagInfo.FirstSeenTime - _firstReportTime) / 1000, tagInfo.AcutalPhaseInRadian);
            }
            else
            {
                // New tag is coming
                if (tagInfo.TotalTagCount == 1)
                {
                    _firstReportTime = tagInfo.FirstSeenTime;
                }

                // Update Listview
                ListViewItem lvi = new ListViewItem(Convert.ToString(_index++));
                lvi.SubItems.Add(tagInfo.EPC);
                lvi.SubItems.Add(tagInfo.Antenna.ToString());
                lvi.SubItems.Add(tagInfo.ChannelIndex.ToString());
                lvi.SubItems.Add(tagInfo.RSSI.ToString());
                lvi.SubItems.Add(tagInfo.AcutalPhaseInRadian.ToString());
                lvi.SubItems.Add(tagInfo.DopplerShift.ToString());
                lvi.SubItems.Add(tagInfo.Velocity.ToString());
                lvi.SubItems.Add(Convert.ToString(1));
                lvBasicInfo.Items.Add(lvi);

                //Update Chart
                if (lvBasicInfo.Items.Count == 1)
                {
                    //Chart title for RSSI
                    Title titleRSSI = new Title("RSSI", Docking.Top);
                    titleRSSI.Alignment = System.Drawing.ContentAlignment.MiddleCenter;
                    titleRSSI.Font      = new System.Drawing.Font("Microsoft Sans Serif", 20, System.Drawing.FontStyle.Bold);
                    chartRSSI.Titles.Add(titleRSSI);

                    Title titlePhase = new Title("Phase", Docking.Top);
                    titlePhase.Alignment = System.Drawing.ContentAlignment.MiddleCenter;
                    titlePhase.Font      = new System.Drawing.Font("Microsoft Sans Serif", 20, System.Drawing.FontStyle.Bold);
                    chartPhase.Titles.Add(titlePhase);
                }

                //------RSSI------
                //Create a new curve
                Series seriesRSSI = new Series("RSSI:" + tagInfo.EPC);
                //Set chart type
                seriesRSSI.ChartType = SeriesChartType.FastLine;
                //Set different curve colors
                seriesRSSI.BorderDashStyle = (ChartDashStyle)lvBasicInfo.Items.Count;
                //Set curve width
                seriesRSSI.BorderWidth = 3;
                chartRSSI.Series.Add(seriesRSSI);

                //Create a new legend
                Legend legendRSSI = new Legend("RSSI:" + tagInfo.EPC);
                //Set legend propertities
                legendRSSI.Title     = "EPC";
                legendRSSI.TitleFont = new System.Drawing.Font("Microsoft Sans Serif", 12, System.Drawing.FontStyle.Bold);
                legendRSSI.Font      = new System.Drawing.Font("Microsoft Sans Serif", 10, System.Drawing.FontStyle.Bold);

                legendRSSI.LegendStyle             = LegendStyle.Table;
                legendRSSI.Alignment               = System.Drawing.StringAlignment.Center;
                legendRSSI.IsDockedInsideChartArea = false;
                legendRSSI.Docking = Docking.Bottom;

                legendRSSI.BorderDashStyle = ChartDashStyle.Dash;
                legendRSSI.BorderColor     = System.Drawing.Color.LightBlue;
                legendRSSI.BorderWidth     = 3;
                chartRSSI.Legends.Add(legendRSSI);
                //Set Docking of the legend chart to the Default Chart Area
                chartRSSI.Legends["RSSI:" + tagInfo.EPC].DockedToChartArea = "RSSI";
                seriesRSSI.Points.AddXY((tagInfo.FirstSeenTime - _firstReportTime) / 1000, tagInfo.RSSI);
                //------RSSI------

                //------Phase------
                //Create a new curve
                Series seriesPhase = new Series("Phase:" + tagInfo.EPC);
                //Set chart type
                //seriesPhase.ChartType = SeriesChartType.FastPoint;
                seriesPhase.ChartType = SeriesChartType.FastLine;
                //Set different curve colors
                seriesPhase.BorderDashStyle = (ChartDashStyle)lvBasicInfo.Items.Count;
                //Set curve width
                seriesPhase.BorderWidth = 3;
                //seriesPhase.MarkerSize = 5;
                chartPhase.Series.Add(seriesPhase);

                //Create a new legend
                Legend legendPhase = new Legend("Phase:" + tagInfo.EPC);
                //Set legend propertities
                legendPhase.Title     = "EPC";
                legendPhase.Font      = new System.Drawing.Font("Microsoft Sans Serif", 10, System.Drawing.FontStyle.Bold);
                legendPhase.TitleFont = new System.Drawing.Font("Microsoft Sans Serif", 12, System.Drawing.FontStyle.Bold);

                legendPhase.LegendStyle             = LegendStyle.Table;
                legendPhase.Alignment               = System.Drawing.StringAlignment.Center;
                legendPhase.IsDockedInsideChartArea = false;
                legendPhase.Docking = Docking.Bottom;

                legendPhase.BorderDashStyle = ChartDashStyle.Dash;
                legendPhase.BorderColor     = System.Drawing.Color.LightBlue;
                legendPhase.BorderWidth     = 3;

                chartPhase.Legends.Add(legendPhase);

                chartPhase.Legends["Phase:" + tagInfo.EPC].DockedToChartArea = "Phase";
                seriesPhase.Points.AddXY((tagInfo.FirstSeenTime - _firstReportTime) / 1000, tagInfo.AcutalPhaseInRadian);

                //------Phase------

                //Update Tag Filter
                if (!cbMask.Items.Contains(tagInfo.EPC))
                {
                    cbMask.Items.Add(tagInfo.EPC);
                }
                if (!cbExtraMask.Items.Contains(tagInfo.EPC))
                {
                    cbExtraMask.Items.Add(tagInfo.EPC);
                }

                SyntheticApertureRadar sar = new SyntheticApertureRadar();
                _sar.Add(tagInfo.EPC, sar);
            }

            SARParameter sarPara = new SARParameter();

            sarPara.AntennaX = Convert.ToDouble(tbxAntXStart.Text.Trim()) +
                               _simulationIndex * Convert.ToDouble(tbxSamplingAntennaSpeed.Text.Trim()) * Convert.ToDouble(tbxSimulationSamplingTime.Text.Trim());
            sarPara.AntennaY = Convert.ToDouble(tbxAntYStart.Text.Trim());

            sarPara.TagInformation                     = new TagInfo();
            sarPara.TagInformation.EPC                 = tagInfo.EPC;
            sarPara.TagInformation.Frequency           = 1000000 * RFIDReaderParameter.ReaderCapabilities.FrequencyDic[tagInfo.ChannelIndex];
            sarPara.TagInformation.AcutalPhaseInRadian = tagInfo.AcutalPhaseInRadian;
            sarPara.TagInformation.TotalTagCount       = tagInfo.TotalTagCount;

            _sarParaQueue.Enqueue(sarPara);
        }