private void AddOrUpdateTagData(CSLibrary.Structures.TagCallbackInfo info) { bool found = false; int cnt; lock (TagInfoList) { string EPC = info.epc.ToString(); string BStatus = ""; if ((info.Bank1Data[0] & 0x02) != 0) { BStatus = "Fail"; } else { BStatus = "OK"; } for (cnt = 0; cnt < TagInfoList.Count; cnt++) { if (TagInfoList[cnt].EPC == EPC) { found = true; break; } } if (found) { TagInfoList[cnt].B = BStatus; } else { ColdChainTagInfoViewModel item = new ColdChainTagInfoViewModel(); item.EPC = EPC; item.B = BStatus; TagInfoList.Insert(0, item); } } }
private void AddOrUpdateTagData(CSLibrary.Structures.TagCallbackInfo info) { bool found = false; int cnt; lock (TagInfoList) { string EPC = info.epc.ToString(); string LogStatus = ""; string T1Status = ""; string T2Status = ""; string BStatus = ""; switch (info.Bank2Data[4] & 0x03) { case 0: case 2: LogStatus = "Stop"; break; case 1: LogStatus = "Recording"; break; case 3: LogStatus = "Error"; break; } //if ((tagdata[e.info.pc.EPCLength + 10] & 0x02) != 0) if ((info.Bank2Data[8] & 0x02) != 0) { T1Status = "Fail"; } else { T1Status = "OK"; } if ((info.Bank2Data[8] & 0x04) != 0) { T2Status = "Fail"; } else { T2Status = "OK"; } if ((info.Bank2Data[0] & 0x8000) != 0) { BStatus = "Fail"; } else { BStatus = "OK"; } for (cnt = 0; cnt < TagInfoList.Count; cnt++) { if (TagInfoList[cnt].EPC == EPC) { found = true; break; } } if (found) { TagInfoList[cnt].LogStatus = LogStatus; TagInfoList[cnt].T1 = T1Status; TagInfoList[cnt].T2 = T2Status; TagInfoList[cnt].B = BStatus; } else { ColdChainTagInfoViewModel item = new ColdChainTagInfoViewModel(); item.EPC = EPC; item.LogStatus = LogStatus; item.T1 = T1Status; item.T2 = T2Status; item.B = BStatus; TagInfoList.Insert(0, item); } } }