/// <summary> /// Sends back to the originator /// </summary> /// <param name="sourceMessage">Original Message to reply to</param> /// <param name="TargetMessage">New message to be sent to originator</param> /// <param name="IncludeLocalNode">if true the message will be sent to localhost</param> /// <returns></returns> public bool SendToOriginator(TSM sourceMessage, TSM TargetMessage, bool IncludeLocalNode) { if (sourceMessage == null || TargetMessage == null) { return(false); } TargetMessage.SID = sourceMessage.SID; Guid tOrg = sourceMessage.GetOriginator(); if (tOrg == Guid.Empty) { return(false); } TargetMessage.GRO = sourceMessage.ORG; Guid tOriginatorThing = sourceMessage.GetOriginatorThing(); if (tOriginatorThing != Guid.Empty) { TargetMessage.OWN = tOriginatorThing.ToString(); } if (IncludeLocalNode) { TheBaseAssets.LocalHostQSender.SendQueued(TheBaseAssets.MyScopeManager.AddScopeID("CDE_SYSTEMWIDE;" + FNI, null, ref sourceMessage.SID, true, false), TargetMessage, false, TheBaseAssets.MyServiceHostInfo.MyDeviceInfo.DeviceID, "CDE_SYSTEMWIDE", RS, null); //GRSI: rare } return(MyQSender.SendQueued(TheBaseAssets.MyScopeManager.AddScopeID("CDE_SYSTEMWIDE;" + tOrg, null, ref sourceMessage.SID, true, false), TargetMessage, false, tOrg, "CDE_SYSTEMWIDE", RS, null)); //GRSI: rare }
/// <summary> /// Sends a message to the first node in the mesh. Is is the Node this ISB Connection is connected to /// </summary> /// <param name="TargetMessage"></param> /// <returns></returns> public bool SendToFirstNode(TSM TargetMessage) { if (TargetMessage == null) { return(false); } if (string.IsNullOrEmpty(TargetMessage.SID)) { TargetMessage.SID = mSScope; } return(MyQSender.SendQueued(TheBaseAssets.MyScopeManager.AddScopeID("CDE_SYSTEMWIDE;" + MyQSender.MyTargetNodeChannel.TruDID, true, RS), TargetMessage, false, MyQSender.MyTargetNodeChannel.TruDID, "CDE_SYSTEMWIDE", RS, null)); //GRSI: rare }
/// <summary> /// Sends a TSM via the ISB Connection to a custom Topic specified in the first parameter /// </summary> /// <param name="pTopic">Subscription topic to send to</param> /// <param name="pSend">TSM to send</param> /// <returns></returns> public bool SendTSM(string pTopic, TSM pSend) { if (MyQSender == null || pSend == null) { return(false); } if (string.IsNullOrEmpty(pSend.SID)) { pSend.SID = mSScope; } return(MyQSender.SendQueued(TheBaseAssets.MyScopeManager.AddScopeID(pTopic, RS, ref pSend.SID, false, true), pSend, false, Guid.Empty, pTopic, RS, null)); //GRSI: rare }
/// <summary> /// Sends a TSM to a specific node /// </summary> /// <param name="tOrg">Node to send to</param> /// <param name="TargetMessage">Message to be send</param> /// <param name="IncludeLocalNode">Not used! If tOrg is localhost the message will be sent to localhost</param> /// <returns></returns> public bool SendToNode(Guid tOrg, TSM TargetMessage, bool IncludeLocalNode) { if (tOrg == Guid.Empty || TargetMessage == null) { return(false); } if (string.IsNullOrEmpty(TargetMessage.SID)) { TargetMessage.SID = mSScope; } if (IncludeLocalNode) { TheBaseAssets.LocalHostQSender.SendQueued(TheBaseAssets.MyScopeManager.AddScopeID("CDE_SYSTEMWIDE;" + FNI, true, RS), TargetMessage, false, TheBaseAssets.MyServiceHostInfo.MyDeviceInfo.DeviceID, "CDE_SYSTEMWIDE", RS, null); //GRSI: rare } return(MyQSender.SendQueued(TheBaseAssets.MyScopeManager.AddScopeID("CDE_SYSTEMWIDE;" + tOrg, true, RS), TargetMessage, false, tOrg, "CDE_SYSTEMWIDE", RS, null)); //GRSI: rare }
/// <summary> /// Sends a TSM with a custom topic with a possible target and Source Sender - in Par with ICDECommChannel /// </summary> /// <param name="tTSM"></param> /// <param name="pTopic"></param> /// <param name="pTarget"></param> /// <param name="pSender"></param> /// <returns></returns> public bool SendTSM(TSM tTSM, string pTopic = null, Guid?pTarget = null, Guid?pSender = null) { if (MyQSender == null || tTSM == null) { return(false); } if (!tTSM.ORG.Contains(":") && pSender != null) { tTSM.ORG += $":{TheCommonUtils.CGuid(pSender)}"; } if (string.IsNullOrEmpty(tTSM.SID)) { tTSM.SID = mSScope; } return(MyQSender.SendQueued(TheBaseAssets.MyScopeManager.AddScopeID(pTopic, RS, ref tTSM.SID, false, true), tTSM, false, TheCommonUtils.CGuid(pTarget), pTopic, RS, null)); //GRSI: rare }