Example #1
0
        static public DIS1998net.Pdu GetPDU(DISnet.Utilities.PDUTypes.PDUType1998 pdu_type)
        {
            DIS1998net.Pdu pdu = null;

            switch (pdu_type)
            {
            case PDUTypes.PDUType1998.PDU_ENTITY_STATE: pdu = new EntityStatePdu(); break;

            case PDUTypes.PDUType1998.PDU_FIRE: pdu = new FirePdu(); break;

            case PDUTypes.PDUType1998.PDU_DETONATION: pdu = new DetonationPdu(); break;

            case PDUTypes.PDUType1998.PDU_COLLISION: pdu = new CollisionPdu(); break;

            case PDUTypes.PDUType1998.PDU_SERVICE_REQUEST: pdu = new ServiceRequestPdu(); break;

            case PDUTypes.PDUType1998.PDU_RESUPPLY_OFFER: pdu = new ResupplyOfferPdu(); break;

            case PDUTypes.PDUType1998.PDU_RESUPPLY_RECEIVED: pdu = new ResupplyReceivedPdu(); break;

            case PDUTypes.PDUType1998.PDU_RESUPPLY_CANCEL: pdu = new ResupplyCancelPdu(); break;

            case PDUTypes.PDUType1998.PDU_REPAIR_COMPLETE: pdu = new RepairCompletePdu(); break;

            case PDUTypes.PDUType1998.PDU_REPAIR_RESPONSE: pdu = new RepairResponsePdu(); break;

            case PDUTypes.PDUType1998.PDU_CREATE_ENTITY: pdu = new CreateEntityPdu(); break;

            case PDUTypes.PDUType1998.PDU_REMOVE_ENTITY: pdu = new RemoveEntityPdu(); break;

            case PDUTypes.PDUType1998.PDU_START_RESUME: pdu = new StartResumePdu(); break;

            case PDUTypes.PDUType1998.PDU_ACKNOWLEDGE: pdu = new AcknowledgePdu(); break;

            case PDUTypes.PDUType1998.PDU_ACTION_REQUEST: pdu = new ActionRequestPdu(); break;

            case PDUTypes.PDUType1998.PDU_ACTION_RESPONSE: pdu = new ActionResponsePdu(); break;

            case PDUTypes.PDUType1998.PDU_DATA_QUERY: pdu = new DataQueryPdu(); break;

            case PDUTypes.PDUType1998.PDU_SET_DATA: pdu = new SetDataPdu(); break;

            case PDUTypes.PDUType1998.PDU_EVENT_REPORT: pdu = new EventReportPdu(); break;

            case PDUTypes.PDUType1998.PDU_COMMENT: pdu = new CommentPdu(); break;

            case PDUTypes.PDUType1998.PDU_STOP_FREEZE: pdu = new StopFreezePdu(); break;

            case PDUTypes.PDUType1998.PDU_SIGNAL: pdu = new SignalPdu(); break;

            case PDUTypes.PDUType1998.PDU_TRANSMITTER: pdu = new TransmitterPdu(); break;
            }

            return(pdu);
        }
