using HybirdFrameworkCore.Autofac; using Service.Ups.Msg; using Autofac; using HybirdFrameworkCore.Autofac.Attribute; namespace Service.Ups; [Scope] public class UpsMgr { public static UpsClient? UpsClient; public static readonly UpsTelemetering UpsTelemetering = new UpsTelemetering(); public static readonly UpsRemoteComm UpsRemoteComm = new UpsRemoteComm(); /// /// 数据有效时间。单位秒 /// static int DataTimeSeconds = 20; /// /// 数据刷新时间 /// public static DateTime DataValidityTime = DateTime.Now; public static void UpsInit() { if (UpsClient == null) { UpsClient = AppInfo.Container.Resolve(); } Task.Run(() => UpsClient.Connect()); } }