private void finishCmd(RESULT result) { if (cb != null) { cb (result, builder.ToString ()); } cb = null; polls = 0; state = STATE.IDLE; builder.Clear (); }
private void startCmd(string data, string expect, STATE cmd, CommandCompleteCB cb) { this.cb = cb; if (state != STATE.IDLE) { finishCmd (RESULT.ASSERT_IDLE); return; } state = cmd; expectStr = expect; polls = 0; serial.Write (data); if (expect != null) { GLib.Timeout.Add (POLL_INTERVAL, new GLib.TimeoutHandler (checkBytesToRead)); } else { finishCmd (RESULT.SUCCESS); } }
public void Probe(CommandCompleteCB cb = null) { startCmd (REQUEST_PROBE, REPLY_PROBE, STATE.CMD_PROBE, cb); }