private bool BuildInitData(ref SL900ATag.InitData iData) { int appWords, delayTime, brokenWord; int maxAppwords = (1 << 9) - 1; int maxDelayTime = (1 << 12) - 1; int maxBrokenWord = ((1 << 3) - 1); appWords = -1; delayTime = -1; brokenWord = -1; if (!ParseInt(ref appWords, WordCountEdit.Text, 1, maxAppwords) || !ParseInt(ref delayTime, DelayTimeEdit.Text, 0, maxDelayTime) || !ParseInt(ref brokenWord, BrokenWordEdit.Text, 0, maxBrokenWord)) { AddLog("Init data error(s)."); AddLog("Application data words' range is 1..." + maxAppwords + ", value = " + appWords + "."); AddLog("Delay time range is 0..." + maxDelayTime + ", value = " + maxDelayTime + "."); AddLog("Broken word ptr range is 0..." + maxBrokenWord + ", value = " + maxBrokenWord + "."); return(false); } iData.appWordCount = (uint)appWords; iData.brokenWordPtr = (uint)brokenWord; iData.delayTime = (uint)delayTime; iData.dmExtSwitch = (DelayModeSel.SelectedIndex == 1); iData.enIrqTimer = IrqTimerChk.Checked; return(true); }
private void DoInitSequence() { if (currentTag != null) { SL900ATag.InitData iData = new SL900ATag.InitData(); if (BuildInitData(ref iData)) { try { currentTag.Initialize = iData; AddLog("Initialization data is written."); } catch (Exception ex) { AddLog("Initialize error."); InfoLog("Message: " + ex.Message); } } else { AddLog("Parameter error(s)."); } } }