Example #2
0
        /// <summary>
        /// Used to unmarshal data back into the correct PDU type.
        /// </summary>
        /// <param name="pduType">PDU type</param>
        /// <param name="ds">Datastream which contains the raw packet and Endian Type</param>
        /// <remarks>Added by PES to work with Mobile.</remarks>
        /// <returns>The PDU instance.</returns>
        public static Pdu UnmarshalRawPdu(PduType pduType, DataInputStream ds)
        {
            var pdu = new Pdu();

            switch (pduType)
            {
            case PduType.EntityState:
                pdu = new EntityStatePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.Fire:
                pdu = new FirePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.Detonation:
                pdu = new DetonationPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.Collision:
                pdu = new CollisionPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.ServiceRequest:
                pdu = new ServiceRequestPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.ResupplyOffer:
                pdu = new ResupplyOfferPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.ResupplyReceived:
                pdu = new ResupplyReceivedPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.ResupplyCancel:
                pdu = new ResupplyCancelPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.RepairComplete:
                pdu = new RepairCompletePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.RepairResponse:
                pdu = new RepairResponsePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.CreateEntity:
                pdu = new CreateEntityPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.RemoveEntity:
                pdu = new RemoveEntityPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.StartResume:
                pdu = new StartResumePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.Acknowledge:
                pdu = new AcknowledgePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.ActionRequest:
                pdu = new ActionRequestPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.ActionResponse:
                pdu = new ActionResponsePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.DataQuery:
                pdu = new DataQueryPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.SetData:
                pdu = new SetDataPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.EventReport:
                pdu = new EventReportPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.Comment:
                pdu = new CommentPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.StopFreeze:
                pdu = new StopFreezePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.Signal:
                pdu = new SignalPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.Transmitter:
                pdu = new TransmitterPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.ElectromagneticEmission:
                pdu = new ElectronicEmissionsPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.Designator:
                pdu = new DesignatorPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.Receiver:
                pdu = new ReceiverPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.IFF_ATC_NAVAIDS:
                pdu = new IffAtcNavAidsLayer1Pdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.UnderwaterAcoustic:
                pdu = new UaPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.SupplementalEmissionEntityState:
                pdu = new SeesPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.IntercomSignal:
                pdu = new IntercomSignalPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.IntercomControl:
                pdu = new IntercomControlPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.AggregateState:
                pdu = new AggregateStatePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.IsGroupOf:
                pdu = new IsGroupOfPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.TransferControl:
                pdu = new TransferControlRequestPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.IsPartOf:
                pdu = new IsPartOfPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.MinefieldState:
                pdu = new MinefieldStatePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.MinefieldQuery:
                pdu = new MinefieldQueryPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.MinefieldData:
                pdu = new MinefieldDataPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.MinefieldResponseNAK:
                pdu = new MinefieldResponseNackPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.EnvironmentalProcess:
                pdu = new EnvironmentalProcessPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.GriddedData:
                pdu = new GriddedDataPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.PointObjectState:
                pdu = new PointObjectStatePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.LinearObjectState:
                pdu = new LinearObjectStatePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.ArealObjectState:
                pdu = new ArealObjectStatePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.TSPI:
                throw new NotSupportedException();

            case PduType.Appearance:
                throw new NotSupportedException();

            case PduType.ArticulatedParts:
                throw new NotSupportedException();

            case PduType.LEFire:
                throw new NotSupportedException();

            case PduType.LEDetonation:
                throw new NotSupportedException();

            case PduType.CreateEntityR:
                pdu = new CreateEntityReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.RemoveEntityR:
                pdu = new RemoveEntityReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.StartResumeR:
                pdu = new StartResumeReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.StopFreezeR:
                pdu = new StopFreezeReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.AcknowledgeR:
                pdu = new AcknowledgeReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.ActionRequestR:
                pdu = new ActionRequestReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.ActionResponseR:
                pdu = new ActionResponseReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.DataQueryR:
                pdu = new DataQueryReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.SetDataR:
                pdu = new SetDataReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.DataR:
                pdu = new DataReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.EventReportR:
                pdu = new EventReportReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.CommentR:
                pdu = new CommentReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.RecordR:
                pdu = new RecordQueryReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.SetRecordR:
                pdu = new SetRecordReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.RecordQueryR:
                pdu = new RecordQueryReliablePdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.CollisionElastic:
                pdu = new CollisionElasticPdu();
                pdu.Unmarshal(ds);
                break;

            case PduType.EntityStateUpdate:
                pdu = new EntityStateUpdatePdu();
                pdu.Unmarshal(ds);
                break;
            }

            return(pdu);
        }
        /// <summary>
        /// Used to unmarshal data back into the correct PDU type.
        /// </summary>
        /// <param name="pduType">PDU type</param>
        /// <param name="ds">Datastream which contains the raw packet and Endian Type</param>
        /// <remarks>Added by PES to work with Mobile.</remarks>
        /// <returns>The PDU instance.</returns>
        public static Pdu UnmarshalRawPdu(PduType pduType, DataInputStream ds)
        {
            Pdu pdu = new Pdu();

            switch (pduType)
            {
            case PduType.EntityState:
                EntityStatePdu entityStatePdu = new EntityStatePdu();
                entityStatePdu.Unmarshal(ds);
                pdu = (Pdu)entityStatePdu;
                break;

            case PduType.Fire:
                FirePdu firePdu = new FirePdu();
                firePdu.Unmarshal(ds);
                pdu = (Pdu)firePdu;
                break;

            case PduType.Detonation:
                DetonationPdu detonationPdu = new DetonationPdu();
                detonationPdu.Unmarshal(ds);
                pdu = (Pdu)detonationPdu;
                break;

            case PduType.Collision:
                CollisionPdu collisionPdu = new CollisionPdu();
                collisionPdu.Unmarshal(ds);
                pdu = (Pdu)collisionPdu;
                break;

            case PduType.ServiceRequest:
                ServiceRequestPdu serviceRequestPdu = new ServiceRequestPdu();
                serviceRequestPdu.Unmarshal(ds);
                pdu = (Pdu)serviceRequestPdu;
                break;

            case PduType.ResupplyOffer:
                ResupplyOfferPdu resupplyOfferPdu = new ResupplyOfferPdu();
                resupplyOfferPdu.Unmarshal(ds);
                pdu = (Pdu)resupplyOfferPdu;
                break;

            case PduType.ResupplyReceived:
                ResupplyReceivedPdu resupplyReceivedPdu = new ResupplyReceivedPdu();
                resupplyReceivedPdu.Unmarshal(ds);
                pdu = (Pdu)resupplyReceivedPdu;
                break;

            case PduType.ResupplyCancel:
                ResupplyCancelPdu resupplyCancelPdu = new ResupplyCancelPdu();
                resupplyCancelPdu.Unmarshal(ds);
                pdu = (Pdu)resupplyCancelPdu;
                break;

            case PduType.RepairComplete:
                RepairCompletePdu repairCompletePdu = new RepairCompletePdu();
                repairCompletePdu.Unmarshal(ds);
                pdu = (Pdu)repairCompletePdu;
                break;

            case PduType.RepairResponse:
                RepairResponsePdu repairResponsePdu = new RepairResponsePdu();
                repairResponsePdu.Unmarshal(ds);
                pdu = (Pdu)repairResponsePdu;
                break;

            case PduType.CreateEntity:
                CreateEntityPdu createEntityPdu = new CreateEntityPdu();
                createEntityPdu.Unmarshal(ds);
                pdu = (Pdu)createEntityPdu;
                break;

            case PduType.RemoveEntity:
                RemoveEntityPdu removeEntityPdu = new RemoveEntityPdu();
                removeEntityPdu.Unmarshal(ds);
                pdu = (Pdu)removeEntityPdu;
                break;

            case PduType.StartResume:
                StartResumePdu startResumePdu = new StartResumePdu();
                startResumePdu.Unmarshal(ds);
                pdu = (Pdu)startResumePdu;
                break;

            case PduType.Acknowledge:
                AcknowledgePdu acknowledgePdu = new AcknowledgePdu();
                acknowledgePdu.Unmarshal(ds);
                pdu = (Pdu)acknowledgePdu;
                break;

            case PduType.ActionRequest:
                ActionRequestPdu actionRequestPdu = new ActionRequestPdu();
                actionRequestPdu.Unmarshal(ds);
                pdu = (Pdu)actionRequestPdu;
                break;

            case PduType.ActionResponse:
                ActionResponsePdu actionResponsePdu = new ActionResponsePdu();
                actionResponsePdu.Unmarshal(ds);
                pdu = (Pdu)actionResponsePdu;
                break;

            case PduType.DataQuery:
                DataQueryPdu dataQueryPdu = new DataQueryPdu();
                dataQueryPdu.Unmarshal(ds);
                pdu = (Pdu)dataQueryPdu;
                break;

            case PduType.SetData:
                SetDataPdu setDataPdu = new SetDataPdu();
                setDataPdu.Unmarshal(ds);
                pdu = (Pdu)setDataPdu;
                break;

            case PduType.EventReport:
                EventReportPdu eventReportPdu = new EventReportPdu();
                eventReportPdu.Unmarshal(ds);
                pdu = (Pdu)eventReportPdu;
                break;

            case PduType.Comment:
                CommentPdu commentPdu = new CommentPdu();
                commentPdu.Unmarshal(ds);
                pdu = (Pdu)commentPdu;
                break;

            case PduType.StopFreeze:
                StopFreezePdu stopFreezePdu = new StopFreezePdu();
                stopFreezePdu.Unmarshal(ds);
                pdu = (Pdu)stopFreezePdu;
                break;

            case PduType.Signal:
                SignalPdu signalPdu = new SignalPdu();
                signalPdu.Unmarshal(ds);
                pdu = (Pdu)signalPdu;
                break;

            case PduType.Transmitter:
                TransmitterPdu transmitterPdu = new TransmitterPdu();
                transmitterPdu.Unmarshal(ds);
                pdu = (Pdu)transmitterPdu;
                break;
            }

            return(pdu);
        }
