示例#1
0
        private bool SendRawData(string rawData, int timeout)
        {
            ResetParser();
            this.DataLink.SendData(rawData);
            long t = DateTimeHelperClass.CurrentUnixTimeMillis();

            return(WaitForOK(timeout));
        }
示例#2
0
        protected internal virtual bool WaitForOK(int waitTime)
        {
            long            t = DateTimeHelperClass.CurrentUnixTimeMillis();
            ResultCodeToken e = WaitForResult(waitTime);

            if (e == null || !e.Ok)
            {
                log.InfoFormat("Timeout waiting ({0} ms) for OK resCode=\"{1}\"", new object[] { DateTimeHelperClass.CurrentUnixTimeMillis() - t, e != null ? e.ResultCode : "e == null" });
            }
            else
            {
                log.InfoFormat("Waited {0} ms for OK result: {1} ", new object[] { DateTimeHelperClass.CurrentUnixTimeMillis() - t, e.ResultCode, e.ResultCode });
                return(e.Ok);
            }
            return((e == null) ? false : e.Ok);
        }
示例#3
0
        private ResultCodeToken WaitForResult(int waitTime)
        {
            long t = DateTimeHelperClass.CurrentUnixTimeMillis();

            if (this._lastResultCode == null)
            {
                Monitor.Wait(this, TimeSpan.FromMilliseconds(waitTime));
            }
            ResultCodeToken result = _lastResultCode;

            _lastResultCode = null;
            if (result == null)
            {
                log.InfoFormat("{0} ms waited > NO RESULT: \"{1}\"", new object[] { DateTimeHelperClass.CurrentUnixTimeMillis() - t, Parser.GetBuffer() });
            }
            return(result);
        }