public void Send() { var txMsg = new CxHsmsMessage(); txMsg.header.StreamId = 1; txMsg.header.FunctionId = 3; txMsg.header.WBit = true; var sList = new CxSecsIINodeList(); //var sSvid = new CToolkit.v1_0.Secs.SecsIINodeInt64(); var list = new List <UInt64>(); list.Add(0); list.Add(1); list.Add(2); list.Add(168); foreach (var scfg in list) { var sSvid = new CxSecsIINodeUInt64(); sSvid.Data.Add(scfg); sList.Data.Add(sSvid); } txMsg.rootNode = sList; this.client.WriteMsg(txMsg); }
public CtkProtocolTrxMessage CreateDataReqMsg <T>(IList <T> reqInfos) { var listInfo = reqInfos as IList <SNetSignalTransCfg>; if (listInfo == null) { throw new ArgumentException("未定義此型別的操作方式"); } var txMsg = new CxHsmsMessage(); txMsg.header.StreamId = 1; txMsg.header.FunctionId = 3; txMsg.header.WBit = true; var sList = new CxSecsIINodeList(); //var sSvid = new CToolkit.v1_0.Secs.SecsIINodeInt64(); foreach (var scfg in listInfo) { var sSvid = new CxSecsIINodeUInt64(); sSvid.Data.Add(scfg.Svid); sList.Data.Add(sSvid); } txMsg.rootNode = sList; return(txMsg); }
/// <summary> /// 若是Session類訊息, 將由這個Method處理 /// </summary> /// <param name="protoConn"></param> /// <param name="msg"></param> /// <returns>true代表己處理, 你不需再處理</returns> public bool ProcessSession(ISNetProtoConnectBase protoConn, object msg) { var secsMsg = msg as CxHsmsMessage; if (secsMsg == null) { throw new ArgumentException("不正確的msg型態"); } switch (secsMsg.header.SType) { case 1: protoConn.WriteMsg(CxHsmsMessage.CtrlMsg_SelectRsp(0)); return(true); case 2: return(true); case 5: protoConn.WriteMsg(CxHsmsMessage.CtrlMsg_LinktestRsp()); return(true); case 6: return(true); } return(false); }
public bool TryDequeueMsg(out object msg) { CxHsmsMessage mymsg = null; var flag = this.MsgQueue.TryDequeue(out mymsg); msg = mymsg; return(flag); }
/// <summary> /// /// </summary> /// <param name="protoConn">並非所有通訊都是繼續自Stream, 因此請實作IProtoConnectBase</param> public void FirstConnect(ISNetProtoConnectBase protoConn) { var txMsg = CxHsmsMessage.CtrlMsg_SelectReq(); protoConn.WriteMsg(txMsg); txMsg = CxHsmsMessage.CtrlMsg_LinktestReq(); protoConn.WriteMsg(txMsg); }
public void OnReceiveData(CxHsmsMessage msg) { if (this.EhReceiveData == null) { return; } this.EhReceiveData(this, new CxHsmsConnectorRcvDataEventArg() { msg = msg }); }
public int CfInit() { this.HsmsConnector = new CxHsmsConnector(); //hsmsConnector.ctkConnSocket.isActively = true; var localUri = string.IsNullOrEmpty(this.cfg.LocalUri) ? null : new Uri(this.cfg.LocalUri); var remoteUri = string.IsNullOrEmpty(this.cfg.RemoteUri) ? null : new Uri(this.cfg.RemoteUri); var localIp = CtkNetUtil.GetIpAdr1stLikelyOr127(localUri == null ? null : localUri.Host, remoteUri == null ? null : remoteUri.Host); if (localIp == null) { throw new Exception("無法取得在地IP"); } this.HsmsConnector.LocalUri = CtkNetUtil.ToUri(localIp.ToString(), localUri == null ? 0 : localUri.Port); this.HsmsConnector.EhReceiveData += delegate(Object sen, CxHsmsConnectorRcvDataEventArg ea) { var myMsg = ea.msg; //System.Diagnostics.Debug.WriteLine("S{0}F{1}", myMsg.header.StreamId, myMsg.header.FunctionId); //System.Diagnostics.Debug.WriteLine("SType= {0}", myMsg.header.SType); switch (myMsg.header.SType) { case 1: HsmsConnector.Send(CxHsmsMessage.CtrlMsg_SelectRsp(0)); return; case 5: HsmsConnector.Send(CxHsmsMessage.CtrlMsg_LinktestRsp()); return; } this.OnReceiveData(myMsg); }; return(0); }
public int CfInit() { hsmsConnector = new CxHsmsConnector(); //hsmsConnector.ctkConnSocket.isActively = true; var localUri = new Uri(this.cfg.LocalUri); var remoteUri = new Uri(this.cfg.RemoteUri); var localIp = CtkNetUtil.GetIpAdr1stLikelyOr127(localUri.Host, remoteUri.Host); if (localIp == null) { throw new Exception("無法取得在地IP"); } hsmsConnector.LocalUri = CtkNetUtil.ToUri(localIp.ToString(), localUri.Port); hsmsConnector.EhReceiveData += delegate(Object sen, CxHsmsConnectorRcvDataEventArg ea) { var myMsg = ea.msg; switch (myMsg.header.SType) { case 1: hsmsConnector.Send(CxHsmsMessage.CtrlMsg_SelectRsp(0)); return; case 5: hsmsConnector.Send(CxHsmsMessage.CtrlMsg_LinktestRsp()); return; } this.OnReceiveData(myMsg); }; return(0); }
public MacS3F17DockStart(CxHsmsMessage msg) { this.Message = msg; }
public MacS6F11(CxHsmsMessage msg) { this.Message = msg; }
public MacS3F17Undock(CxHsmsMessage msg) { this.Message = msg; }
public MacS1F3QuerySvid(CxHsmsMessage msg) { this.Message = msg; }
public MacS3F17CreateJob(CxHsmsMessage msg) { this.Message = msg; }
public MacS6F11DockComplete(CxHsmsMessage msg) { this.Message = msg; }
public MacSecsReportBase(CxHsmsMessage msg) { this.Message = msg; }