private void AddOrUpdateTagData(CSLibrary.Structures.TagCallbackInfo info) { InvokeOnMainThread(() => { bool found = false; int cnt; if (BleMvxApplication._rfMicro_Power == 4 && BleMvxApplication._config.RFID_PowerSequencing_NumberofPower != 0) { currentPower = (BleMvxApplication._config.RFID_PowerSequencing_Level[info.antennaPort] / 10).ToString("0.0") + "dB"; RaisePropertyChanged(() => currentPower); } lock (TagInfoList) { UInt16 ocRSSI; UInt16 sensorCode; UInt16 temp; sensorCode = (UInt16)(info.Bank1Data[0] & 0x1ff); // address c ocRSSI = info.Bank1Data[1]; // address d temp = info.Bank1Data[2]; // address e for (cnt = 0; cnt < TagInfoList.Count; cnt++) { if (TagInfoList[cnt].EPC == info.epc.ToString()) { TagInfoList[cnt].OCRSSI = ocRSSI; TagInfoList[cnt].RSSIColor = "Black"; if (ocRSSI >= BleMvxApplication._rfMicro_minOCRSSI && ocRSSI <= BleMvxApplication._rfMicro_maxOCRSSI) { TagInfoList[cnt].GOODOCRSSI = ocRSSI.ToString(); //BleMvxApplication._rfMicro_SensorType // 0 = Sensor code, 1 = Temp //BleMvxApplication._rfMicro_SensorUnit // 0=code, 1=f, 2=c, 3=% switch (BleMvxApplication._rfMicro_SensorType) { case 0: if (BleMvxApplication._rfMicro_TagType == 1 && sensorCode >= 5 && sensorCode <= 490) { double SensorAvgValue; TagInfoList[cnt].SucessCount++; SensorAvgValue = sensorCode; switch (BleMvxApplication._rfMicro_SensorUnit) { case 1: // RAW { TagInfoList[cnt].SensorAvgValue = sensorCode.ToString(); } break; case 4: // Range Allocation { if (sensorCode >= BleMvxApplication._rfMicro_WetDryThresholdValue) { TagInfoList[cnt].SensorAvgValue = "Dry"; } else { TagInfoList[cnt].SensorAvgValue = "Wet"; } } break; } if (TagInfoList[cnt].SucessCount >= 3) { switch (BleMvxApplication._rfMicro_thresholdComparison) { case 0: // > if (SensorAvgValue > BleMvxApplication._rfMicro_thresholdValue) { TagInfoList[cnt].valueColor = BleMvxApplication._rfMicro_thresholdColor; } else { TagInfoList[cnt].valueColor = "Green"; } break; default: // < if (SensorAvgValue < BleMvxApplication._rfMicro_thresholdValue) { TagInfoList[cnt].valueColor = BleMvxApplication._rfMicro_thresholdColor; } else { TagInfoList[cnt].valueColor = "Green"; } break; } } } break; default: if (temp >= 1300 && temp <= 3500) { double SensorAvgValue; TagInfoList[cnt].SucessCount++; UInt64 caldata = (UInt64)(((UInt64)info.Bank2Data[0] << 48) | ((UInt64)info.Bank2Data[1] << 32) | ((UInt64)info.Bank2Data[2] << 16) | ((UInt64)info.Bank2Data[3])); if (caldata == 0) { TagInfoList[cnt].SensorAvgValue = "NoCalData"; } else { switch (BleMvxApplication._rfMicro_SensorUnit) { case 0: // code TagInfoList[cnt]._sensorValueSum += temp; SensorAvgValue = Math.Round(TagInfoList[cnt]._sensorValueSum / TagInfoList[cnt].SucessCount, 2); TagInfoList[cnt].SensorAvgValue = SensorAvgValue.ToString(); break; case 2: // F TagInfoList[cnt]._sensorValueSum += getTempF(temp, caldata); SensorAvgValue = Math.Round(TagInfoList[cnt]._sensorValueSum / TagInfoList[cnt].SucessCount, 2); TagInfoList[cnt].SensorAvgValue = SensorAvgValue.ToString(); break; default: // C TagInfoList[cnt]._sensorValueSum += getTempC(temp, caldata); SensorAvgValue = Math.Round(TagInfoList[cnt]._sensorValueSum / TagInfoList[cnt].SucessCount, 2); TagInfoList[cnt].SensorAvgValue = SensorAvgValue.ToString(); break; } if (TagInfoList[cnt].SucessCount >= 3) { switch (BleMvxApplication._rfMicro_thresholdComparison) { case 0: // > if (SensorAvgValue > BleMvxApplication._rfMicro_thresholdValue) { TagInfoList[cnt].valueColor = BleMvxApplication._rfMicro_thresholdColor; } else { TagInfoList[cnt].valueColor = "Green"; } break; default: // < if (SensorAvgValue < BleMvxApplication._rfMicro_thresholdValue) { TagInfoList[cnt].valueColor = BleMvxApplication._rfMicro_thresholdColor; } else { TagInfoList[cnt].valueColor = "Green"; } break; } } } } break; } } else { TagInfoList[cnt].RSSIColor = "Red"; } found = true; break; } } if (!found) { RFMicroTagInfoViewModel item = new RFMicroTagInfoViewModel(); item.EPC = info.epc.ToString(); item.NickName = GetNickName(item.EPC); if (item.NickName != "") { item.DisplayName = item.NickName; } else { item.DisplayName = item.EPC; } item.OCRSSI = ocRSSI; item.SucessCount = 0; item._sensorValueSum = 0; item.SensorAvgValue = ""; item.GOODOCRSSI = ""; item.RSSIColor = "Black"; item.valueColor = "Black"; if (ocRSSI >= BleMvxApplication._rfMicro_minOCRSSI && ocRSSI <= BleMvxApplication._rfMicro_maxOCRSSI) { item.GOODOCRSSI = ocRSSI.ToString(); //BleMvxApplication._rfMicro_SensorType // 0 = Sensor code, 1 = Temp //BleMvxApplication._rfMicro_SensorUnit //0=code, 1=f, 2=c, 3=% switch (BleMvxApplication._rfMicro_SensorType) { case 0: if (sensorCode >= 5 && sensorCode <= 490) { item.SucessCount++; switch (BleMvxApplication._rfMicro_SensorUnit) { case 1: item.SensorAvgValue = sensorCode.ToString(); break; default: if (sensorCode >= BleMvxApplication._rfMicro_WetDryThresholdValue) { item.SensorAvgValue = "Dry"; } else { item.SensorAvgValue = "Wet"; } break; } } break; default: if (temp >= 1300 && temp <= 3500) { item.SucessCount++; UInt64 caldata = (UInt64)(((UInt64)info.Bank2Data[0] << 48) | ((UInt64)info.Bank2Data[1] << 32) | ((UInt64)info.Bank2Data[2] << 16) | ((UInt64)info.Bank2Data[3])); if (caldata == 0) { item.SensorAvgValue = "NoCalData"; } else { switch (BleMvxApplication._rfMicro_SensorUnit) { case 0: // code item._sensorValueSum = temp; item.SensorAvgValue = item._sensorValueSum.ToString(); break; case 2: // F item._sensorValueSum = getTempF(temp, caldata); item.SensorAvgValue = Math.Round(item._sensorValueSum, 2).ToString(); break; default: // C item._sensorValueSum = getTempC(temp, caldata); item.SensorAvgValue = Math.Round(item._sensorValueSum, 2).ToString(); break; } } } break; } } else { item.RSSIColor = "Red"; } TagInfoList.Insert(0, item); _newTagFound = true; Trace.Message("EPC Data = {0}", item.EPC); } } }); }
private void AddOrUpdateTagData(CSLibrary.Structures.TagCallbackInfo info) { InvokeOnMainThread(() => { bool found = false; int cnt; if (BleMvxApplication._rfMicro_Power == 4 && BleMvxApplication._config.RFID_PowerSequencing_NumberofPower != 0) { currentPower = (BleMvxApplication._config.RFID_PowerSequencing_Level[info.antennaPort] / 10).ToString("0.0") + "dB"; RaisePropertyChanged(() => currentPower); } lock (TagInfoList) { string epcstr = info.epc.ToString(); try { TagInfoListSpeedup.Add(epcstr, TagInfoList.Count); RFMicroTagInfoViewModel item = new RFMicroTagInfoViewModel(); item.EPC = info.epc.ToString(); item.NickName = GetNickName(item.EPC); if (item.NickName != "") { item.DisplayName = item.NickName; } else { item.DisplayName = item.EPC; } item.RSSIColor = "Black"; item.valueColor = "Black"; item.ScanValue = info.Bank2Data[2].ToString(); switch (BleMvxApplication._rfMicro_SensorUnit) { case 0: item.TemperatureValue = info.Bank2Data[4].ToString(); break; case 2: item.TemperatureValue = tempF(info.Bank2Data[4], info.Bank1Data[0], info.Bank1Data[1], info.Bank1Data[2], info.Bank1Data[3]).ToString("#0.0"); break; case 3: item.TemperatureValue = temp(info.Bank2Data[4], info.Bank1Data[0], info.Bank1Data[1], info.Bank1Data[2], info.Bank1Data[3]).ToString("#0.0"); break; } item.OCRSSI = info.Bank2Data[3]; if (item.OCRSSI >= BleMvxApplication._rfMicro_minOCRSSI && item.OCRSSI <= BleMvxApplication._rfMicro_maxOCRSSI) { item.RSSIColor = "Black"; item.SucessCount = 1; } else { item.RSSIColor = "Red"; item.SucessCount = 0; } item.EPC = ""; item.GOODOCRSSI = ""; item.NickName = ""; TagInfoList.Insert(0, item); _newtagCount4BeepSound++; _newtagCount4Vibration++; _newTagPerSecond++; Trace.Message("EPC Data = {0}", item.EPC); } catch (Exception ex) { int index; if (TagInfoListSpeedup.TryGetValue(epcstr, out index)) { index = TagInfoList.Count - index; index--; TagInfoList[index].ScanValue = info.Bank2Data[2].ToString(); switch (BleMvxApplication._rfMicro_SensorUnit) { case 0: TagInfoList[index].TemperatureValue = info.Bank2Data[4].ToString(); break; case 2: TagInfoList[index].TemperatureValue = tempF(info.Bank2Data[4], info.Bank1Data[0], info.Bank1Data[1], info.Bank1Data[2], info.Bank1Data[3]).ToString("#0.0"); break; case 3: TagInfoList[index].TemperatureValue = temp(info.Bank2Data[4], info.Bank1Data[0], info.Bank1Data[1], info.Bank1Data[2], info.Bank1Data[3]).ToString("#0.0"); break; } TagInfoList[index].OCRSSI = info.Bank2Data[3]; if (TagInfoList[index].OCRSSI >= BleMvxApplication._rfMicro_minOCRSSI && TagInfoList[index].OCRSSI <= BleMvxApplication._rfMicro_maxOCRSSI) { TagInfoList[index].RSSIColor = "Black"; TagInfoList[index].SucessCount++; } else { TagInfoList[index].RSSIColor = "Red"; } } else { // error found epc } } } }); }
private void AddOrUpdateTagData(CSLibrary.Structures.TagCallbackInfo info) { InvokeOnMainThread(() => { bool found = false; int cnt; if (BleMvxApplication._rfMicro_Power == 4 && BleMvxApplication._config.RFID_PowerSequencing_NumberofPower != 0) { currentPower = (BleMvxApplication._config.RFID_PowerSequencing_Level[info.antennaPort] / 10).ToString("0.0") + "dB"; RaisePropertyChanged(() => currentPower); } lock (TagInfoList) { UInt16 ocRSSI; UInt16 sensorCode; UInt16 temp; sensorCode = (UInt16)(info.Bank1Data[0] & 0x1f); // address b ocRSSI = info.Bank2Data[0]; // address d temp = 0; // no data for (cnt = 0; cnt < TagInfoList.Count; cnt++) { if (TagInfoList[cnt].EPC == info.epc.ToString()) { TagInfoList[cnt].OCRSSI = ocRSSI; TagInfoList[cnt].RSSIColor = "Black"; if (ocRSSI >= BleMvxApplication._rfMicro_minOCRSSI && ocRSSI <= BleMvxApplication._rfMicro_maxOCRSSI) { TagInfoList[cnt].GOODOCRSSI = ocRSSI.ToString(); double SensorAvgValue; TagInfoList[cnt].SucessCount++; SensorAvgValue = sensorCode; switch (BleMvxApplication._rfMicro_SensorUnit) { case 1: // RAW { TagInfoList[cnt].SensorAvgValue = sensorCode.ToString(); } break; case 4: // Range Allocation { if (sensorCode >= BleMvxApplication._rfMicro_WetDryThresholdValue) { TagInfoList[cnt].SensorAvgValue = "Dry"; } else { TagInfoList[cnt].SensorAvgValue = "Wet"; } } break; } if (TagInfoList[cnt].SucessCount >= 3) { switch (BleMvxApplication._rfMicro_thresholdComparison) { case 0: // > if (SensorAvgValue > BleMvxApplication._rfMicro_thresholdValue) { TagInfoList[cnt].valueColor = BleMvxApplication._rfMicro_thresholdColor; } else { TagInfoList[cnt].valueColor = "Green"; } break; default: // < if (SensorAvgValue < BleMvxApplication._rfMicro_thresholdValue) { TagInfoList[cnt].valueColor = BleMvxApplication._rfMicro_thresholdColor; } else { TagInfoList[cnt].valueColor = "Green"; } break; } } } else { TagInfoList[cnt].RSSIColor = "Red"; } found = true; break; } } if (!found) { RFMicroTagInfoViewModel item = new RFMicroTagInfoViewModel(); item.EPC = info.epc.ToString(); item.NickName = GetNickName(item.EPC); if (item.NickName != "") { item.DisplayName = item.NickName; } else { item.DisplayName = item.EPC; } item.OCRSSI = ocRSSI; item.SucessCount = 0; item._sensorValueSum = 0; item.SensorAvgValue = ""; item.GOODOCRSSI = ""; item.RSSIColor = "Black"; item.valueColor = "Black"; if (ocRSSI >= BleMvxApplication._rfMicro_minOCRSSI && ocRSSI <= BleMvxApplication._rfMicro_maxOCRSSI) { item.GOODOCRSSI = ocRSSI.ToString(); item.SucessCount++; switch (BleMvxApplication._rfMicro_SensorUnit) { case 1: item.SensorAvgValue = sensorCode.ToString(); break; case 4: if (sensorCode >= BleMvxApplication._rfMicro_WetDryThresholdValue) { item.SensorAvgValue = "Dry"; } else { item.SensorAvgValue = "Wet"; } break; } } else { item.RSSIColor = "Red"; } TagInfoList.Insert(0, item); _newTagFound = true; Trace.Message("EPC Data = {0}", item.EPC); } } }); }
private void AddOrUpdateTagData(CSLibrary.Structures.TagCallbackInfo info) { InvokeOnMainThread(() => { bool found = false; int cnt; lock (TagInfoList) { UInt16 ocRSSI = info.Bank1Data[1]; UInt16 sensorCode = info.Bank1Data[0]; UInt16 temp = info.Bank1Data[2]; for (cnt = 0; cnt < TagInfoList.Count; cnt++) { if (TagInfoList[cnt].EPC == info.epc.ToString()) { TagInfoList[cnt].OCRSSI = ocRSSI; TagInfoList[cnt].RSSIColor = "Black"; if (ocRSSI >= BleMvxApplication._rfMicro_minOCRSSI && ocRSSI <= BleMvxApplication._rfMicro_maxOCRSSI) { TagInfoList[cnt].GOODOCRSSI = ocRSSI.ToString(); //BleMvxApplication._rfMicro_SensorType // 0 = Sensor code, 1 = Temp //BleMvxApplication._rfMicro_SensorUnit //0=code, 1=f, 2=c, 3=% switch (BleMvxApplication._rfMicro_SensorType) { case 0: if (sensorCode >= 5 && sensorCode <= 490) { double SensorAvgValue; TagInfoList[cnt].SucessCount++; switch (BleMvxApplication._rfMicro_SensorUnit) { case 0: // code { TagInfoList[cnt]._sensorValueSum += sensorCode; SensorAvgValue = Math.Round(TagInfoList[cnt]._sensorValueSum / TagInfoList[cnt].SucessCount, 2); TagInfoList[cnt].SensorAvgValue = SensorAvgValue.ToString(); } break; default: // % { TagInfoList[cnt]._sensorValueSum += (double)sensorCode / 512 * 100; SensorAvgValue = Math.Round(TagInfoList[cnt]._sensorValueSum / TagInfoList[cnt].SucessCount, 2); TagInfoList[cnt].SensorAvgValue = SensorAvgValue.ToString(); } break; } if (TagInfoList[cnt].SucessCount >= 3) { switch (BleMvxApplication._rfMicro_thresholdComparison) { case 0: // > if (SensorAvgValue > BleMvxApplication._rfMicro_thresholdValue) { TagInfoList[cnt].valueColor = BleMvxApplication._rfMicro_thresholdColor; } else { TagInfoList[cnt].valueColor = "Green"; } break; default: // < if (SensorAvgValue < BleMvxApplication._rfMicro_thresholdValue) { TagInfoList[cnt].valueColor = BleMvxApplication._rfMicro_thresholdColor; } else { TagInfoList[cnt].valueColor = "Green"; } break; } } } break; default: if (temp >= 1300 && temp <= 3500) { double SensorAvgValue; TagInfoList[cnt].SucessCount++; UInt64 caldata = (UInt64)(((UInt64)info.Bank2Data[0] << 48) | ((UInt64)info.Bank2Data[1] << 32) | ((UInt64)info.Bank2Data[2] << 16) | ((UInt64)info.Bank2Data[3])); switch (BleMvxApplication._rfMicro_SensorUnit) { case 0: // code TagInfoList[cnt]._sensorValueSum += temp; SensorAvgValue = Math.Round(TagInfoList[cnt]._sensorValueSum / TagInfoList[cnt].SucessCount, 2); TagInfoList[cnt].SensorAvgValue = SensorAvgValue.ToString(); break; case 1: // F TagInfoList[cnt]._sensorValueSum += getTempF(temp, caldata); SensorAvgValue = Math.Round(TagInfoList[cnt]._sensorValueSum / TagInfoList[cnt].SucessCount, 2); TagInfoList[cnt].SensorAvgValue = SensorAvgValue.ToString(); break; default: // C TagInfoList[cnt]._sensorValueSum += getTempC(temp, caldata); SensorAvgValue = Math.Round(TagInfoList[cnt]._sensorValueSum / TagInfoList[cnt].SucessCount, 2); TagInfoList[cnt].SensorAvgValue = SensorAvgValue.ToString(); break; } if (TagInfoList[cnt].SucessCount >= 3) { switch (BleMvxApplication._rfMicro_thresholdComparison) { case 0: // > if (SensorAvgValue > BleMvxApplication._rfMicro_thresholdValue) { TagInfoList[cnt].valueColor = BleMvxApplication._rfMicro_thresholdColor; } else { TagInfoList[cnt].valueColor = "Green"; } break; default: // < if (SensorAvgValue < BleMvxApplication._rfMicro_thresholdValue) { TagInfoList[cnt].valueColor = BleMvxApplication._rfMicro_thresholdColor; } else { TagInfoList[cnt].valueColor = "Green"; } break; } } } break; } /* * if (BleMvxApplication._rfMicro_SensorUnit == 0) * { * if (sensorCode >= 5 && sensorCode <= 490) * { * TagInfoList[cnt].SucessCount++; * TagInfoList[cnt]._sensorValueSum += sensorCode; * TagInfoList[cnt].SensorAvgValue = Math.Round(TagInfoList[cnt]._sensorValueSum / TagInfoList[cnt].SucessCount, 2).ToString(); * } * } * else * { * if (temp >= 1300 && temp <= 3500) * { * TagInfoList[cnt].SucessCount++; * UInt64 caldata = (UInt64)(((UInt64)info.Bank2Data[0] << 48) | ((UInt64)info.Bank2Data[1] << 32) | ((UInt64)info.Bank2Data[2] << 16) | ((UInt64)info.Bank2Data[3])); * TagInfoList[cnt]._sensorValueSum += getTemperatue(info.Bank1Data[2], caldata); * TagInfoList[cnt].SensorAvgValue = Math.Round(TagInfoList[cnt]._sensorValueSum / TagInfoList[cnt].SucessCount, 2).ToString(); * } * } */ } else { TagInfoList[cnt].RSSIColor = "Red"; } found = true; break; } } if (!found) { RFMicroTagInfoViewModel item = new RFMicroTagInfoViewModel(); item.EPC = info.epc.ToString(); item.NickName = GetNickName(item.EPC); if (item.NickName != "") { item.DisplayName = item.NickName; } else { item.DisplayName = item.EPC; } item.OCRSSI = ocRSSI; item.SucessCount = 0; item._sensorValueSum = 0; item.SensorAvgValue = ""; item.GOODOCRSSI = ""; item.RSSIColor = "Black"; item.valueColor = "Black"; if (ocRSSI >= BleMvxApplication._rfMicro_minOCRSSI && ocRSSI <= BleMvxApplication._rfMicro_maxOCRSSI) { item.GOODOCRSSI = ocRSSI.ToString(); //BleMvxApplication._rfMicro_SensorType // 0 = Sensor code, 1 = Temp //BleMvxApplication._rfMicro_SensorUnit //0=code, 1=f, 2=c, 3=% switch (BleMvxApplication._rfMicro_SensorType) { case 0: if (sensorCode >= 5 && sensorCode <= 490) { item.SucessCount++; switch (BleMvxApplication._rfMicro_SensorUnit) { case 0: // code item._sensorValueSum = sensorCode; item.SensorAvgValue = item._sensorValueSum.ToString(); break; default: // % item._sensorValueSum = (double)sensorCode / 512 * 100; item.SensorAvgValue = item._sensorValueSum.ToString(); break; } } break; default: if (temp >= 1300 && temp <= 3500) { item.SucessCount++; UInt64 caldata = (UInt64)(((UInt64)info.Bank2Data[0] << 48) | ((UInt64)info.Bank2Data[1] << 32) | ((UInt64)info.Bank2Data[2] << 16) | ((UInt64)info.Bank2Data[3])); switch (BleMvxApplication._rfMicro_SensorUnit) { case 0: // code item._sensorValueSum = temp; item.SensorAvgValue = item._sensorValueSum.ToString(); break; case 1: // F item._sensorValueSum = getTempF(temp, caldata); item.SensorAvgValue = Math.Round(item._sensorValueSum, 2).ToString(); break; default: // C item._sensorValueSum = getTempC(temp, caldata); item.SensorAvgValue = Math.Round(item._sensorValueSum, 2).ToString(); break; } } break; } /* * if (BleMvxApplication._rfMicro_SensorUnit == 0) * { * if (sensorCode >= 5 && sensorCode <= 490) * { * item.SucessCount++; * item._sensorValueSum = sensorCode; * item.SensorAvgValue = item._sensorValueSum.ToString(); * } * } * else * { * if (temp >= 1300 && temp <= 3500) * { * item.SucessCount++; * UInt64 caldata = (UInt64)(((UInt64)info.Bank2Data[0] << 48) | ((UInt64)info.Bank2Data[1] << 32) | ((UInt64)info.Bank2Data[2] << 16) | ((UInt64)info.Bank2Data[3])); * item._sensorValueSum = getTemperatue(info.Bank1Data[2], caldata); * item.SensorAvgValue = Math.Round(item._sensorValueSum, 2).ToString(); * } * }*/ } else { item.RSSIColor = "Red"; } TagInfoList.Insert(0, item); _newTagFound = true; Trace.Message("EPC Data = {0}", item.EPC); } } }); }
private void AddOrUpdateTagData(CSLibrary.Structures.TagCallbackInfo info) { InvokeOnMainThread(() => { bool found = false; int cnt; lock (TagInfoList) { #if not_binarysearch for (cnt = 0; cnt < TagInfoList.Count; cnt++) { if (TagInfoList[cnt].EPC == info.epc.ToString()) { TagInfoList[cnt].Bank1Data = CSLibrary.Tools.Hex.ToString(info.Bank1Data); TagInfoList[cnt].Bank2Data = CSLibrary.Tools.Hex.ToString(info.Bank2Data); TagInfoList[cnt].RSSI = info.rssi; //TagInfoList[cnt].Phase = info.phase; //TagInfoList[cnt].Channel = (byte)info.freqChannel; found = true; break; } } if (!found) { TagInfoViewModel item = new TagInfoViewModel(); item.timeOfRead = DateTime.Now; item.EPC = info.epc.ToString(); item.Bank1Data = CSLibrary.Tools.Hex.ToString(info.Bank1Data); item.Bank2Data = CSLibrary.Tools.Hex.ToString(info.Bank2Data); item.RSSI = info.rssi; //item.Phase = info.phase; //item.Channel = (byte)info.freqChannel; item.PC = info.pc.ToUshorts()[0]; //TagInfoList.Add(item); TagInfoList.Insert(0, item); _newTagFound = true; Trace.Message("EPC Data = {0}", item.EPC); _newTag = true; } #else string epcstr = info.epc.ToString(); try { TagInfoListSpeedup.Add(epcstr, TagInfoList.Count); RFMicroTagInfoViewModel item = new RFMicroTagInfoViewModel(); item.RSSIColor = "Black"; item.valueColor = "Black"; item.DisplayName = info.epc.ToString(); item.SensorAvgValue = temp(info.Bank2Data[4], info.Bank1Data[0], info.Bank1Data[1], info.Bank1Data[2], info.Bank1Data[3]).ToString("#0.0"); item.OCRSSI = info.Bank2Data[3]; item.SucessCount = 1; item.EPC = ""; item.GOODOCRSSI = ""; item.NickName = ""; TagInfoList.Insert(0, item); _newtagCount4BeepSound++; _newtagCount4Vibration++; _newTagPerSecond++; Trace.Message("EPC Data = {0}", item.EPC); } catch (Exception ex) { int index; if (TagInfoListSpeedup.TryGetValue(epcstr, out index)) { index = TagInfoList.Count - index; index--; TagInfoList[index].SensorAvgValue = temp(info.Bank2Data[4], info.Bank1Data[0], info.Bank1Data[1], info.Bank1Data[2], info.Bank1Data[3]).ToString("#0.0"); TagInfoList[index].OCRSSI = info.Bank2Data[3]; TagInfoList[index].SucessCount++; } else { // error found epc } } #endif } }); }