Example #1
0
        private void JudgeDevice(PacketHeader head)
        {
            if (head.SenderID == DeviceID.ATP1 || head.SenderID == DeviceID.ATP2 || head.SenderID == DeviceID.ATP3 || head.SenderID == DeviceID.ATP4)
            {
                HandleVobc VOBC = new HandleVobc(UnPack);
                ConsoleOut(VOBC.trainInfo, null, false);
                if (VOBC.trainInfo.NcTrain == NCTrain.QuitCBTCLogOutZC)
                {
                    ATPPackage InfoSendToATP = new ATPPackage();
                    InfoSendToATP.NC_ZC = 0x03;
                    VOBCQuit Quit = new VOBCQuit(VOBC.trainInfo);
                    UpdateTrainPosition.PreTrainPosition.Remove(VOBC.trainInfo.NIDTrain);
                    UpdateRoute.PreAccess.Remove(VOBC.trainInfo.NIDTrain);
                    InfoSendToATP.PackATP();
                    Send(InfoSendToATP.ATPPack.buf_, IPConfigure.IPList[0].IP, IPConfigure.IPList[0].Port, InfoSendToATP.ATPPack.byteFlag_);

                    InfoToATS infoToATS = new InfoToATS();
                    new ATS.PackToATS(infoToATS, VOBC.trainInfo);
                    Send(MySerialize.serializeObject(infoToATS), GetIPByDataType((int)DeviceID.ATS), GetPortByDataType((int)DeviceID.ATS), MySerialize.serializeObject(infoToATS).Length);
                }
                else if (VOBC.trainInfo.NcTrain == NCTrain.AskMA)
                {
                    new UpdateTrainPosition(VOBC.trainInfo);
                    InfoSendToATP infoSendToATP = new InfoSendToATP(VOBC.trainInfo, head.SenderID);
                    new UpdateRoute(VOBC.trainInfo, infoSendToATP.MA);
                    infoSendToATP.atpPackage.PackATP();
                    Send(infoSendToATP.atpPackage.ATPPack.buf_, GetIPByDataType((int)head.SenderID), GetPortByDataType((int)head.SenderID), infoSendToATP.atpPackage.ATPPack.byteFlag_);

                    InfoToATS infoToATS = new InfoToATS();
                    new ATS.PackToATS(infoToATS, VOBC.trainInfo);
                    Send(MySerialize.serializeObject(infoToATS), GetIPByDataType((int)DeviceID.ATS), GetPortByDataType((int)DeviceID.ATS), MySerialize.serializeObject(infoToATS).Length);
                    ConsoleOut(VOBC.trainInfo, infoSendToATP, true);
                }
            }
            else if (head.SenderID == DeviceID.CI1 || head.SenderID == DeviceID.CI2 || head.SenderID == DeviceID.CI3 || head.SenderID == DeviceID.CI4)
            {
                CI.HandleCIData        CI       = new CI.HandleCIData(UnPack, head.SenderID);
                shenyangZC.CI.PackToCI packToCI = new shenyangZC.CI.PackToCI(head.SenderID, CI);
                Send(packToCI.CIPacket.buf_, GetIPByDataType((int)head.SenderID), GetPortByDataType((int)head.SenderID), packToCI.CIPacket.byteFlag_);
            }
        }
Example #2
0
        public PackToCI(DeviceID SenderID, HandleCIData CI)
        {
            this.CI = CI;

            WriteCIHead(SenderID);
            SetLogicState(CI.InSections, CI.InRailSwitchs);
            CIPacket.Skip();

            SetLogicStopInfo(CI.InSections, CI.InRailSwitchs);
            CIPacket.Skip();

            SetSectionARB(CI.InSections, CI.InRailSwitchs);
            CIPacket.Skip();

            SetTrainAccessInfo();
            CIPacket.Skip();

            SetPSDReq();
            CIPacket.Skip();

            SetDataLength();
        }