dc/Commands/Command.S2F15.cs
13118993771@163.com 5e9d0f1e2d EAP
2022-04-01 17:03:54 +08:00

62 lines
2.9 KiB
C#

// ********************************************************************************
// 文件名字: Command.S2F15
// 文件描述: Command.S2F15
// 开发人员: Michael
// 创建时间: 2019/11/8 0:08
//
// 更新历史:
// + 创建 Command.S2F15.cs 文件. by Michael @2019/11/8 0:08
// ********************************************************************************
using ARI.EAP.HOST;
using ARI.EAP.HOST.MQ.body;
using ARI.EAP.HOST.SRD;
using Glorysoft.SECS.EQP.Message;
using Glorysoft.SECS.EQP.Utilities;
using Glorysoft.SECSwell;
using System;
using System.Linq;
namespace Glorysoft.SECS.EQP.Commands
{
public partial class Command
{
public static void S2F15Command(S2F15Item items, object tag = null)
{
if (SimulatorInfo.Instance.Context != null && SimulatorInfo.Instance.Context.IsConnected)
{
var trans = SimulatorInfo.Instance.Context.GetTransaction(2, 15, "S2F15");
if (tag.GetType()== typeof(int))
{
ECChangeBody eCChangeBody = new ECChangeBody();
foreach (var item in items.ECs)
{
var ec = SECSUtil.CreateSECSItem(nameof(items.ECs), eSECS_FORMAT.LIST);
ec.Add(SECSUtil.CreateSECSItem(nameof(item.ECID), eSECS_FORMAT.U4, item.ECID));
ec.Add(SECSUtil.CreateSECSItem(nameof(item.ECV), eSECS_FORMAT.U1, item.ECV));
trans.Primary.Root.Add(ec);
eCChangeBody.ECList.Add($"{item.ECID}({Configuration.conf.sRDConfiguration.findEC(item.ECID)})", item.ECV.ToString());
}
tag = eCChangeBody;
}
else
{
var content = Configuration.conf.commandContentCollection.findContent("S2F15_ControlState").content;
foreach (string value in content)
{
var ec = SECSUtil.CreateSECSItem(nameof(items.ECs), eSECS_FORMAT.LIST);
var ecv = Configuration.conf.sRDConfiguration.findEC(value);
ec.Add(SECSUtil.CreateSECSItem(value, eSECS_FORMAT.U4, ecv.ecid));
trans.Primary.Root.Add(ec);
}
trans.Primary.Root.Item(1).Add(SECSUtil.CreateSECSItem("ECV", eSECS_FORMAT.U1, 5));
trans.Primary.Root.Item(2).Add(SECSUtil.CreateSECSItem("ECV", eSECS_FORMAT.U1, 1));
}
trans.Tag = tag;
SimulatorInfo.Instance.Context.SendMessage(trans);
Global.MF.addlog(LoggerService.HtoE, $"S{trans.Primary.Stream}F{trans.Primary.Function}", LoggerService.Send, trans.Description, "=" + trans.Primary.SystemBytes.ToString());
LoggerService.SECSLogger.Info(trans.Primary);
}
}
}
}