示例#1
0
        private string AllDeviceStatusRequest(BaseProto bp)
        {
            try
            {
                StringBuilder sbd = new StringBuilder();

                for (int i = 1; i < 31; i++)
                {
                    if (i == 25 || i == 26)
                    {
                        continue;
                    }

                    if (i < 10)
                    {
                        bp = PMng.GetPObject("0" + i.ToString(), string.Empty) as P01;
                        sbd.Append(PMng.MakeFrame(bp));
                        bp = null;
                    }
                    else
                    {
                        bp = PMng.GetPObject(i.ToString(), string.Empty) as P01;
                        sbd.Append(PMng.MakeFrame(bp));
                        bp = null;
                    }
                }

                return(sbd.ToString());
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
示例#2
0
        void forSpSoc_RecvNetSessionClient(object sender, DmbNetSessionRecvEventArgs e)
        {
            try
            {
                List <DmbProtocolBase> lstDmbProtoBase = new List <DmbProtocolBase>();
                DmbNetDataReceiver.ParseDmbPacket(e.Buff, e.Len, (this.forSpSoc.GetDmbNetSessionContext(e.DmbProfile.IpAddr, e.DmbProfile.Port)).TcpClient, out lstDmbProtoBase);

                foreach (DmbProtocolBase protoBase in lstDmbProtoBase)
                {
                    if (protoBase.Cmd != DmbDefineCmd.CmdP)
                    {
                    }

                    switch (protoBase.Cmd)
                    {
                    case DmbDefineCmd.CmdA:     //발령
                        DmbProtocolCmdA protoA = protoBase as DmbProtocolCmdA;
                        WMessage        wMsg   = new WMessage();
                        wMsg.AbortStatus        = 0;
                        wMsg.BoolControl        = false;
                        wMsg.BoolProcessing     = true;
                        wMsg.CommitPart         = WMessage.E_sendPart.All;
                        wMsg.DDateTime          = protoA.OrderTime;
                        wMsg.EndpointPart       = WMessage.E_sendPart.None;
                        wMsg.ID                 = uint.Parse(protoA.MsgId);
                        wMsg.IntControl         = 0;
                        wMsg.IntProcessing      = 1;
                        wMsg.Message            = protoA.Message;
                        wMsg.ProtoA             = protoA;
                        wMsg.RCount             = (uint)protoA.RgnCount;
                        wMsg.Repeats            = 1;
                        wMsg.Interval           = 0;
                        wMsg.SDevice_ALL        = false;
                        wMsg.SDevice_마을앰프       = true;
                        wMsg.SDevice_모니터링       = true;
                        wMsg.SDevice_상황실        = true;
                        wMsg.SDevice_유관기관       = true;
                        wMsg.SendID             = 0;
                        wMsg.SendMode           = (protoA.Mode == DmbDefineOrderMode.Real) ? (byte)3 : (byte)0;
                        wMsg.SMSMsg             = protoA.CbsMsg;
                        wMsg.SOPT_CONTROL       = false;
                        wMsg.SOPT_DMB           = (protoA.MsgType == DmbDefineMsgType.Navi) ? true : false;
                        wMsg.SOPT_ETC           = false;
                        wMsg.SOPT_LIVE          = false;
                        wMsg.SOPT_SMS           = (protoA.CbsMsg == string.Empty) ? false : true;
                        wMsg.SOPT_STOREDMESSAGE = (protoA.MsgType == DmbDefineMsgType.Sto) ? true : false;
                        wMsg.SOPT_TTS           = (protoA.MsgType == DmbDefineMsgType.Tts) ? true : false;
                        wMsg.SOPT_WARNING       = false;
                        wMsg.StoMsg             = protoA.Message;
                        wMsg.TkPriority         = 2;
                        wMsg.TkRegion           = (protoA.SectionCode == DmbDefineSectionCode.National) ? (uint)1 :
                                                  (protoA.SectionCode == DmbDefineSectionCode.Administrative) ? (uint)3 :
                                                  (protoA.SectionCode == DmbDefineSectionCode.Terminal) ? (uint)4 : (uint)2;
                        wMsg.TTSMsg = protoA.Message;

                        //AL1 = 공습
                        //AL2 = 경계
                        //AL3 = 재난위험
                        //ACL = 해제
                        if (protoA.DisasterCode == "AL1" || protoA.DisasterCode == "AL2" || protoA.DisasterCode == "AL3" || protoA.DisasterCode == "ACL")
                        {
                            wMsg.SOPT_DMB           = false;
                            wMsg.SOPT_SMS           = false;
                            wMsg.SOPT_STOREDMESSAGE = false;
                            wMsg.SOPT_TTS           = false;
                            wMsg.SOPT_WARNING       = true;
                        }

                        broadcast broad = null;

                        for (int i = 0; i < protoA.LstStage.Count; i++)
                        {
                            broad             = new broadcast();
                            broad.BoolAborted = false;
                            broad.BoolProcess = true;
                            broad.WMessageID  = uint.Parse(protoA.MsgId);
                            broad.StageID     = (uint)protoA.LstStage[i] + 2;
                            wMsg.BCenterList.Add(broad);
                        }

                        mapMessageRegion mmr = null;

                        for (int i = 0; i < protoA.LstFullCode.Count; i++)
                        {
                            mmr          = new mapMessageRegion();
                            mmr.DestFlag = (protoA.SectionCode == DmbDefineSectionCode.Terminal) ? (uint)1 : 0;
                            //mmr.ParentID = protoA.LstFullCode[i];
                            mmr.ParentName = protoA.LstFullCode[i];
                            mmr.WMessageID = uint.Parse(protoA.MsgId);
                            wMsg.MapTarget.Add(mmr);
                        }

                        this.mainviewform.datamanager_onWMessageUpdate(wMsg);
                        break;

                    case DmbDefineCmd.CmdF:     //제어
                        DmbProtocolCmdF protoF      = protoBase as DmbProtocolCmdF;
                        DmbProtocolCmdA subProtoA   = DmbProtocolFactory.CreateDmbProtocol(DmbDefineCmd.CmdA) as DmbProtocolCmdA;
                        string          ctrlMessage = string.Empty;

                        if (protoF.CtrlCode == DmbDefineControlCode.Reset)
                        {
                            P03 p = PMng.GetPObject("31", "1") as P03;
                            ctrlMessage = PMng.MakeFrame(p);
                        }
                        else if (protoF.CtrlCode == DmbDefineControlCode.AmpOutput)
                        {
                            //(0 : 0.1%, 1 : 25%, 2 : 50%, 3 : 75%, 4 : 90%, 5 : 100%)
                            if (protoF.LstCtrlData[0] == "1")
                            {
                                P03 p = PMng.GetPObject("38", "0") as P03;
                                ctrlMessage = PMng.MakeFrame(p);
                            }
                            else if (protoF.LstCtrlData[0] == "2")
                            {
                                P03 p = PMng.GetPObject("38", "2") as P03;
                                ctrlMessage = PMng.MakeFrame(p);
                            }
                            else if (protoF.LstCtrlData[0] == "3")
                            {
                                P03 p = PMng.GetPObject("38", "3") as P03;
                                ctrlMessage = PMng.MakeFrame(p);
                            }
                            else if (protoF.LstCtrlData[0] == "4")
                            {
                                P03 p = PMng.GetPObject("38", "5") as P03;
                                ctrlMessage = PMng.MakeFrame(p);
                            }
                        }
                        else if (protoF.CtrlCode == DmbDefineControlCode.Ars)
                        {
                            //프로토콜 없음
                        }
                        else if (protoF.CtrlCode == DmbDefineControlCode.SignBoard)
                        {
                        }

                        WMessage wMsgCtrl = new WMessage();
                        wMsgCtrl.AbortStatus        = 0;
                        wMsgCtrl.BoolControl        = true;
                        wMsgCtrl.BoolProcessing     = true;
                        wMsgCtrl.CommitPart         = WMessage.E_sendPart.All;
                        wMsgCtrl.DDateTime          = protoF.CtrlTime;
                        wMsgCtrl.EndpointPart       = WMessage.E_sendPart.None;
                        wMsgCtrl.ID                 = uint.Parse(protoF.MsgId);
                        wMsgCtrl.IntControl         = 1;
                        wMsgCtrl.IntProcessing      = 1;
                        wMsgCtrl.Message            = ctrlMessage;
                        wMsgCtrl.ProtoF             = protoF;
                        wMsgCtrl.RCount             = (uint)protoF.RgnCount;
                        wMsgCtrl.Repeats            = 1;
                        wMsgCtrl.Interval           = 5;
                        wMsgCtrl.SDevice_ALL        = true;
                        wMsgCtrl.SDevice_마을앰프       = true;
                        wMsgCtrl.SDevice_모니터링       = true;
                        wMsgCtrl.SDevice_상황실        = true;
                        wMsgCtrl.SDevice_유관기관       = true;
                        wMsgCtrl.SendDevice         = WMessage.E_DeviceType.All;
                        wMsgCtrl.SendID             = 0;
                        wMsgCtrl.SendMode           = (byte)0;
                        wMsgCtrl.SMSMsg             = string.Empty;
                        wMsgCtrl.SOPT_CONTROL       = true;
                        wMsgCtrl.SOPT_DMB           = false;
                        wMsgCtrl.SOPT_ETC           = false;
                        wMsgCtrl.SOPT_LIVE          = false;
                        wMsgCtrl.SOPT_SMS           = false;
                        wMsgCtrl.SOPT_STOREDMESSAGE = false;
                        wMsgCtrl.SOPT_TTS           = false;
                        wMsgCtrl.SOPT_WARNING       = false;
                        wMsgCtrl.StoMsg             = "특수수신기 제어";
                        wMsgCtrl.TkPriority         = 2;
                        wMsgCtrl.TkRegion           = (protoF.SectionCode == DmbDefineSectionCode.National) ? (uint)1 :
                                                      (protoF.SectionCode == DmbDefineSectionCode.Administrative) ? (uint)3 :
                                                      (protoF.SectionCode == DmbDefineSectionCode.Terminal) ? (uint)4 : (uint)2;
                        wMsgCtrl.TTSMsg = ctrlMessage;

                        broadcast broadCtrl = null;

                        for (int i = 0; i < this.datamanager.BroadList.Count; i++)
                        {
                            broadCtrl             = new broadcast();
                            broadCtrl.BoolAborted = false;
                            broadCtrl.BoolProcess = true;
                            broadCtrl.WMessageID  = uint.Parse(protoF.MsgId);
                            broadCtrl.StageID     = (uint)this.datamanager.BroadList[i].ID;
                            wMsgCtrl.BCenterList.Add(broadCtrl);
                        }

                        mapMessageRegion mmrCtrl = null;

                        for (int i = 0; i < protoF.LstFullCode.Count; i++)
                        {
                            mmrCtrl            = new mapMessageRegion();
                            mmrCtrl.DestFlag   = (protoF.SectionCode == DmbDefineSectionCode.Terminal) ? (uint)1 : 0;
                            mmrCtrl.ParentName = protoF.LstFullCode[i];
                            mmrCtrl.WMessageID = uint.Parse(protoF.MsgId);
                            wMsgCtrl.MapTarget.Add(mmrCtrl);
                        }

                        subProtoA.DisasterCode = "STT";
                        subProtoA.SectionCode  = protoF.SectionCode;
                        subProtoA.LstStage.Add(DmbDefineStage.Kbs);
                        subProtoA.LstStage.Add(DmbDefineStage.Mbc);
                        subProtoA.LstStage.Add(DmbDefineStage.Sbs);
                        subProtoA.LstStage.Add(DmbDefineStage.Ytn);
                        wMsgCtrl.ProtoA = subProtoA;

                        this.mainviewform.datamanager_onWMessageUpdate(wMsgCtrl);
                        break;

                    case DmbDefineCmd.CmdG:     //상태요청
                        P01             p01            = new P01();
                        string          allRequestData = this.AllDeviceStatusRequest(p01);
                        DmbProtocolCmdG protoG         = protoBase as DmbProtocolCmdG;
                        DmbProtocolCmdA subProtoA1     = DmbProtocolFactory.CreateDmbProtocol(DmbDefineCmd.CmdA) as DmbProtocolCmdA;
                        WMessage        wMsgCtrl1      = new WMessage();
                        wMsgCtrl1.AbortStatus        = 0;
                        wMsgCtrl1.BoolControl        = true;
                        wMsgCtrl1.BoolProcessing     = true;
                        wMsgCtrl1.CommitPart         = WMessage.E_sendPart.All;
                        wMsgCtrl1.DDateTime          = DateTime.Now;
                        wMsgCtrl1.EndpointPart       = WMessage.E_sendPart.None;
                        wMsgCtrl1.ID                 = 1;
                        wMsgCtrl1.IntControl         = 1;
                        wMsgCtrl1.IntProcessing      = 1;
                        wMsgCtrl1.Message            = allRequestData;
                        wMsgCtrl1.RCount             = 1;
                        wMsgCtrl1.Repeats            = 1;
                        wMsgCtrl1.Interval           = 5;
                        wMsgCtrl1.SDevice_ALL        = true;
                        wMsgCtrl1.SDevice_마을앰프       = true;
                        wMsgCtrl1.SDevice_모니터링       = true;
                        wMsgCtrl1.SDevice_상황실        = true;
                        wMsgCtrl1.SDevice_유관기관       = true;
                        wMsgCtrl1.SendDevice         = WMessage.E_DeviceType.All;
                        wMsgCtrl1.SendID             = 0;
                        wMsgCtrl1.SendMode           = (byte)0;
                        wMsgCtrl1.SMSMsg             = string.Empty;
                        wMsgCtrl1.SOPT_CONTROL       = true;
                        wMsgCtrl1.SOPT_DMB           = false;
                        wMsgCtrl1.SOPT_ETC           = false;
                        wMsgCtrl1.SOPT_LIVE          = false;
                        wMsgCtrl1.SOPT_SMS           = false;
                        wMsgCtrl1.SOPT_STOREDMESSAGE = false;
                        wMsgCtrl1.SOPT_TTS           = false;
                        wMsgCtrl1.SOPT_WARNING       = false;
                        wMsgCtrl1.StoMsg             = "특수수신기 상태요청";
                        wMsgCtrl1.TkPriority         = 2;
                        wMsgCtrl1.TkRegion           = 4;
                        wMsgCtrl1.TTSMsg             = allRequestData;

                        broadcast broadCtrl1 = null;

                        for (int i = 0; i < this.datamanager.BroadList.Count; i++)
                        {
                            broadCtrl1             = new broadcast();
                            broadCtrl1.BoolAborted = false;
                            broadCtrl1.BoolProcess = true;
                            broadCtrl1.WMessageID  = 1;
                            broadCtrl1.StageID     = (uint)this.datamanager.BroadList[i].ID;
                            wMsgCtrl1.BCenterList.Add(broadCtrl1);
                        }

                        mapMessageRegion mmrCtrl1 = null;
                        mmrCtrl1            = new mapMessageRegion();
                        mmrCtrl1.DestFlag   = 1;
                        mmrCtrl1.ParentName = protoG.CdmaNumber;
                        mmrCtrl1.WMessageID = 1;
                        wMsgCtrl1.MapTarget.Add(mmrCtrl1);

                        subProtoA1.DisasterCode = "STT";
                        subProtoA1.SectionCode  = DmbDefineSectionCode.Terminal;
                        subProtoA1.LstStage.Add(DmbDefineStage.Kbs);
                        subProtoA1.LstStage.Add(DmbDefineStage.Mbc);
                        subProtoA1.LstStage.Add(DmbDefineStage.Sbs);
                        subProtoA1.LstStage.Add(DmbDefineStage.Ytn);
                        wMsgCtrl1.ProtoA = subProtoA1;

                        this.mainviewform.datamanager_onWMessageUpdate(wMsgCtrl1);
                        break;
                    }
                }

                this.logMng.File_Mng(string.Format("시도(특수수신기) 서비스 => 데이터 수신시각 : {0}\n데이터 : {1}",
                                                   DateTime.Now.ToString(), DMBBIZ.DmbUtility.DmbUtilityMng.IDmbEtcUtility.Bytes2HexString(e.Buff)));
            }
            catch (Exception ex)
            {
                DmbLoggingMng.ILoggingException.WriteException("MainForm", "forSpSoc_RecvNetSessionClient - ", ex);
            }
        }