public void SendEPIMessage(int installationNo, string barposName, string message, DateTime dWhen, int nTimeout, MessagePriority priority, int CMD = 78) { using (ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "SendEPIMessage")) { Log.Info(PROC, "Started"); try { MonTgt_H2G_EPI_Info monitorTarget = new MonTgt_H2G_EPI_Info() { EPICommand = Convert.ToByte(CMD), EPIMessages = ASCIIEncoding.UTF8.GetBytes(message) }; myEPIMessage response = new myEPIMessage() { //myRequest._ShowTime = dWhen; _UDP = installationNo, _MSG = message, _BarPos = barposName, _Timeout = nTimeout, _Priority = priority, MonitorTarget = monitorTarget, _CMD = 79, _isSendPending = true }; if (priority == MessagePriority.HIGH) { if (_epiMsgsHighPriorityColl[installationNo].ContainsKey(monitorTarget.ToString())) { _epiMsgsHighPriorityColl[installationNo][monitorTarget.ToString()] = response; } else { _epiMsgsHighPriorityColl[installationNo].TryAdd(monitorTarget.ToString(), response); } } else if (priority == MessagePriority.NORMAL) { if (_epiMsgsNormalPriorityColl[installationNo].ContainsKey(monitorTarget.ToString())) { _epiMsgsNormalPriorityColl[installationNo][monitorTarget.ToString()] = response; } else { _epiMsgsNormalPriorityColl[installationNo].TryAdd(monitorTarget.ToString(), response); } } } catch (Exception ex) { Log.Exception(PROC, ex); } } }
public void SendEPIMessage(int installationNo, MessagePriority priority, IMonitorEntity_MsgTgt monitorTarget) { using (ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "SendEPIMessage")) { Log.Info(PROC, "Started"); try { myEPIMessage response = new myEPIMessage() { //myRequest._ShowTime = dWhen; _UDP = installationNo, _MSG = string.Empty, //myRequest._BarPos = sBarposName; //myRequest._Timeout = nTimeout; _Priority = priority, MonitorTarget = monitorTarget, _CMD = 79, _isSendPending = true }; if (priority == MessagePriority.HIGH) { if (_epiMsgsHighPriorityColl[installationNo].ContainsKey(monitorTarget.ToString())) { _epiMsgsHighPriorityColl[installationNo][monitorTarget.ToString()] = response; } else { _epiMsgsHighPriorityColl[installationNo].TryAdd(monitorTarget.ToString(), response); } } else if (priority == MessagePriority.NORMAL) { if (_epiMsgsNormalPriorityColl[installationNo].ContainsKey(monitorTarget.ToString())) { _epiMsgsNormalPriorityColl[installationNo][monitorTarget.ToString()] = response; } else { _epiMsgsNormalPriorityColl[installationNo].TryAdd(monitorTarget.ToString(), response); } } } catch (Exception ex) { Log.Exception(PROC, ex); } } }