예제 #1
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._variableDatumID = dis.ReadUnsignedInt();
                    this._variableDatumLength = dis.ReadUnsignedInt();
            int variableCount = (int)(this._variableDatumLength / 64) + (this._variableDatumLength % 64 > 0 ? 1 : 0);  //Post processed

                    for (int idx = 0; idx < variableCount; idx++)
                    {
                        EightByteChunk anX = new EightByteChunk();
                        anX.Unmarshal(dis);
                        this._variableDatums.Add(anX);
                    }
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #2
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._entityKind = dis.ReadUnsignedByte();
                    this._domain = dis.ReadUnsignedByte();
                    this._country = dis.ReadUnsignedShort();
                    this._category = dis.ReadUnsignedByte();
                    this._subcategory = dis.ReadUnsignedByte();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #3
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._acousticName = dis.ReadUnsignedShort();
                    this._function = dis.ReadUnsignedByte();
                    this._acousticIdNumber = dis.ReadUnsignedByte();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #4
0
 /// <summary>
 /// Used to unmarshal data back into the correct PDU type.
 /// </summary>
 /// <param name="pduType">PDU type</param>
 /// <param name="rawPDU">byte array containing the raw packets</param>
 /// <param name="endian">Endian type</param>
 /// <remarks>Added by PES to work with Mobile.</remarks>
 /// <returns>The PDU instance.</returns>
 public static Pdu UnmarshalRawPdu(PduType pduType, byte[] rawPdu, Endian endian)
 {
     DataInputStream ds = new DataInputStream(rawPdu, endian);
     return UnmarshalRawPdu(pduType, ds);
 }
예제 #5
0
 private static void ReturnUnmarshalledPdu(object pdu, DataInputStream dStream)
 {
     // Unmarshal is the method name found in each of the PDU classes
     pdu.GetType().InvokeMember("Unmarshal", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { dStream }, CultureInfo.InvariantCulture);
 }
예제 #6
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._layerNumber = dis.ReadUnsignedByte();
                    this._layerSpecificInformaiton = dis.ReadUnsignedByte();
                    this._length = dis.ReadUnsignedShort();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #7
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(byte pduType, DataInputStream ds)
 {
     return UnmarshalRawPdu((PduType)pduType, ds);
 }
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._recordType = dis.ReadUnsignedShort();
                    this._recordLength = dis.ReadUnsignedShort();
                    this._recordSpecificField = dis.ReadUnsignedInt();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #9
0
파일: Pdu.cs 프로젝트: mcgredonps/Unity_DIS
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._protocolVersion = dis.ReadUnsignedByte();
                    this._exerciseID = dis.ReadUnsignedByte();
                    this._pduType = dis.ReadUnsignedByte();
                    this._protocolFamily = dis.ReadUnsignedByte();
                    this._timestamp = dis.ReadUnsignedInt();
                    this._length = dis.ReadUnsignedShort();
                    this._padding = dis.ReadShort();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #10
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._environmentType = dis.ReadUnsignedInt();
                    this._length = dis.ReadUnsignedByte();
                    this._index = dis.ReadUnsignedByte();
                    this._padding1 = dis.ReadUnsignedByte();
                    this._geometry = dis.ReadUnsignedByte();
                    this._padding2 = dis.ReadUnsignedByte();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._systemDataLength = dis.ReadUnsignedByte();
                    this._numberOfBeams = dis.ReadUnsignedByte();
                    this._emissionsPadding2 = dis.ReadUnsignedShort();
                    this._emitterSystem.Unmarshal(dis);
                    this._location.Unmarshal(dis);

                    for (int idx = 0; idx < this.NumberOfBeams; idx++)
                    {
                        ElectronicEmissionBeamData anX = new ElectronicEmissionBeamData();
                        anX.Unmarshal(dis);
                        this._beamDataRecords.Add(anX);
                    }
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._beamDataLength = dis.ReadUnsignedByte();
                    this._beamIDNumber = dis.ReadUnsignedByte();
                    this._beamParameterIndex = dis.ReadUnsignedShort();
                    this._fundamentalParameterData.Unmarshal(dis);
                    this._beamFunction = dis.ReadUnsignedByte();
                    this._numberOfTrackJamTargets = dis.ReadUnsignedByte();
                    this._highDensityTrackJam = dis.ReadUnsignedByte();
                    this._pad4 = dis.ReadUnsignedByte();
                    this._jammingModeSequence = dis.ReadUnsignedInt();

                    for (int idx = 0; idx < this.NumberOfTrackJamTargets; idx++)
                    {
                        TrackJamTarget anX = new TrackJamTarget();
                        anX.Unmarshal(dis);
                        this._trackJamTargets.Add(anX);
                    }
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #13
0
 private static void ReturnUnmarshalledPdu(object pdu, DataInputStream dStream)
 {
     // Unmarshal is the method name found in each of the PDU classes
     pdu.GetType().InvokeMember("Unmarshal", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { dStream }, CultureInfo.InvariantCulture);
 }
예제 #14
0
        /// <summary>
        /// Used to unmarshal data back into the correct PDU type.
        /// </summary>
        /// <param name="pduType">PDU type</param>
        /// <param name="rawPDU">byte array containing the raw packets</param>
        /// <param name="endian">Endian type</param>
        /// <remarks>Added by PES to work with Mobile.</remarks>
        /// <returns>The PDU instance.</returns>
        public static Pdu UnmarshalRawPdu(PduType pduType, byte[] rawPdu, Endian endian)
        {
            DataInputStream ds = new DataInputStream(rawPdu, endian);

            return(UnmarshalRawPdu(pduType, ds));
        }
