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.
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
|
using HybirdFrameworkDriver.Session;
|
|
|
|
|
using HybirdFrameworkDriver.TcpClient;
|
|
|
|
|
using log4net;
|
|
|
|
|
using Service.Ups.Codec;
|
|
|
|
|
using Service.Ups.Common;
|
|
|
|
|
|
|
|
|
|
namespace Service.Ups.Client;
|
|
|
|
|
|
|
|
|
|
[Scope]
|
|
|
|
|
public class UpsClient: TcpClient<IBaseHandler, Decoder, Encoder>
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设备编号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Sn { get; set; }
|
|
|
|
|
|
|
|
|
|
private ILog Log()
|
|
|
|
|
{
|
|
|
|
|
var name = "Fire";
|
|
|
|
|
ILog logger = LogManager.GetLogger(name);
|
|
|
|
|
|
|
|
|
|
Console.WriteLine(name + "-" + logger.GetHashCode());
|
|
|
|
|
return logger;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool Connect()
|
|
|
|
|
{
|
|
|
|
|
base.BaseConnect();
|
|
|
|
|
Log().Info("ups connect succeed");
|
|
|
|
|
return Connected;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///UPS
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sn"></param>
|
|
|
|
|
/// <param name="destAddr"></param>
|
|
|
|
|
public void SessionAttr(string sn)
|
|
|
|
|
{
|
|
|
|
|
ChannelUtils.AddAttr(Channel, UpsConst.UpsSn, sn);
|
|
|
|
|
ChannelUtils.AddAttr(Channel, UpsConst.EqmTypeNo, sn);
|
|
|
|
|
ChannelUtils.AddAttr(Channel, UpsConst.EqmCode, sn);
|
|
|
|
|
}
|
|
|
|
|
}
|