You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
829 B
37 lines
829 B
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();
|
|
|
|
/// <summary>
|
|
/// 数据有效时间。单位秒
|
|
/// </summary>
|
|
static int DataTimeSeconds = 20;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 数据刷新时间
|
|
/// </summary>
|
|
public static DateTime DataValidityTime = DateTime.Now;
|
|
|
|
public static void UpsInit()
|
|
{
|
|
if (UpsClient == null)
|
|
{
|
|
UpsClient = AppInfo.Container.Resolve<UpsClient>();
|
|
}
|
|
|
|
Task.Run(() => UpsClient.Connect());
|
|
}
|
|
} |