Ejemplo n.º 1
0
        /// <summary>
        /// 중앙, 2중앙 발령 승계를 위한 데이터 수신
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void recvCenterAlarm_ReceivedData(object sender, NCasUdpRecvEventArgs e)
        {
            try
            {
                NCasProtocolBase protoBase = NCasProtocolFactory.ParseFrame(e.Buff);

                if (protoBase.TcCode == NCasDefineTcCode.TcAlarmOrder)
                {
                    NCasProtocolTc1 protoTc1 = protoBase as NCasProtocolTc1;

                    if (protoTc1.Source == NCasDefineOrderSource.CentCtrlRoom ||
                        protoTc1.Source == NCasDefineOrderSource.CentCtrlRoom2 ||
                        protoTc1.Source == NCasDefineOrderSource.CentCtrlRoom3)
                    {
                        if (protoTc1.AlarmKind == NCasDefineOrderKind.AlarmStandby)
                        {
                            OrderView19201080 orderView = (OrderView19201080)this.dicViews[ViewKind.OrderView19201080];

                            MethodInvoker invoker = delegate()
                            {
                                orderView.SetCenterAlarmOrder(true);
                            };

                            if (this.InvokeRequired)
                            {
                                this.Invoke(invoker);
                            }
                            else
                            {
                                invoker();
                            }
                        }
                        else if (protoTc1.AlarmKind == NCasDefineOrderKind.AlarmCancel)
                        {
                            OrderView19201080 orderView = (OrderView19201080)this.dicViews[ViewKind.OrderView19201080];

                            MethodInvoker invoker = delegate()
                            {
                                orderView.SetCenterAlarmOrder(false);
                            };

                            if (this.InvokeRequired)
                            {
                                this.Invoke(invoker);
                            }
                            else
                            {
                                invoker();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                NCasLoggingMng.ILogging.WriteLog("MainForm", "중앙, 2중앙 발령 승계를 위한 데이터 수신 Method Exception - " + ex.Message);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// GIS서버에서 수신받는 발령 데이터(TC 1)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void recvUdpGis_ReceivedData(object sender, NCasUdpRecvEventArgs e)
 {
     try
     {
         NCasProtocolBase protoBase = NCasProtocolFactory.ParseFrame(e.Buff);
         NCasProtocolTc1  protoTc1  = protoBase as NCasProtocolTc1;
         this.mmfMng.WriteOrder(protoTc1);
     }
     catch (Exception ex)
     {
         NCasLoggingMng.ILogging.WriteLog("MainForm", "GIS서버에서 수신받는 Method Exception - " + ex.Message);
     }
 }
Ejemplo n.º 3
0
        public override void CloneFrom(NCasObject obj)
        {
            OrderBizData newObject = obj as OrderBizData;

            this.almProtocol               = newObject.almProtocol;
            this.allDestinationFlag        = newObject.allDestinationFlag;
            this.orderGroupFlag            = newObject.orderGroupFlag;
            this.orderDistFlag             = newObject.orderDistFlag;
            this.orderTermFlag             = newObject.orderTermFlag;
            this.selectedDisasterBroadKind = newObject.selectedDisasterBroadKind;
            this.lastOrderKind             = newObject.lastOrderKind;
            this.isLocal                  = newObject.isLocal;
            this.isEnd                    = newObject.isEnd;
            this.ttsOrderFlag             = newObject.ttsOrderFlag;
            this.selectedStoredMessage    = newObject.selectedStoredMessage;
            this.storedMessageRepeatCount = newObject.storedMessageRepeatCount;
            this.selectedTtsMessage       = newObject.selectedTtsMessage;
            this.groupName                = newObject.groupName;
            this.sendBuff                 = newObject.sendBuff;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 그룹 발령 명령을 처리하는 메소드
        /// </summary>
        /// <param name="orderBizData"></param>
        private void OrderGroup()
        {
            byte[]        tmpBuff               = TtsControlDataMng.GetTeleStartData();
            string        teleServerIpAddr      = NCasUtilityMng.INCasCommUtility.AddIpAddr(NCasUtilityMng.INCasCommUtility.MakeNetIdByAnyIp(this.provInfo.NetIdToString), 0, 0, 1, 111);
            List <string> reptAlarmServerIpAddr = new List <string>();

            for (int i = 0; i < this.provInfo.LstRepts.Count; i++)
            {
                reptAlarmServerIpAddr.Add(NCasUtilityMng.INCasCommUtility.AddIpAddr(this.provInfo.LstRepts[i].NetIdToString, 0, 0, 1, 1));
            }

            foreach (OrderBizData orderBizData in this.lstOrderBizData)
            {
                udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, orderBizData.SendBuff);
                udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, orderBizData.SendBuff);

                for (int i = 0; i < reptAlarmServerIpAddr.Count; i++)
                {
                    udpSoc.SendTo(reptAlarmServerIpAddr[i], (int)NCasPortID.PortIdIntTeleRAlarm, orderBizData.SendBuff);
                }
            }

            tmpBuff = TtsControlDataMng.GetTeleStopData();

            if (this.lstOrderBizData[0].AlmProtocol.AlarmKind == NCasDefineOrderKind.AlarmBiochemist ||
                (this.lstOrderBizData[0].AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && this.lstOrderBizData[0].SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Mic) ||
                (this.lstOrderBizData[0].AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && this.lstOrderBizData[0].SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Tts))
            {
                Thread.Sleep(this.SendDelay);
            }

            //그룹발령 정보 전송 (TC 77)
            for (int i = 0; i < lstOrderBizData[0].GroupName.Count; i++)
            {
                NCasProtocolBase protoBase77 = NCasProtocolFactory.CreateCasProtocol(NCasDefineTcCode.TcGroupOrder);
                NCasProtocolTc77 protoTc77   = protoBase77 as NCasProtocolTc77;
                protoTc77.AlarmKind = this.lstOrderBizData[0].AlmProtocol.AlarmKind;
                protoTc77.AlarmNetIdOrIpByString = this.lstOrderBizData[0].AlmProtocol.AlarmNetIdOrIpByString;
                protoTc77.CtrlKind            = this.lstOrderBizData[0].AlmProtocol.CtrlKind;
                protoTc77.GroupName           = lstOrderBizData[0].GroupName[i];
                protoTc77.GroupNum            = (byte)lstOrderBizData[0].GroupName.Count;
                protoTc77.Media               = this.lstOrderBizData[0].AlmProtocol.Media;
                protoTc77.Mode                = this.lstOrderBizData[0].AlmProtocol.Mode;
                protoTc77.OrderTimeByDateTime = this.lstOrderBizData[0].AlmProtocol.OrderTimeByDateTime;
                protoTc77.Sector              = this.lstOrderBizData[0].AlmProtocol.Sector;
                protoTc77.Source              = this.lstOrderBizData[0].AlmProtocol.Source;

                byte[] tc77Buff = NCasProtocolFactory.MakeUdpFrame(protoTc77);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvMain, tc77Buff);

                string tmpLog = string.Format("GroupName - {0}, GroupNum - {1}, OrderTime - {2}", protoTc77.GroupName, protoTc77.GroupNum.ToString(), protoTc77.OrderTimeByDateTime.ToString());
                NCasLoggingMng.ILogging.WriteLog("PAlmScreenBiz", "그룹발령 정보(TC 77)를 NCasPipes.PipePcaProvMain로 전송 완료 - " + tmpLog);
                System.Diagnostics.Debug.WriteLine("### 그룹발령 정보(TC 77) - " + tmpLog);
            }

            foreach (OrderBizData orderBizData in this.lstOrderBizData)
            {
                byte[] sendBuff = orderBizData.SendBuff;
                this.mainForm.MmfMng.WriteOrder(orderBizData.AlmProtocol);

                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentCAlm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvMain, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaRgnRAlm, sendBuff);

                if ((orderBizData.AlmProtocol.AlarmNetIdOrIp & 0x0000ff00) == 0x0000fd00) //x.x.253.x
                {
                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaTermDept, sendBuff);
                }

                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaTermTerm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvDual, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaRgnDAlm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvPDAlm, sendBuff);

                if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaSate)
                {
                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentSate, sendBuff);

                    if (orderBizData.AlmProtocol.Sector == NCasDefineSectionCode.SectionDist)
                    {
                        DistInfo distInfo = this.mainForm.MmfMng.GetDistInfoByNetId(NCasUtilityMng.INCasCommUtility.SubtractIpAddr(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, 0, 0, 0, 255));

                        if (distInfo.IsDisasterDist)
                        {
                            NCasProtocolBase baseProto = NCasProtocolFactory.ParseFrame(sendBuff);
                            NCasProtocolTc1  tc1       = baseProto as NCasProtocolTc1;
                            tc1.AlarmNetIdOrIpByString = NCasUtilityMng.INCasCommUtility.AddIpAddr(tc1.AlarmNetIdOrIpByString, 0, 2, 0, 0);
                            byte[] disasterBuff = NCasProtocolFactory.MakeUdpFrame(tc1);
                            this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentSate, disasterBuff);
                        }
                    }
                }

                udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdExtCasMonitor, sendBuff);

                if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaLine)
                {
                    if (orderBizData.AlmProtocol.Sector == NCasDefineSectionCode.SectionTerm)
                    {
                        udpSoc.SendTo(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, (int)NCasPortID.PortIdAlarm, sendBuff);
                    }
                    else if (orderBizData.AlmProtocol.Sector == NCasDefineSectionCode.SectionDist)
                    {
                        DistInfo distInfo = this.mainForm.MmfMng.GetDistInfoByNetId(NCasUtilityMng.INCasCommUtility.SubtractIpAddr(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, 0, 0, 0, 255));

                        foreach (TermInfo termInfo in distInfo.LstTerms)
                        {
                            if (termInfo.UseFlag == NCasDefineUseStatus.Use)
                            {
                                udpSoc.SendTo(termInfo.IpAddrToSring, (int)NCasPortID.PortIdAlarm, sendBuff);
                            }
                        }
                    }
                }

                //지진해일 시군
                if (orderBizData.AlmProtocol.Sector == NCasDefineSectionCode.SectionDist)
                {
                    DistInfo distInfo = this.mainForm.MmfMng.GetDistInfoByNetId(NCasUtilityMng.INCasCommUtility.SubtractIpAddr(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, 0, 0, 0, 255));

                    if (distInfo.IsDisasterDist)
                    {
                        orderBizData.AlmProtocol.AlarmNetIdOrIpByString = NCasUtilityMng.INCasCommUtility.AddIpAddr(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, 0, 2, 0, 0);
                        byte[] sendDisasterBuff = NCasProtocolFactory.MakeUdpFrame(orderBizData.AlmProtocol);
                        this.mainForm.MmfMng.WriteOrder(orderBizData.AlmProtocol);

                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentCAlm, sendDisasterBuff);
                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvMain, sendDisasterBuff);
                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaRgnRAlm, sendDisasterBuff);

                        if ((orderBizData.AlmProtocol.AlarmNetIdOrIp & 0x0000ff00) == 0x0000fd00) //x.x.253.x
                        {
                            this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaTermDept, sendDisasterBuff);
                        }

                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaTermTerm, sendDisasterBuff);
                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvDual, sendDisasterBuff);
                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaRgnDAlm, sendDisasterBuff);
                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvPDAlm, sendDisasterBuff);

                        if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaSate)
                        {
                            this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentSate, sendDisasterBuff);
                        }

                        udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdExtCasMonitor, sendDisasterBuff);

                        if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaLine)
                        {
                            foreach (TermInfo termInfo in distInfo.LstTerms)
                            {
                                if (termInfo.UseFlag == NCasDefineUseStatus.Use)
                                {
                                    udpSoc.SendTo(termInfo.IpAddrToSring, (int)NCasPortID.PortIdAlarm, sendDisasterBuff);
                                }
                            }
                        }
                    }
                }

                if (orderBizData.IsEnd == PAlmScreenUIController.OrderDataSendStatus.First || orderBizData.IsEnd == PAlmScreenUIController.OrderDataSendStatus.FirstEnd)
                {
                    if (orderBizData.AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && orderBizData.SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Tts)
                    {
                        tmpBuff = TtsControlDataMng.GetTtsPlayData();
                        udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsControl, Encoding.Default.GetBytes("RES"));
                        udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, tmpBuff);
                        udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, tmpBuff);
                        Thread.Sleep(this.TtsDelay);

                        string ttsData = "TTS" + NCasContentsMng.ttsOption.SpeechSpeed.ToString().PadLeft(3, '0') +
                                         NCasContentsMng.ttsOption.RepeatCount.ToString().PadLeft(2, '0') +
                                         NCasContentsMng.ttsOption.SentenceInterval.ToString().PadLeft(4, '0') +
                                         NCasContentsMng.ttsOption.RestInterval.ToString().PadLeft(4, '0') +
                                         orderBizData.SelectedTtsMessage.Text;

                        udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsMessage, Encoding.Default.GetBytes(ttsData));
                    }
                    else if (orderBizData.AlmProtocol.AlarmKind != NCasDefineOrderKind.DisasterBroadcast)
                    {
                        udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsControl, Encoding.Default.GetBytes("RES"));
                    }
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 시군전체 발령 명령을 처리하는 메소드
        /// </summary>
        /// <param name="orderBizData"></param>
        private void OrderDistAll()
        {
            string        teleServerIpAddr      = NCasUtilityMng.INCasCommUtility.AddIpAddr(NCasUtilityMng.INCasCommUtility.MakeNetIdByAnyIp(this.provInfo.NetIdToString), 0, 0, 1, 111);
            List <string> reptAlarmServerIpAddr = new List <string>();

            for (int i = 0; i < this.provInfo.LstRepts.Count; i++)
            {
                reptAlarmServerIpAddr.Add(NCasUtilityMng.INCasCommUtility.AddIpAddr(this.provInfo.LstRepts[i].NetIdToString, 0, 0, 1, 1));
            }

            foreach (OrderBizData orderBizData in this.lstOrderBizData)
            {
                DistInfo distInfo = this.mainForm.MmfMng.GetDistInfoByNetId(NCasUtilityMng.INCasCommUtility.SubtractIpAddr(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, 0, 0, 0, 255));
                udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, orderBizData.SendBuff);
                udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, orderBizData.SendBuff);

                for (int i = 0; i < reptAlarmServerIpAddr.Count; i++)
                {
                    udpSoc.SendTo(reptAlarmServerIpAddr[i], (int)NCasPortID.PortIdIntTeleRAlarm, orderBizData.SendBuff);
                }
            }

            if (this.lstOrderBizData[0].AlmProtocol.AlarmKind == NCasDefineOrderKind.AlarmBiochemist ||
                (this.lstOrderBizData[0].AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && this.lstOrderBizData[0].SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Mic) ||
                (this.lstOrderBizData[0].AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && this.lstOrderBizData[0].SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Tts))
            {
                Thread.Sleep(this.SendDelay);
            }

            foreach (OrderBizData orderBizData in this.lstOrderBizData)
            {
                byte[]   sendBuff = orderBizData.SendBuff;
                DistInfo distInfo = this.mainForm.MmfMng.GetDistInfoByNetId(NCasUtilityMng.INCasCommUtility.SubtractIpAddr(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, 0, 0, 0, 255));
                this.mainForm.MmfMng.WriteOrder(orderBizData.AlmProtocol);

                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentCAlm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvMain, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaRgnRAlm, sendBuff);

                if ((orderBizData.AlmProtocol.AlarmNetIdOrIp & 0x0000ff00) == 0x0000fd00) //x.x.253.x
                {
                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaTermDept, sendBuff);
                }

                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaTermTerm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvDual, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaRgnDAlm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvPDAlm, sendBuff);

                if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaSate)
                {
                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentSate, sendBuff);

                    if (distInfo.IsDisasterDist)
                    {
                        NCasProtocolBase baseProto = NCasProtocolFactory.ParseFrame(sendBuff);
                        NCasProtocolTc1  tc1       = baseProto as NCasProtocolTc1;
                        tc1.AlarmNetIdOrIpByString = NCasUtilityMng.INCasCommUtility.AddIpAddr(tc1.AlarmNetIdOrIpByString, 0, 2, 0, 0);
                        byte[] tmpBuff = NCasProtocolFactory.MakeUdpFrame(tc1);
                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentSate, tmpBuff);
                    }
                }

                udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdExtCasMonitor, sendBuff);

                if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaLine)
                {
                    foreach (TermInfo termInfo in distInfo.LstTerms)
                    {
                        if (termInfo.UseFlag == NCasDefineUseStatus.Use)
                        {
                            udpSoc.SendTo(termInfo.IpAddrToSring, (int)NCasPortID.PortIdAlarm, sendBuff);
                        }
                    }
                }

                //지진해일 시군
                if (distInfo.IsDisasterDist)
                {
                    orderBizData.AlmProtocol.AlarmNetIdOrIpByString = NCasUtilityMng.INCasCommUtility.AddIpAddr(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, 0, 2, 0, 0);
                    byte[] sendDisasterBuff = NCasProtocolFactory.MakeUdpFrame(orderBizData.AlmProtocol);
                    this.mainForm.MmfMng.WriteOrder(orderBizData.AlmProtocol);

                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentCAlm, sendDisasterBuff);
                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvMain, sendDisasterBuff);
                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaRgnRAlm, sendDisasterBuff);

                    if ((orderBizData.AlmProtocol.AlarmNetIdOrIp & 0x0000ff00) == 0x0000fd00) //x.x.253.x
                    {
                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaTermDept, sendDisasterBuff);
                    }

                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaTermTerm, sendDisasterBuff);
                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvDual, sendDisasterBuff);
                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaRgnDAlm, sendDisasterBuff);
                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvPDAlm, sendDisasterBuff);

                    if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaSate)
                    {
                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentSate, sendDisasterBuff);
                    }

                    udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdExtCasMonitor, sendDisasterBuff);

                    if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaLine)
                    {
                        foreach (TermInfo termInfo in distInfo.LstTerms)
                        {
                            if (termInfo.UseFlag == NCasDefineUseStatus.Use)
                            {
                                udpSoc.SendTo(termInfo.IpAddrToSring, (int)NCasPortID.PortIdAlarm, sendDisasterBuff);
                            }
                        }
                    }
                }

                if (orderBizData.IsEnd == PAlmScreenUIController.OrderDataSendStatus.First || orderBizData.IsEnd == PAlmScreenUIController.OrderDataSendStatus.FirstEnd)
                {
                    if (orderBizData.AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && orderBizData.SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Tts)
                    {
                        byte[] tmpBuff = TtsControlDataMng.GetTtsPlayData();
                        udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsControl, Encoding.Default.GetBytes("RES"));
                        udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, tmpBuff);
                        udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, tmpBuff);
                        Thread.Sleep(this.TtsDelay);

                        string ttsData = "TTS" + NCasContentsMng.ttsOption.SpeechSpeed.ToString().PadLeft(3, '0') +
                                         NCasContentsMng.ttsOption.RepeatCount.ToString().PadLeft(2, '0') +
                                         NCasContentsMng.ttsOption.SentenceInterval.ToString().PadLeft(4, '0') +
                                         NCasContentsMng.ttsOption.RestInterval.ToString().PadLeft(4, '0') +
                                         orderBizData.SelectedTtsMessage.Text;

                        udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsMessage, Encoding.Default.GetBytes(ttsData));
                    }
                    else if (orderBizData.AlmProtocol.AlarmKind != NCasDefineOrderKind.DisasterBroadcast)
                    {
                        udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsControl, Encoding.Default.GetBytes("RES"));
                    }
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 시도 전체 발령
        /// </summary>
        /// <param name="orderBizData"></param>
        private void OrderProvAll(OrderBizData orderBizData)
        {
            NCasProtocolBase baseProto = NCasProtocolFactory.ParseFrame(orderBizData.SendBuff);
            NCasProtocolTc1  tc1       = baseProto as NCasProtocolTc1;

            tc1.AlarmNetIdOrIpByString = NCasUtilityMng.INCasCommUtility.AddIpAddr(tc1.AlarmNetIdOrIpByString, 0, 7, 0, 0);
            byte[]            sendBuff   = NCasProtocolFactory.MakeUdpFrame(tc1);
            NCasProtocolBase  protoBase  = NCasProtocolFactory.CreateCasProtocol(NCasDefineTcCode.TcPublicAlarmOrder);
            NCasProtocolTc151 protoTc151 = protoBase as NCasProtocolTc151;

            if (orderBizData.SelectedDisasterBroadKind != OrderView19201080.DisasterBroadKind.StroredMessage)
            {
                string        teleServerIpAddr      = NCasUtilityMng.INCasCommUtility.AddIpAddr(NCasUtilityMng.INCasCommUtility.MakeNetIdByAnyIp(this.provInfo.NetIdToString), 0, 0, 1, 111);
                List <string> reptAlarmServerIpAddr = new List <string>();

                for (int i = 0; i < this.provInfo.LstRepts.Count; i++)
                {
                    reptAlarmServerIpAddr.Add(NCasUtilityMng.INCasCommUtility.AddIpAddr(this.provInfo.LstRepts[i].NetIdToString, 0, 0, 1, 1));
                }

                udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, sendBuff);
                udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, sendBuff);

                for (int i = 0; i < reptAlarmServerIpAddr.Count; i++)
                {
                    udpSoc.SendTo(reptAlarmServerIpAddr[i], (int)NCasPortID.PortIdIntTeleRAlarm, sendBuff);
                }
            }

            if (tc1.AlarmKind == NCasDefineOrderKind.AlarmBiochemist ||
                (tc1.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && orderBizData.SelectedDisasterBroadKind == OrderView19201080.DisasterBroadKind.Mic) ||
                (tc1.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && orderBizData.SelectedDisasterBroadKind == OrderView19201080.DisasterBroadKind.Tts))
            {
                Thread.Sleep(this.SendDelay);
            }

            byte[] tmpStoBuff = null;

            if (orderBizData.SelectedDisasterBroadKind == OrderView19201080.DisasterBroadKind.StroredMessage)
            {
                protoTc151.AlarmKind = NCasDefineOrderKind.BroadMessage;
                protoTc151.AlarmNetIdOrIpByString = tc1.AlarmNetIdOrIpByString;
                protoTc151.AuthenFlag             = tc1.AuthenFlag;
                protoTc151.CtrlKind            = tc1.CtrlKind;
                protoTc151.Media               = tc1.Media;
                protoTc151.Mode                = tc1.Mode;
                protoTc151.Source              = tc1.Source;
                protoTc151.Sector              = tc1.Sector;
                protoTc151.RespReqFlag         = tc1.RespReqFlag;
                protoTc151.OrderTimeByDateTime = tc1.OrderTimeByDateTime;
                protoTc151.MsgNum1             = GetStoredMsgHeaderNumber(int.Parse(orderBizData.SelectedStoredMessage.MsgNum));
                protoTc151.MsgNum2             = int.Parse(orderBizData.SelectedStoredMessage.MsgNum);
                protoTc151.MsgNum3             = GetStoredMsgTailNumber(int.Parse(orderBizData.SelectedStoredMessage.MsgNum));
                protoTc151.RepeatNum           = (byte)orderBizData.StoredMessageRepeatCount;

                tmpStoBuff = NCasProtocolFactory.MakeUdpFrame(protoTc151);
            }

            this.mainForm.MmfMng.WriteOrder(tc1);

            if (orderBizData.SelectedDisasterBroadKind == OrderView19201080.DisasterBroadKind.StroredMessage) //저장메시지 발령인 경우..
            {
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdIntAuthorityDAlarm, tmpStoBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdExtCasMonitor, tmpStoBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePdaProvAlm, tmpStoBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePdaProvPDMain, tmpStoBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePdaTermTerm, tmpStoBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePdaCentSate, tmpStoBuff);
            }
            else
            {
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdIntAuthorityDAlarm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdExtCasMonitor, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePdaProvAlm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePdaProvPDMain, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePdaTermTerm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePdaCentSate, sendBuff);
            }

            if (tc1.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && orderBizData.SelectedDisasterBroadKind == OrderView19201080.DisasterBroadKind.Tts)
            {
                byte[] tmpBuff          = TtsControlDataMng.GetTtsPlayData();
                string teleServerIpAddr = NCasUtilityMng.INCasCommUtility.AddIpAddr(NCasUtilityMng.INCasCommUtility.MakeNetIdByAnyIp(this.provInfo.NetIdToString), 0, 0, 1, 111);
                udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, tmpBuff);
                udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, tmpBuff);
                udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsControl, Encoding.Default.GetBytes("RES"));
                Thread.Sleep(this.TtsDelay);

                string ttsData = "TTS" + NCasContentsMng.ttsOption.SpeechSpeed.ToString().PadLeft(3, '0') +
                                 NCasContentsMng.ttsOption.RepeatCount.ToString().PadLeft(2, '0') +
                                 NCasContentsMng.ttsOption.SentenceInterval.ToString().PadLeft(4, '0') +
                                 NCasContentsMng.ttsOption.RestInterval.ToString().PadLeft(4, '0') +
                                 orderBizData.SelectedTtsMessage.Text;

                udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsMessage, Encoding.Default.GetBytes(ttsData));
            }
            else if (tc1.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && orderBizData.SelectedDisasterBroadKind == OrderView19201080.DisasterBroadKind.Mic)
            {
                byte[] tmpBuff          = TtsControlDataMng.GetTtsPlayData();
                string teleServerIpAddr = NCasUtilityMng.INCasCommUtility.AddIpAddr(NCasUtilityMng.INCasCommUtility.MakeNetIdByAnyIp(this.provInfo.NetIdToString), 0, 0, 1, 111);
                udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, tmpBuff);
                udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, tmpBuff);
                udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsControl, Encoding.Default.GetBytes("RES"));
            }
            else if (tc1.AlarmKind != NCasDefineOrderKind.DisasterBroadcast)
            {
                udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsControl, Encoding.Default.GetBytes("RES"));
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 재발령 버튼 클릭 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnReOrder_Click(object sender, EventArgs e)
        {
            if (this.reOrderListView.Items.Count == 0)
            {
                return;
            }

            if (MessageBox.Show(string.Format("현재 보이는 경보단말을 대상으로 '{0}' 발령을 진행하겠습니까?",
                                              NCasUtilityMng.INCasCommUtility.NCasDefineOrderKind2String((this.mainForm.MmfMng.GetTermInfoByIp(this.reOrderListView.Items[0].Name)).AlarmOrderInfo.Kind)),
                                "재발령", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                this.lastAlarmOrderInfo = this.provInfo.AlarmOrderInfo;
                this.lastAlarmOrderInfo.AlarmOrderFlag          = this.provInfo.AlarmOrderInfo.AlarmOrderFlag;
                this.lastAlarmOrderInfo.CtrlKind                = this.provInfo.AlarmOrderInfo.CtrlKind;
                this.lastAlarmOrderInfo.IpAddrAlarmArea         = this.provInfo.AlarmOrderInfo.IpAddrAlarmArea;
                this.lastAlarmOrderInfo.IpAddrAlarmAreaToString = this.provInfo.AlarmOrderInfo.IpAddrAlarmAreaToString;
                this.lastAlarmOrderInfo.IpAddrBraodAreaToString = this.provInfo.AlarmOrderInfo.IpAddrBraodAreaToString;
                this.lastAlarmOrderInfo.IpAddrBroadArea         = this.provInfo.AlarmOrderInfo.IpAddrBroadArea;
                this.lastAlarmOrderInfo.Kind                = this.provInfo.AlarmOrderInfo.Kind;
                this.lastAlarmOrderInfo.Media               = this.provInfo.AlarmOrderInfo.Media;
                this.lastAlarmOrderInfo.Mode                = this.provInfo.AlarmOrderInfo.Mode;
                this.lastAlarmOrderInfo.OccurTime           = this.provInfo.AlarmOrderInfo.OccurTime;
                this.lastAlarmOrderInfo.OccurTimeToDateTime = this.provInfo.AlarmOrderInfo.OccurTimeToDateTime;
                this.lastAlarmOrderInfo.RespReq             = this.provInfo.AlarmOrderInfo.RespReq;
                this.lastAlarmOrderInfo.Section             = this.provInfo.AlarmOrderInfo.Section;
                this.lastAlarmOrderInfo.Source              = this.provInfo.AlarmOrderInfo.Source;

                List <OrderBizData> tmpOrderBuff  = new List <OrderBizData>();
                DateTime            orderDateTime = DateTime.Now;

                for (int i = 0; i < this.reOrderListView.Items.Count; i++)
                {
                    NCasProtocolBase protoBase = NCasProtocolFactory.CreateCasProtocol(NCasDefineTcCode.TcAlarmOrder);
                    NCasProtocolTc1  protoTc1  = protoBase as NCasProtocolTc1;

                    protoTc1.AlarmNetIdOrIpByString = this.reOrderListView.Items[i].Name;
                    protoTc1.OrderTimeByDateTime    = orderDateTime;
                    protoTc1.CtrlKind    = NCasDefineControlKind.ControlAlarm;
                    protoTc1.Source      = NCasDefineOrderSource.ProvCtrlRoom;
                    protoTc1.AlarmKind   = this.lastAlarmOrderInfo.Kind;
                    protoTc1.Mode        = this.lastAlarmOrderInfo.Mode;
                    protoTc1.Media       = this.lastAlarmOrderInfo.Media;
                    protoTc1.RespReqFlag = NCasDefineRespReq.ResponseReq;
                    protoTc1.AuthenFlag  = NCasDefineAuthenticationFlag.EncodeUsed;
                    protoTc1.Sector      = NCasDefineSectionCode.SectionTerm;

                    byte[]       tmpBuff      = NCasProtocolFactory.MakeUdpFrame(protoTc1);
                    OrderBizData orderBizData = new OrderBizData();
                    orderBizData.AllDestinationFlag        = false;
                    orderBizData.AlmProtocol               = protoTc1;
                    orderBizData.IsLocal                   = true;
                    orderBizData.LastOrderKind             = this.lastAlarmOrderInfo.Kind;
                    orderBizData.OrderDistFlag             = false;
                    orderBizData.OrderGroupFlag            = false;
                    orderBizData.OrderTermFlag             = true;
                    orderBizData.SendBuff                  = tmpBuff;
                    orderBizData.SelectedDisasterBroadKind = PAlmScreenUIController.DisasterBroadKind.None;
                    orderBizData.SelectedStoredMessage     = new StoredMessageText();
                    orderBizData.StoredMessageRepeatCount  = 1;
                    orderBizData.SelectedTtsMessage        = new TtsMessageText();
                    orderBizData.GroupName                 = new List <string>();
                    orderBizData.TtsOrderFlag              = false;

                    if (i == 0)
                    {
                        orderBizData.IsEnd = PAlmScreenUIController.OrderDataSendStatus.First;
                    }
                    else if (i == (this.reOrderListView.Items.Count - 1))
                    {
                        orderBizData.IsEnd = PAlmScreenUIController.OrderDataSendStatus.End;
                    }
                    else
                    {
                        orderBizData.IsEnd = PAlmScreenUIController.OrderDataSendStatus.None;
                    }

                    if (this.reOrderListView.Items.Count == 1)
                    {
                        orderBizData.IsEnd = PAlmScreenUIController.OrderDataSendStatus.FirstEnd;
                    }

                    tmpOrderBuff.Add(orderBizData);
                }

                foreach (OrderBizData orderBizData in tmpOrderBuff)
                {
                    this.mainForm.SetOrderBizData(orderBizData);
                }
            }
        }