private void buttonWrite_Click(object sender, EventArgs e) { byte[] data; int blockSize; int dbn; int address; int idx; int mode; long datalocation = FedmIscReaderConst.DATA_TxDB; int bankidx; int iBack = 0; mode = this.comboBoxMod.SelectedIndex; int selRow; selRow = this.listBoxTags.SelectedIndex; if (selRow == -1 && mode > 0) { MessageBox.Show(this, "There was no tag selected.", "Error"); return; } // set IscTable-Parameter dbn = (int)this.numericUpDownDBN.Value; address = (int)this.numericUpDownAdr.Value; blockSize = (int)this.numericUpDownDBS.Value; fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_CMD, 0x24); // write multiple blocks fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_REQ_DBN, dbn); fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_REQ_DB_ADR, address); fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_MODE, mode); fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_REQ_UID, serialNumber); fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_REQ_DB_SIZE, blockSize); //if uhfTransponder is found if (uhfTransponder == true) { bankidx = this.comboBoxBank.SelectedIndex; iBack = fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_MODE_UID_LF, true); iBack = fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_MODE_EXT_ADR, true); iBack = fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_REQ_UID_LEN, SerialNumberLen); iBack = fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_REQ_BANK, (byte)0); iBack = fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_REQ_BANK_BANK_NR, bankidx); iBack = fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_ACCESS_PW_LENGTH, (byte)0); iBack = fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_REQ_DB_ADR_EXT, address); //fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_REQ_BANK_ACCESS_FLAG, (bool)true); //fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_ACCESS_PW_LENGTH, (byte)4); //fedm.SetData(FedmIscReaderID.FEDM_ISC_TMP_B0_ACCESS_PW, "11112222"); } switch (mode) { case 0: idx = 0; break; case 1: idx = fedm.FindTableIndex(0, FedmIscReaderConst.ISO_TABLE, FedmIscReaderConst.DATA_SNR, serialNumber); break; case 2: idx = fedm.FindTableIndex(0, FedmIscReaderConst.ISO_TABLE, FedmIscReaderConst.DATA_IS_SELECTED, true); break; default: return; } FedmTableItem item; try { item = fedm.GetTableItem(idx, FedmIscReaderConst.ISO_TABLE); } catch (System.Exception ex) { MessageBox.Show(this, ex.ToString(), "Error"); return; } item.SetData(FedmIscReaderConst.DATA_BLOCK_SIZE, blockSize); int i; for (i = address; i <= address + (dbn - 1); i++) { data = HexEdit.GetData(i, blockSize); //for uhftransponder if (uhfTransponder == true) { bankidx = this.comboBoxBank.SelectedIndex; switch (bankidx) { case 0: datalocation = FedmIscReaderConst.DATA_TxDB_RES_BANK; break; case 1: datalocation = FedmIscReaderConst.DATA_TxDB_EPC_BANK; break; case 2: datalocation = FedmIscReaderConst.DATA_TxDB_TID_BANK; break; case 3: datalocation = FedmIscReaderConst.DATA_TxDB; break; default: break; } } item.SetData(datalocation, i, data); } try { iBack = fedm.SetTableItem(idx, item); } catch (System.Exception ex) { MessageBox.Show(this, ex.ToString(), "Error"); return; } //Send WriteMultipleBlocks-Protocol try { iBack = fedm.SendProtocol(0xB0); } catch (System.Exception ex) { MessageBox.Show(this, ex.ToString(), "Error"); return; } }