Example #1
0
        private static void ReadOnce()
        {
            GPRS_DATA_RECORD dataRecord  = new GPRS_DATA_RECORD();
            bool             isNeedReply = false;
            StringBuilder    mess        = new StringBuilder(100);

            if (HDDTUAPI.do_read_proc(ref dataRecord, mess, isNeedReply) >= 0)
            {
                // 本服务以非阻塞模式运行, do_read_proc 无论有无消息都立即返回
                DTUResolverManager.Append(dataRecord);
            }
        }
Example #2
0
 public static void Stop()
 {
     if (!IsRuning)
     {
         return;
     }
     DTUReader.Stop();
     if (DTUReader.IsRuning)
     {
         TraceManager.AppendErrMsg("DTU读取器关闭失败");
     }
     DTUResolverManager.Stop();
     if (DTUResolverManager.IsRuning)
     {
         TraceManager.AppendErrMsg("DTU解析器关闭失败");
     }
     IsRuning = false;
 }
Example #3
0
        public static void Start()
        {
            if (IsRuning)
            {
                return;
            }
            //先打开解析器,再打开读取器
            DTUResolverManager.Start();
            if (!DTUResolverManager.IsRuning)
            {
                Stop();
                TraceManager.AppendErrMsg("DTU解析器打开失败");
                return;
            }
            DTUReader.Start();
            if (!DTUReader.IsRuning)
            {
                Stop();
                TraceManager.AppendErrMsg("DTU读取器打开失败");
                return;
            }

            IsRuning = true;
        }