/// <summary> /// 发送FECC /// </summary> /// <param name="key">FECC Key</param> public void StartSendFECC(FECCKey key) { var errno = PlcmProxy.SendFECCKey(this.CallHandle, key, FECCAction.START); if (errno != ErrorNumber.OK) { var errMsg = string.Format("发送FECC({0}) Start失败,errno={1}", key, errno); log.Error(errMsg); throw new Exception(errMsg); } log.Info(string.Format("发送FECC({0}) Start成功.", key)); feccKey = key; feccTimer?.Dispose(); feccTimer = new Timer() { Interval = 200 }; feccTimer.Tick += (sender, args) => { errno = PlcmProxy.SendFECCKey(this.CallHandle, feccKey, FECCAction.CONTINUE); if (errno != ErrorNumber.OK) { var errMsg = string.Format("发送FECC({0}) Continue失败,errno={1}", key, errno); log.Error(errMsg); throw new Exception(errMsg); } log.Info(string.Format("发送FECC({0}) Continue成功", key)); }; feccTimer.Start(); }
/// <summary> /// 结束FECC发送 /// </summary> public void StopSendFECC() { feccTimer?.Stop(); var errno = PlcmProxy.SendFECCKey(this.CallHandle, feccKey, FECCAction.STOP); if (errno != ErrorNumber.OK) { var errMsg = string.Format("发送FECC({0}) Stop,errno={1}", feccKey, errno); log.Error(errMsg); throw new Exception(errMsg); } log.Info(string.Format("发送FECC({0}) Stop失败", feccKey)); }