Пример #1
0
        private void finishCmd(RESULT result)
        {
            if (cb != null) {
                cb (result, builder.ToString ());
            }

            cb = null;
            polls = 0;
            state = STATE.IDLE;
            builder.Clear ();
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
 public void Probe(CommandCompleteCB cb = null)
 {
     startCmd (REQUEST_PROBE, REPLY_PROBE, STATE.CMD_PROBE, cb);
 }