/// <summary> /// 시도전체 발령 명령을 처리하는 메소드 /// </summary> /// <param name="orderBizData"></param> private void OrderProvAll(OrderBizData orderBizData) { int udpSendCount = 4; byte[] sendBuff = orderBizData.SendBuff; 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 (orderBizData.AlmProtocol.AlarmKind == NCasDefineOrderKind.AlarmBiochemist || (orderBizData.AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && orderBizData.SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Mic) || (orderBizData.AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && orderBizData.SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Tts)) { Thread.Sleep(this.SendDelay); } if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaLine) { udpSoc.SendTo(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, (int)NCasPortID.PortIdAlarm, sendBuff); udpSoc.SendTo(this.ProvBroadIP, (int)NCasPortID.PortIdAlarm, 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); } udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdExtCasMonitor, sendBuff); if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaLine) { for (int i = 0; i < udpSendCount; i++) { udpSoc.SendTo(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, (int)NCasPortID.PortIdAlarm, sendBuff); udpSoc.SendTo(this.ProvBroadIP, (int)NCasPortID.PortIdAlarm, sendBuff); } } 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")); } }
protected override void OnAsyncExternProcessing(NCASBIZ.NCasType.NCasObject param) { if (param is OrderBizData) { try { OrderBizData orderBizData = param as OrderBizData; if (orderBizData.IsLocal == false) { return; } byte[] buff = NCasProtocolFactory.MakeUdpFrame(orderBizData.BrdProtocol); if (buff == null) { NCasLoggingMng.ILogging.WriteLog("PBrdScreenBiz", "발령이 정상적으로 처리되지 않았습니다.", "TC " + orderBizData.BrdProtocol.TcCode.ToString() + " - " + NCasUtilityMng.INCasEtcUtility.Bytes2HexString(orderBizData.BrdProtocol.GetDatas())); return; } if (orderBizData.BrdProtocol.Sector == NCasDefineSectionCode.SectionBroadShare) //광역시 전체 발령 { NCasProtocolBase baseProto = NCasProtocolFactory.ParseFrame(buff); NCasProtocolTc4 tc4 = baseProto as NCasProtocolTc4; tc4.Sector = NCasDefineSectionCode.SectionProv; NCasProtocolFactory.MakeUdpFrame(tc4); this.mainForm.MmfMng.WriteOrder(tc4); this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbRgnPBrdMan, tc4.GetDatas()); this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbProvMain, tc4.GetDatas()); string teleServerIpAddr = NCasUtilityMng.INCasCommUtility.AddIpAddr(NCasUtilityMng.INCasCommUtility.MakeNetIdByAnyIp(this.provInfo.NetIdToString), 0, 0, 1, 111); udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, tc4.GetDatas()); udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, tc4.GetDatas()); } else //시도전체 또는 시도개별 발령 { if (orderBizData.BrdProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.BrdProtocol.Media == NCasDefineOrderMedia.MediaLine) { udpSoc.SendTo(orderBizData.BrdProtocol.BroadNetIdOrIpByString, (int)NCasPortID.PortIdAlarm, buff); } this.mainForm.MmfMng.WriteOrder(orderBizData.BrdProtocol); string teleServerIpAddr = NCasUtilityMng.INCasCommUtility.AddIpAddr(NCasUtilityMng.INCasCommUtility.MakeNetIdByAnyIp(this.provInfo.NetIdToString), 0, 0, 1, 111); udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, buff); udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, buff); this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbCentCBrd, buff); this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbProvMain, buff); if (orderBizData.BrdProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.BrdProtocol.Media == NCasDefineOrderMedia.MediaSate) { this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbCentSate, buff); } if ((orderBizData.BrdProtocol.BroadNetIdOrIp & 0x0000ffff) == 0x0000ffff) //x.x.255.255 { this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbTermBroad, buff); this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbTermDept, buff); } else if ((orderBizData.BrdProtocol.BroadNetIdOrIp & 0x0000ff00) == 0x0000fe00) //x.x.254.x { this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbTermBroad, buff); } else if ((orderBizData.BrdProtocol.BroadNetIdOrIp & 0x0000ff00) == 0x0000fd00) //x.x.253.x { this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbTermDept, buff); } this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbRgnPBrdCom, buff); udpSoc.SendTo("127.0.0.1", (int)NCasPortID.PortIdExtCasMonitor, buff); if (orderBizData.BrdProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.BrdProtocol.Media == NCasDefineOrderMedia.MediaLine) { for (int i = 0; i < this.SendUnicastOrderCount; i++) { udpSoc.SendTo(orderBizData.BrdProtocol.BroadNetIdOrIpByString, (int)NCasPortID.PortIdAlarm, buff); } } } } catch (Exception ex) { NCasLoggingMng.ILoggingException.WriteException("PBrdScreenBiz", "PBrdScreenBiz.OnAsyncExternProcessing Method - OrderBizData", ex); } } else if (param is KeyBizData) { try { KeyBizData keyBizData = param as KeyBizData; if (keyBizData.IsLocal == false) { return; } this.mainForm.SendKeyDataToDual(keyBizData.KeyData); } catch (Exception ex) { NCasLoggingMng.ILoggingException.WriteException("PBrdScreenBiz", "PBrdScreenBiz.OnAsyncExternProcessing Method - KeyBizData", ex); } } else if (param is NCasPlcProtocolBase) { try { NCasPlcProtocolBase nCasPlcProtocolBase = param as NCasPlcProtocolBase; byte[] buff = NCasPlcProtocolFactory.MakeFrame(nCasPlcProtocolBase); if (nCasPlcProtocolBase.GetDatas() == null) { NCasLoggingMng.ILogging.WriteLog("PBrdScreenBiz", "NCasPlcProtocolFactory.MakeFrame is null"); return; } if (buff == null) { NCasLoggingMng.ILogging.WriteLog("PBrdScreenBiz", "buff is null"); return; } this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipeNccDevCcd, buff); } catch (Exception ex) { NCasLoggingMng.ILoggingException.WriteException("PBrdScreenBiz", "PBrdScreenBiz.OnAsyncExternProcessing Method - NCasPlcProtocolBase", ex); } } else if (param is NCasProtocolTc20) { try { NCasProtocolTc20 protocolTc20 = param as NCasProtocolTc20; if (protocolTc20.GetDatas() == null) { NCasLoggingMng.ILogging.WriteLog("PBrdScreenBiz", "TV자막이 정상적으로 처리되지 않았습니다.", "TC " + protocolTc20.TcCode.ToString() + " - " + NCasUtilityMng.INCasEtcUtility.Bytes2HexString(protocolTc20.GetDatas())); return; } NCasProtocolBase protoBase = NCasProtocolFactory.ParseFrame(protocolTc20.GetDatas()); NCasProtocolTc20 proto20 = protoBase as NCasProtocolTc20; if (protocolTc20.Sector == NCasDefineSectionCode.SectionBroadShare) //광역시 전체 { proto20.Sector = NCasDefineSectionCode.SectionProv; byte[] tmpProto20 = NCasProtocolFactory.MakeUdpFrame(proto20); this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbRgnPBrdMan, tmpProto20); this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbProvMain, tmpProto20); this.mainForm.MmfMng.WriteBroadCaptionOrder(proto20); } else //시도전체 또는 시도개별 { byte[] tmpProto20 = NCasProtocolFactory.MakeUdpFrame(proto20); this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbCentCBrd, tmpProto20); this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbProvMain, tmpProto20); this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbCentCBrd, tmpProto20); this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbTermBroad, tmpProto20); this.udpSoc.SendTo(this.IP_LOOPBACK, (int)NCasPipes.PipePcbRgnPBrdCom, tmpProto20); this.mainForm.MmfMng.WriteBroadCaptionOrder(proto20); } } catch (Exception ex) { NCasLoggingMng.ILoggingException.WriteException("PBrdScreenBiz", "PBrdScreenBiz.OnAsyncExternProcessing Method - NCasProtocolTc20", ex); } } }
/// <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")); } }