using Ips.Library.Basic; using Ips.Library.DxpLib; using Ips.Library.Entity; using Ips.Library.Signals; using Ips.Library.WebApi; using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Ips.Service.CpuServer { /// /// 同频对消接口 /// public class TpdxController : BaseController { [Autowired] private TpdxService TpdxService { get; set; }//Service单例注入方式1 //private TpdxService TpdxServiceAutowired { get; set; }//Service单例注入方式2 /// /// 开始同频对消 /// /// 对消参数 /// [HttpPost] public async Task> Start(CorParams dto) { return Error("功能暂未实现"); try { if (!AppConst.UseTpdx) { return Error($"CPU服务[{AppConst.SvrNo}]没有启用同频对消功能!"); } var res = await TpdxService.StartAsync(dto); IpsLogger.Info($"同频对消完成"); return Success(res); } catch (Exception ex) { IpsLogger.Error($"CPU服务[{AppConst.SvrNo}]同频对消异常,{ex.Message}", ex); return Error($"CPU服务[{AppConst.SvrNo}]同频对消异常"); } } /// /// 停止同频对消 /// /// [HttpPost] public async Task Stop() { var res = await Task.Run(() => { IpsLogger.Info($"接收{RemoteIp}下发的停止同频对消任务"); try { IpsLogger.Info("同频对消已停止"); return Success(); } catch (Exception ex) { IpsLogger.Error($"停止同频对消异常", ex); return Error("停止同频对消异常"); } }); return res; } } }