Example #4
0
        /// <summary>
        /// Used to unmarshal data back into the correct PDU type.
        /// </summary>
        /// <param name="pduType">PDU type</param>
        /// <param name="ds">Datastream which contains the raw packet and Endian Type</param>
        /// <remarks>Added by PES to work with Mobile.</remarks>
        /// <returns>The PDU instance.</returns>
        public static Pdu UnmarshalRawPdu(PduType pduType, DataInputStream ds)
        {
            Pdu pdu = new Pdu();

            switch (pduType)
            {
                case PduType.EntityState:
                    EntityStatePdu entityStatePdu = new EntityStatePdu();
                    entityStatePdu.Unmarshal(ds);
                    pdu = (Pdu)entityStatePdu;
                    break;
                case PduType.Fire:
                    FirePdu firePdu = new FirePdu();
                    firePdu.Unmarshal(ds);
                    pdu = (Pdu)firePdu;
                    break;
                case PduType.Detonation:
                    DetonationPdu detonationPdu = new DetonationPdu();
                    detonationPdu.Unmarshal(ds);
                    pdu = (Pdu)detonationPdu;
                    break;
                case PduType.Collision:
                    CollisionPdu collisionPdu = new CollisionPdu();
                    collisionPdu.Unmarshal(ds);
                    pdu = (Pdu)collisionPdu;
                    break;
                case PduType.ServiceRequest:
                    ServiceRequestPdu serviceRequestPdu = new ServiceRequestPdu();
                    serviceRequestPdu.Unmarshal(ds);
                    pdu = (Pdu)serviceRequestPdu;
                    break;
                case PduType.ResupplyOffer:
                    ResupplyOfferPdu resupplyOfferPdu = new ResupplyOfferPdu();
                    resupplyOfferPdu.Unmarshal(ds);
                    pdu = (Pdu)resupplyOfferPdu;
                    break;
                case PduType.ResupplyReceived:
                    ResupplyReceivedPdu resupplyReceivedPdu = new ResupplyReceivedPdu();
                    resupplyReceivedPdu.Unmarshal(ds);
                    pdu = (Pdu)resupplyReceivedPdu;
                    break;
                case PduType.ResupplyCancel:
                    ResupplyCancelPdu resupplyCancelPdu = new ResupplyCancelPdu();
                    resupplyCancelPdu.Unmarshal(ds);
                    pdu = (Pdu)resupplyCancelPdu;
                    break;
                case PduType.RepairComplete:
                    RepairCompletePdu repairCompletePdu = new RepairCompletePdu();
                    repairCompletePdu.Unmarshal(ds);
                    pdu = (Pdu)repairCompletePdu;
                    break;
                case PduType.RepairResponse:
                    RepairResponsePdu repairResponsePdu = new RepairResponsePdu();
                    repairResponsePdu.Unmarshal(ds);
                    pdu = (Pdu)repairResponsePdu;
                    break;
                case PduType.CreateEntity:
                    CreateEntityPdu createEntityPdu = new CreateEntityPdu();
                    createEntityPdu.Unmarshal(ds);
                    pdu = (Pdu)createEntityPdu;
                    break;
                case PduType.RemoveEntity:
                    RemoveEntityPdu removeEntityPdu = new RemoveEntityPdu();
                    removeEntityPdu.Unmarshal(ds);
                    pdu = (Pdu)removeEntityPdu;
                    break;
                case PduType.StartResume:
                    StartResumePdu startResumePdu = new StartResumePdu();
                    startResumePdu.Unmarshal(ds);
                    pdu = (Pdu)startResumePdu;
                    break;
                case PduType.Acknowledge:
                    AcknowledgePdu acknowledgePdu = new AcknowledgePdu();
                    acknowledgePdu.Unmarshal(ds);
                    pdu = (Pdu)acknowledgePdu;
                    break;
                case PduType.ActionRequest:
                    ActionRequestPdu actionRequestPdu = new ActionRequestPdu();
                    actionRequestPdu.Unmarshal(ds);
                    pdu = (Pdu)actionRequestPdu;
                    break;
                case PduType.ActionResponse:
                    ActionResponsePdu actionResponsePdu = new ActionResponsePdu();
                    actionResponsePdu.Unmarshal(ds);
                    pdu = (Pdu)actionResponsePdu;
                    break;
                case PduType.DataQuery:
                    DataQueryPdu dataQueryPdu = new DataQueryPdu();
                    dataQueryPdu.Unmarshal(ds);
                    pdu = (Pdu)dataQueryPdu;
                    break;
                case PduType.SetData:
                    SetDataPdu setDataPdu = new SetDataPdu();
                    setDataPdu.Unmarshal(ds);
                    pdu = (Pdu)setDataPdu;
                    break;
                case PduType.EventReport:
                    EventReportPdu eventReportPdu = new EventReportPdu();
                    eventReportPdu.Unmarshal(ds);
                    pdu = (Pdu)eventReportPdu;
                    break;
                case PduType.Comment:
                    CommentPdu commentPdu = new CommentPdu();
                    commentPdu.Unmarshal(ds);
                    pdu = (Pdu)commentPdu;
                    break;
                case PduType.StopFreeze:
                    StopFreezePdu stopFreezePdu = new StopFreezePdu();
                    stopFreezePdu.Unmarshal(ds);
                    pdu = (Pdu)stopFreezePdu;
                    break;
                case PduType.Signal:
                    SignalPdu signalPdu = new SignalPdu();
                    signalPdu.Unmarshal(ds);
                    pdu = (Pdu)signalPdu;
                    break;
                case PduType.Transmitter:
                    TransmitterPdu transmitterPdu = new TransmitterPdu();
                    transmitterPdu.Unmarshal(ds);
                    pdu = (Pdu)transmitterPdu;
                    break;
            }

            return pdu;
        }
