static void OnTagsReported(object sender, TagsReportedEventArgs args) { // This function is called asynchronously // when tag reports are available. // Loop through each tag in the report // and print the data. foreach (Tag tag in args.TagReport.Tags) { Console.WriteLine("EPC : {0} Antenna : {1}, RSSI:{2}", tag.Epc, tag.AntennaPortNumber, tag.ReaderIdentity); } }
// The tag report event handler private void TagsReportedHandler(object sender, TagsReportedEventArgs args) { // Loop through each tag in the report // and print the EPC and antenna number. foreach (Tag tag in args.TagReport.Tags) { if (!htimpinjtags.Contains(tag.Epc)) { htimpinjtags.Add(tag.Epc, tag.AntennaPortNumber); Console.WriteLine("Reader saw {0} on ant#{1}", tag.Epc, tag.AntennaPortNumber); } } }
// The tag report event handler private void TagsReportedHandler(object sender, TagsReportedEventArgs args) { // Loop through each tag in the report // and print the EPC and antenna number. foreach (Tag tag in args.TagReport.Tags) { if (!htimpinjtags.Contains(tag.Epc)) { htimpinjtags.Add(tag.Epc, tag.AntennaPortNumber); Console.WriteLine("Reader saw {0} on ant#{1}", tag.Epc, tag.AntennaPortNumber); } } }
private void OnTagsReported(object sender, TagsReportedEventArgs e) { TagsReportedDelegate del = new TagsReportedDelegate(UpdateTagsList); this.BeginInvoke(del, e.TagReport.Tags); }
private void OnTagsReported(object sender, TagsReportedEventArgs args) { TagsReportedDelegate del = new TagsReportedDelegate(updateListbox); this.Dispatcher.BeginInvoke(del, args.TagReport.Tags); foreach (Tag tag in args.TagReport.Tags) { int index = 0; int roomNumber = 1; for (int i = 0; i < roomList.Count; i++) { if (tag.ReaderIdentity.Equals(roomNameList[i][0])) { roomNumber = (int)roomList [i][1]; } } //get the index of tag in array1 for (index = 0; index < array1.Count; index++) { if (array1[index].getId().Equals(tag.Epc)) { break; } } if (roomNumber == 1) { nowPos[index] = 1; } else if (roomNumber == 2) { nowPos[index] = 2; } else if (roomNumber == 3) { nowPos[index] = 3; } else if (roomNumber == 4) { nowPos[index] = 4; } else { nowPos[index] = 0; } //modify rssi if (GetTimeStamp().Equals(array1[index].getTime())) { //if time stamp is eaqual int listNowCount = array1[index].getNumList(); if (listNowCount < 3) { ArrayList rssiCondition = new ArrayList(); rssiCondition.Add(tag.PeakRssiInDbm); rssiCondition.Add(tag.AntennaPortNumber); rssiCondition.Add(roomNumber); array1[index].addListElement(rssiCondition); } } else { ArrayList rssiCondition = new ArrayList(); rssiCondition.Add(tag.PeakRssiInDbm); rssiCondition.Add(tag.AntennaPortNumber); rssiCondition.Add(roomNumber); array1[index].addListElement(rssiCondition); } array1[index].setTime(GetTimeStamp()); int[] pos = calculatePos((PersonInformation)array1[index]); if (pos[0] != -1 && pos[1] != -1) { ((Image)Imagelist[index]).SetValue(Grid.RowProperty, pos[0]); ((Image)Imagelist[index]).SetValue(Grid.ColumnProperty, pos[1]); } } }
/** * private void updateListbox(List<Tag> list) * { * // Loop through each tag is the list and add it to the Listbox. * foreach (var tag in list) * { * listTags.Items.Add("老人" + tag.getId() + "在" + tag.getRoomNumber() + "号房间" + "x:" + tag.getX() + "y:" + tag.getY()); * } * } **/ public void OnTagsReported(object sender, TagsReportedEventArgs args) { TagsReportedDelegate del = new TagsReportedDelegate(updateListbox); this.Dispatcher.BeginInvoke(del, args.TagReport.Tags); foreach (Tag tag in args.TagReport.Tags) { for (int i = 0; i < untrackTagList.Count; i++) { if (tag.Epc.Equals(untrackTagList[i].getId())) { int roomIndex = 0; untrackTagList[i].setTagrssi(tag.PeakRssiInDbm, tag.AntennaPortNumber); for (int p = 0; p < roomList.Count; p++) { if ((roomList[p].getReader1()).Equals(tag.ReaderIdentity) || (roomList[p].getReader2()).Equals(tag.ReaderIdentity)) { untrackTagList [i].setRoomNumber(roomList[p].getRoomNumber()); roomIndex = roomList[p].getRoomNumber(); } if (roomIndex == 1) { nowPos[i] = 1; } else if (roomIndex == 2) { nowPos[i] = 2; } else if (roomIndex == 3) { nowPos[i] = 3; } else if (roomIndex == 4) { nowPos[i] = 4; } else { nowPos[i] = 0; } } } } for (int j = 0; j < roomList.Count; j++) { for (int k = 0; k < roomList[j].getTagList().Count; k++) { if (tag.Epc.Equals(roomList[j].getTagList()[k].getId())) { roomList[k].setTag(referenceTagId[j], tag.PeakRssiInDbm, tag.AntennaPortNumber); } } } } calGetXandY(untrackTagList, referenceTagList); for (int i = 0; i < untrackTagList.Count; i++) { ((Image)Imagelist[i]).SetValue(Grid.RowProperty, (int)(untrackTagList[i].getX()) + roomList[i].getX()); ((Image)Imagelist[i]).SetValue(Grid.ColumnProperty, 3 - (int)(untrackTagList[i].getY()) + roomList[i].getY()); } }
private void OnTagsReported(object sender, TagsReportedEventArgs args) { var con = new dbConnection(); foreach (Tag tag in args.TagReport.Tags) { var length = tag.Epc.Length; var leitura = ""; var unidade = ""; var nome = ""; var indice = false; var uni_index = false; if (length == 24) { leitura = tag.Epc.Substring(12, 4); unidade = tag.Epc.Substring(16, 8); nome = con.exibirNomeProduto(leitura); if (nome != "") { indice = arr.Contains(nome); if (!indice) { arr.Insert(i, nome); uni.Insert(j, leitura + unidade); i++; j++; con.Insert(nome, id_leitura); nomeProduto = nome; total++; backgroundWorker1.RunWorkerAsync(); } else { uni_index = uni.Contains(leitura + unidade); if (!uni_index) { uni.Insert(j, leitura + unidade); j++; qtde = con.Update(nome, id_leitura); nomeProduto = nome; total++; backgroundWorker2.RunWorkerAsync(); } } } Console.WriteLine("EPC :{0}", tag.Epc); } } }