Esempio n. 1
0
 private void OnRmtpConnected(bool pIsConnected)
 {
     if (pIsConnected)
     {
         AssistTool.WriteOutput("Rmtp服务连接成功");
     }
     if (Connected != null)
     {
         Connected(pIsConnected);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 执行RMTP监测相关指令(监测指令和非监测指令)
        /// </summary>
        /// <param name="pCommand">命令类型</param>
        /// <param name="pParameter">命令携带参数</param>
        /// <param name="pPricode">是正在进行的控制的优先级代码,默认值:1</param>
        /// <param name="pChannelid">执行任务的设备通道号,默认值:0</param>
        /// <param name="pIsNewMeasureNumber">true - 生成新测量序号,false - 保持原测量序号</param>
        public void ExecuteCommand(RmtpCommand pCommand,
                                   object pParameter        = null,
                                   int pPricode             = 1,
                                   int pChannelid           = 0,
                                   bool pIsNewMeasureNumber = false)
        {
            if (_rmtpControler == null || !_rmtpControler.IsConnected)
            {
                AssistTool.WriteOutput(string.Format("Rmtp服务连接已断开,指令“{0}”无效", pCommand));
                return;
            }

            if (!_executeRmtpFun.ContainsKey(pCommand))
            {
                return;
            }

            var cmdMessageFrame = new CommandMessageFrame(pCommand);

            _executeRmtpFun[pCommand].CommandHandler(cmdMessageFrame, new[] { pParameter, pPricode, pChannelid });
            cmdMessageFrame.Header.ChannelId = pChannelid;

            _rmtpControler.Send(cmdMessageFrame);
        }
Esempio n. 3
0
 private void OnRmtpError(string pErrorMsg)
 {
     OnError(pErrorMsg);
     AssistTool.WriteOutput(string.Format("Rmtp服务连接发生异常。{0}", pErrorMsg));
     Close();
 }