예제 #15
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._beamAzimuthCenter = dis.ReadFloat();
                    this._beamAzimuthSweep = dis.ReadFloat();
                    this._beamElevationCenter = dis.ReadFloat();
                    this._beamElevationSweep = dis.ReadFloat();
                    this._beamSweepSync = dis.ReadFloat();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #16
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._spreadSpectrum = dis.ReadUnsignedShort();
                    this._major = dis.ReadUnsignedShort();
                    this._detail = dis.ReadUnsignedShort();
                    this._system = dis.ReadUnsignedShort();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #17
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);
        }
예제 #18
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._beamDataLength = dis.ReadUnsignedShort();
                    this._beamIDNumber = dis.ReadUnsignedByte();
                    this._pad2 = dis.ReadUnsignedShort();
                    this._fundamentalDataParameters.Unmarshal(dis);
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #19
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._systemStatus = dis.ReadUnsignedByte();
                    this._alternateParameter4 = dis.ReadUnsignedByte();
                    this._informationLayers = dis.ReadUnsignedByte();
                    this._modifier = dis.ReadUnsignedByte();
                    this._parameter1 = dis.ReadUnsignedShort();
                    this._parameter2 = dis.ReadUnsignedShort();
                    this._parameter3 = dis.ReadUnsignedShort();
                    this._parameter4 = dis.ReadUnsignedShort();
                    this._parameter5 = dis.ReadUnsignedShort();
                    this._parameter6 = dis.ReadUnsignedShort();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #20
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._numberOfPdus = dis.ReadInt();

                    for (int idx = 0; idx < this.NumberOfPdus; idx++)
                    {
                        Pdu anX = new Pdu();
                        anX.Unmarshal(dis);
                        this._pdus.Add(anX);
                    }
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #21
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;
        }
예제 #22
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._munition.Unmarshal(dis);
                    this._warhead = dis.ReadUnsignedShort();
                    this._fuse = dis.ReadUnsignedShort();
                    this._quantity = dis.ReadUnsignedShort();
                    this._rate = dis.ReadUnsignedShort();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #23
0
        /// <summary>
        /// Returns an instance of the PDU based upon the pdu type passed in.  Note PDU will be represented as an Object for simplicity.
        /// </summary>
        /// <param name="pdu_version">Version of IEEE standard</param>
        /// <param name="pduType">Type of PDU</param>
        /// <param name="ds">PDU byte array containing the data</param>
        /// <returns>PDU instance.</returns>         
        protected virtual object SwitchOnType(byte pduVersion, uint pduType, byte[] ds)
        {
            object pdu = null;

            DataInputStream dStream = new DataInputStream(ds, this.Endian);

            switch (pduVersion)
            {
                case 5:
                    // DIS 1995
                    break;
                case 6:
                    // DIS 1998
                    // pdu = OpenDis.Utilities.PDUBank.GetPDU(pduType);
                    pdu = UnmarshalRawPdu((PduType)pduType, dStream);
                    break;
                default:
                    break;
            }

            //if (pdu != null)
            //{
            //    //Call the method of the underlining Type vice the Upper class method.
            //    ReturnUnmarshalledPDU(pdu, dStream);
            //}

            return pdu;
        }
예제 #24
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._recordID = dis.ReadUnsignedInt();
                    this._recordSetSerialNumber = dis.ReadUnsignedInt();
                    this._recordLength = dis.ReadUnsignedShort();
                    this._recordCount = dis.ReadUnsignedShort();
                    this._recordValues = dis.ReadUnsignedShort();
                    this._pad4 = dis.ReadUnsignedByte();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #25
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._beamDirection.Unmarshal(dis);
                    this._azimuthBeamwidth = dis.ReadFloat();
                    this._referenceSystem = dis.ReadFloat();
                    this._padding1 = dis.ReadShort();
                    this._padding2 = dis.ReadByte();
                    this._ez = dis.ReadFloat();
                    this._ex = dis.ReadFloat();
                    this._phase = dis.ReadFloat();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._activeEmissionParameterIndex = dis.ReadUnsignedShort();
                    this._scanPattern = dis.ReadUnsignedShort();
                    this._beamCenterAzimuth = dis.ReadFloat();
                    this._azimuthalBeamwidth = dis.ReadFloat();
                    this._beamCenterDE = dis.ReadFloat();
                    this._deBeamwidth = dis.ReadFloat();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #27
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._systemType = dis.ReadUnsignedShort();
                    this._systemName = dis.ReadUnsignedShort();
                    this._systemMode = dis.ReadUnsignedByte();
                    this._changeOptions = dis.ReadUnsignedByte();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #28
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    for (int idx = 0; idx < this._otherParameters.Length; idx++)
                    {
                        this._otherParameters[idx] = dis.ReadByte();
                    }
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #29
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._currentShaftRPMs = dis.ReadShort();
                    this._orderedShaftRPMs = dis.ReadShort();
                    this._shaftRPMRateOfChange = dis.ReadFloat();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #30
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._x = dis.ReadFloat();
                    this._y = dis.ReadFloat();
                    this._z = dis.ReadFloat();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #31
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._supplyType.Unmarshal(dis);
                    this._quantity = dis.ReadUnsignedByte();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #32
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._nature = dis.ReadUnsignedShort();
                    this._position = dis.ReadUnsignedShort();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #33
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._deadReckoningAlgorithm = dis.ReadUnsignedByte();

                    for (int idx = 0; idx < this._otherParameters.Length; idx++)
                    {
                        this._otherParameters[idx] = dis.ReadByte();
                    }

                    this._entityLinearAcceleration.Unmarshal(dis);
                    this._entityAngularVelocity.Unmarshal(dis);
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
예제 #34
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(byte pduType, DataInputStream ds)
 {
     return(UnmarshalRawPdu((PduType)pduType, ds));
 }