123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- using SecsGem.Core.SecsEnumData;
- using SecsGem.Core;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using SecsGem.Core.ItemModel;
- using SecsGem.Core.EnumData;
- using SecsGem.Core.Hsms;
- namespace EapClientSimulator
- {
- public class SecsMessageReplyUtil
- {
- /// <summary>
- /// 构建连接测试命令(心跳)
- /// </summary>
- /// <param name="deviceId"></param>
- /// <returns></returns>
- public static SecsMessage CreateLinkTestReplyMessage(int transactionId)
- {
- SecsHsmsMessageHeader header = new SecsHsmsMessageHeader()
- {
- Stream = 0,
- Function = 0,
- SType = SType.LinkTestResponse,
- TransactionId = transactionId,
- ReplyFlag = false
- };
- return new SecsMessage(header, null);
- }
- #region S1 Reply Message
- public static SecsMessage CreateS1F13ReplyMessage(int transactionId, SecsCOMMACK COMMACK)
- {
- SecsHsmsMessageHeader header = new SecsHsmsMessageHeader()
- {
- Stream = 0x01,
- Function = 14,
- SType = SType.DataMessage,
- TransactionId = transactionId,
- ReplyFlag = false
- };
- Item item = new ListItem();
- Item commackItem = new BinaryItem((byte)COMMACK);
- item.AddItem(commackItem);
- Item subItem = new ListItem();
- StringItem mdlnItem = new StringItem(DataFormat.Ascii, "EAP");
- subItem.AddItem(mdlnItem);
- StringItem verItem = new StringItem(DataFormat.Ascii, "1.0.1");
- subItem.AddItem(verItem);
- item.AddItem(subItem);
- return new SecsMessage(header, item);
- }
- public static SecsMessage CreateS1F1ReplyMessage(int transactionId)
- {
- SecsHsmsMessageHeader header = new SecsHsmsMessageHeader()
- {
- Stream = 0x01,
- Function = 2,
- SType = SType.DataMessage,
- TransactionId = transactionId,
- ReplyFlag = false
- };
- Item item = new ListItem();
- StringItem mdlnItem = new StringItem(DataFormat.Ascii, "EAP");
- item.AddItem(mdlnItem);
- StringItem verItem = new StringItem(DataFormat.Ascii, "1.0.1");
- item.AddItem(verItem);
- return new SecsMessage(header, item);
- }
- #endregion
- #region S5
- public static SecsMessage CreateS5F1ReplyMessage(int transactionId)
- {
- SecsHsmsMessageHeader header = new SecsHsmsMessageHeader()
- {
- Stream = 0x05,
- Function = 2,
- SType = SType.DataMessage,
- TransactionId = transactionId,
- ReplyFlag = false
- };
- Item item = new BinaryItem(0);
- return new SecsMessage(header, item);
- }
- #endregion
- #region S6
- public static SecsMessage CreateS6F11ReplyMessage(int transactionId)
- {
- SecsHsmsMessageHeader header = new SecsHsmsMessageHeader()
- {
- Stream = 0x06,
- Function = 12,
- SType = SType.DataMessage,
- TransactionId = transactionId,
- ReplyFlag = false
- };
- Item item = new BinaryItem(0);
- return new SecsMessage(header, item);
- }
- #endregion
- }
- }
|