Example #5
0
        /// <summary>
        /// Creates the PDU.
        /// </summary>
        /// <param name="type">The type of PDU to be created.</param>
        /// <returns>Returns the corresponding PDU instance or null if PduType.Other is specified.</returns>
        /// <exception cref="NotImplementedException">if the PDU type specified in parameter is not supported.</exception>
        public static IPdu CreatePdu(PduType type)
        {
            IPdu pdu = null;

            switch (type)
            {
                case PduType.Other:
                    pdu = new Pdu();
                    break;
                case PduType.EntityState:
                    pdu = new EntityStatePdu();
                    break;
                case PduType.Fire:
                    pdu = new FirePdu();
                    break;
                case PduType.Detonation:
                    pdu = new DetonationPdu();
                    break;
                case PduType.Collision:
                    pdu = new CollisionPdu();
                    break;
                case PduType.ServiceRequest:
                    pdu = new ServiceRequestPdu();
                    break;
                case PduType.ResupplyOffer:
                    pdu = new ResupplyOfferPdu();
                    break;
                case PduType.ResupplyReceived:
                    pdu = new ResupplyReceivedPdu();
                    break;
                case PduType.ResupplyCancel:
                    pdu = new ResupplyCancelPdu();
                    break;
                case PduType.RepairComplete:
                    pdu = new RepairCompletePdu();
                    break;
                case PduType.RepairResponse:
                    pdu = new RepairResponsePdu();
                    break;
                case PduType.CreateEntity:
                    pdu = new CreateEntityPdu();
                    break;
                case PduType.RemoveEntity:
                    pdu = new RemoveEntityPdu();
                    break;
                case PduType.StartResume:
                    pdu = new StartResumePdu();
                    break;
                case PduType.StopFreeze:
                    pdu = new StopFreezePdu();
                    break;
                case PduType.Acknowledge:
                    pdu = new AcknowledgePdu();
                    break;
                case PduType.ActionRequest:
                    pdu = new ActionRequestPdu();
                    break;
                case PduType.ActionResponse:
                    pdu = new ActionResponsePdu();
                    break;
                case PduType.DataQuery:
                    pdu = new DataQueryPdu();
                    break;
                case PduType.SetData:
                    pdu = new SetDataPdu();
                    break;
                case PduType.Data:
                    pdu = new DataPdu();
                    break;
                case PduType.EventReport:
                    pdu = new EventReportPdu();
                    break;
                case PduType.Comment:
                    pdu = new CommentPdu();
                    break;
                case PduType.ElectromagneticEmission:
                    throw new NotImplementedException();
                case PduType.Designator:
                    pdu = new DesignatorPdu();
                    break;
                case PduType.Transmitter:
                    pdu = new TransmitterPdu();
                    break;
                case PduType.Signal:
                    pdu = new SignalPdu();
                    break;
                case PduType.Receiver:
                    pdu = new ReceiverPdu();
                    break;
                default:
                    throw new NotImplementedException();
            }

            return pdu;
        }
