Example #1
0
        /// <summary>
        /// Message Log
        /// </summary>
        /// <param name="strMSG"></param>
        /// <param name="bSend"></param>
        /// <returns></returns>
        private string GetMessageLog(CTibRVMessageBase oMessage, bool bSend)
        {
            StringBuilder sb = new StringBuilder();

            try
            {
                sb.Append(string.Format(" {0} {1} \r\n", bSend ? "SEND" : "RECV", oMessage.MSG_NAME));
                sb.Append(oMessage.ToString());
                sb.Append(string.Format("  {0}={1}\r\n", "SYSTEM_BYTE", oMessage.SystemBytes.ToString()));
            }
            catch (Exception ex)
            {
                //CHECK NEED  SystemLogger.Log(ex);
            }

            return(sb.ToString());
        }
Example #2
0
        /// <summary>
        /// 실제로 Message를 전송
        /// </summary>
        /// <param name="sendMessage"></param>
        /// <param name="sendMSG"></param>
        private void SendTibMessage(CTibRVMessageBase oTibMessage)
        {
            lock (_MessageSend)
            {
                try
                {
                    oTibMessage.SEND_TIME      = DateTime.Now;
                    oTibMessage.StartTickCount = System.Environment.TickCount;

                    TIBCO.Rendezvous.Message sendMessage = new TIBCO.Rendezvous.Message();

                    string sendMSG = oTibMessage.ToString();
                    sendMessage.SendSubject = REMOTE_SUBJECT;
                    sendMessage.AddField(FIELD_NAME, sendMSG);

                    tibTrans.Send(sendMessage);

                    //CELSC oELSC = oTibMessage as CELSC;
                    //if (oELSC != null)
                    //{
                    //    if (oELSC.IsOnlineChangeMessage)
                    //    {
                    //        if (RemoteControlStateChangeComplete != null)
                    //            RemoteControlStateChangeComplete(this, enumHostControl.Online);
                    //    }
                    //}

                    CEMCR oEMCR = oTibMessage as CEMCR;
                    if (oEMCR != null)
                    {
                        if (oEMCR.IsOnlineChangeMessage)
                        {
                            if (oEMCR.RCS == "F")
                            {
                                if (RemoteControlStateChangeComplete != null)
                                {
                                    RemoteControlStateChangeComplete(this, enumHostControl.Offline);
                                }
                            }
                            else
                            {
                                if (RemoteControlStateChangeComplete != null)
                                {
                                    RemoteControlStateChangeComplete(this, enumHostControl.Online);
                                }
                            }
                        }
                    }

                    // 보낸 Message String 에 System Byte 추가함.
                    sendMSG += string.Format(" SYSTEM_BYTE={0}", oTibMessage.SystemBytes.ToString());

                    CLogManager.Instance.Log(new CTIBRVFormat(Catagory.Info, oTibMessage.EQP, sendMSG));

                    //CHECK NEED  SystemLogger.Log(Level.Verbose, GetMessageLog(sendMSG, true), ToString(), this.Name);
                }
                catch (Exception ex)
                {
                    CLogManager.Instance.Log(new CExceptionLogFormat(Catagory.Error, "EMP", ex));
                    CLogManager.Instance.Log(new CStatusLogFormat(Catagory.Error, "OGS", "TIB", "SendTibMessage \r\n" + ex.ToString()));
                }
            }
        }