Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

62 linhas
2.8 KiB

  1. // ********************************************************************************
  2. // 文件名字: Command.S2F15
  3. // 文件描述: Command.S2F15
  4. // 开发人员: Michael
  5. // 创建时间: 2019/11/8 0:08
  6. //
  7. // 更新历史:
  8. // + 创建 Command.S2F15.cs 文件. by Michael @2019/11/8 0:08
  9. // ********************************************************************************
  10. using ARI.EAP.HOST;
  11. using ARI.EAP.HOST.MQ.body;
  12. using ARI.EAP.HOST.SRD;
  13. using Glorysoft.SECS.EQP.Message;
  14. using Glorysoft.SECS.EQP.Utilities;
  15. using Glorysoft.SECSwell;
  16. using System;
  17. using System.Linq;
  18. namespace Glorysoft.SECS.EQP.Commands
  19. {
  20. public partial class Command
  21. {
  22. public static void S2F15Command(S2F15Item items, object tag = null)
  23. {
  24. if (SimulatorInfo.Instance.Context != null && SimulatorInfo.Instance.Context.IsConnected)
  25. {
  26. var trans = SimulatorInfo.Instance.Context.GetTransaction(2, 15, "S2F15");
  27. if (tag.GetType()== typeof(int))
  28. {
  29. ECChangeBody eCChangeBody = new ECChangeBody();
  30. foreach (var item in items.ECs)
  31. {
  32. var ec = SECSUtil.CreateSECSItem(nameof(items.ECs), eSECS_FORMAT.LIST);
  33. ec.Add(SECSUtil.CreateSECSItem(nameof(item.ECID), eSECS_FORMAT.U4, item.ECID));
  34. ec.Add(SECSUtil.CreateSECSItem(nameof(item.ECV), eSECS_FORMAT.U1, item.ECV));
  35. trans.Primary.Root.Add(ec);
  36. eCChangeBody.ECList.Add($"{item.ECID}({Configurations.conf.sRDConfiguration.findEC(item.ECID)})", item.ECV.ToString());
  37. }
  38. tag = eCChangeBody;
  39. }
  40. else
  41. {
  42. var content = Configurations.conf.commandContentCollection.findContent("S2F15_ControlState").content;
  43. foreach (string value in content)
  44. {
  45. var ec = SECSUtil.CreateSECSItem(nameof(items.ECs), eSECS_FORMAT.LIST);
  46. var ecv = Configurations.conf.sRDConfiguration.findEC(value);
  47. ec.Add(SECSUtil.CreateSECSItem(value, eSECS_FORMAT.U4, ecv.ecid));
  48. trans.Primary.Root.Add(ec);
  49. }
  50. trans.Primary.Root.Item(1).Add(SECSUtil.CreateSECSItem("ECV", eSECS_FORMAT.U1, 5));
  51. trans.Primary.Root.Item(2).Add(SECSUtil.CreateSECSItem("ECV", eSECS_FORMAT.U1, 5));
  52. }
  53. trans.Tag = tag;
  54. SimulatorInfo.Instance.Context.SendMessage(trans);
  55. Global.MF.addlog(trans, LoggerService.Send, trans.Primary.Description, 0);
  56. LoggerService.SECSLogger.Info(trans.Primary);
  57. }
  58. }
  59. }
  60. }