Example #6
0
        /// <summary>
        /// Creates the PDU.
        /// </summary>
        /// <param name="type">The type of PDU to be created.</param>
        /// <returns>Returns the corresponding PDU instance or null if PduType.Other is specified.</returns>
        /// <exception cref="NotImplementedException">if the PDU type specified in parameter is not supported.</exception>
        public static IPdu CreatePdu(PduType type)
        {
            IPdu pdu = null;

            switch (type)
            {
                case PduType.Other:
                    pdu = new Pdu();
                    break;
                case PduType.EntityState:
                    pdu = new EntityStatePdu();
                    break;
                case PduType.Fire:
                    pdu = new FirePdu();
                    break;
                case PduType.Detonation:
                    pdu = new DetonationPdu();
                    break;
                case PduType.Collision:
                    pdu = new CollisionPdu();
                    break;
                case PduType.ServiceRequest:
                    pdu = new ServiceRequestPdu();
                    break;
                case PduType.ResupplyOffer:
                    pdu = new ResupplyOfferPdu();
                    break;
                case PduType.ResupplyReceived:
                    pdu = new ResupplyReceivedPdu();
                    break;
                case PduType.ResupplyCancel:
                    pdu = new ResupplyCancelPdu();
                    break;
                case PduType.RepairComplete:
                    pdu = new RepairCompletePdu();
                    break;
                case PduType.RepairResponse:
                    pdu = new RepairResponsePdu();
                    break;
                case PduType.CreateEntity:
                    pdu = new CreateEntityPdu();
                    break;
                case PduType.RemoveEntity:
                    pdu = new RemoveEntityPdu();
                    break;
                case PduType.StartResume:
                    pdu = new StartResumePdu();
                    break;
                case PduType.StopFreeze:
                    pdu = new StopFreezePdu();
                    break;
                case PduType.Acknowledge:
                    pdu = new AcknowledgePdu();
                    break;
                case PduType.ActionRequest:
                    pdu = new ActionRequestPdu();
                    break;
                case PduType.ActionResponse:
                    pdu = new ActionResponsePdu();
                    break;
                case PduType.DataQuery:
                    pdu = new DataQueryPdu();
                    break;
                case PduType.SetData:
                    pdu = new SetDataPdu();
                    break;
                case PduType.Data:
                    pdu = new DataPdu();
                    break;
                case PduType.EventReport:
                    pdu = new EventReportPdu();
                    break;
                case PduType.Comment:
                    pdu = new CommentPdu();
                    break;
                case PduType.ElectromagneticEmission:
                    pdu = new ElectronicEmissionsPdu();
                    break;
                case PduType.Designator:
                    pdu = new DesignatorPdu();
                    break;
                case PduType.Transmitter:
                    pdu = new TransmitterPdu();
                    break;
                case PduType.Signal:
                    pdu = new SignalPdu();
                    break;
                case PduType.Receiver:
                    pdu = new ReceiverPdu();
                    break;
                case PduType.IFF_ATC_NAVAIDS:
                    pdu = new IffAtcNavAidsLayer1Pdu();
                    break;
                case PduType.UnderwaterAcoustic:
                    pdu = new UaPdu();
                    break;
                case PduType.SupplementalEmissionEntityState:
                    pdu = new SeesPdu();
                    break;
                case PduType.IntercomSignal:
                    pdu = new IntercomSignalPdu();
                    break;
                case PduType.IntercomControl:
                    pdu = new IntercomControlPdu();
                    break;
                case PduType.AggregateState:
                    pdu = new AggregateStatePdu();
                    break;
                case PduType.IsGroupOf:
                    pdu = new IsGroupOfPdu();
                    break;
                case PduType.TransferControl:
                    pdu = new TransferControlRequestPdu();
                    break;
                case PduType.IsPartOf:
                    pdu = new IsPartOfPdu();
                    break;
                case PduType.MinefieldState:
                    pdu = new MinefieldStatePdu();
                    break;
                case PduType.MinefieldQuery:
                    pdu = new MinefieldQueryPdu();
                    break;
                case PduType.MinefieldData:
                    pdu = new MinefieldDataPdu();
                    break;
                case PduType.MinefieldResponseNAK:
                    pdu = new MinefieldResponseNackPdu();
                    break;
                case PduType.EnvironmentalProcess:
                    pdu = new EnvironmentalProcessPdu();
                    break;
                case PduType.GriddedData:
                    pdu = new GriddedDataPdu();
                    break;
                case PduType.PointObjectState:
                    pdu = new PointObjectStatePdu();
                    break;
                case PduType.LinearObjectState:
                    pdu = new LinearObjectStatePdu();
                    break;
                case PduType.ArealObjectState:
                    pdu = new ArealObjectStatePdu();
                    break;
                case PduType.TSPI:
                    throw new NotImplementedException();
                case PduType.Appearance:
                    throw new NotImplementedException();
                case PduType.ArticulatedParts:
                    throw new NotImplementedException();
                case PduType.LEFire:
                    throw new NotImplementedException();
                case PduType.LEDetonation:
                    throw new NotImplementedException();
                case PduType.CreateEntityR:
                    pdu = new CreateEntityReliablePdu();
                    break;
                case PduType.RemoveEntityR:
                    pdu = new RemoveEntityReliablePdu();
                    break;
                case PduType.StartResumeR:
                    pdu = new StartResumeReliablePdu();
                    break;
                case PduType.StopFreezeR:
                    pdu = new StopFreezeReliablePdu();
                    break;
                case PduType.AcknowledgeR:
                    pdu = new AcknowledgeReliablePdu();
                    break;
                case PduType.ActionRequestR:
                    pdu = new ActionRequestReliablePdu();
                    break;
                case PduType.ActionResponseR:
                    pdu = new ActionResponseReliablePdu();
                    break;
                case PduType.DataQueryR:
                    pdu = new DataQueryReliablePdu();
                    break;
                case PduType.SetDataR:
                    pdu = new SetDataReliablePdu();
                    break;
                case PduType.DataR:
                    pdu = new DataReliablePdu();
                    break;
                case PduType.EventReportR:
                    pdu = new EventReportReliablePdu();
                    break;
                case PduType.CommentR:
                    pdu = new CommentReliablePdu();
                    break;
                case PduType.RecordR:
                    pdu = new RecordQueryReliablePdu();
                    break;
                case PduType.SetRecordR:
                    pdu = new SetRecordReliablePdu();
                    break;
                case PduType.RecordQueryR:
                    pdu = new RecordQueryReliablePdu();
                    break;
                case PduType.CollisionElastic:
                    pdu = new CollisionElasticPdu();
                    break;
                case PduType.EntityStateUpdate:
                    pdu = new EntityStateUpdatePdu();
                    break;
                default:
                    pdu = null;
                    break;
            }

            return pdu;
        }