diff --git a/src/main/java/edu/nps/moves/dis7/ChangeOptions.java b/src/main/java/edu/nps/moves/dis7/ChangeOptions.java index acff4de..e625e7e 100644 --- a/src/main/java/edu/nps/moves/dis7/ChangeOptions.java +++ b/src/main/java/edu/nps/moves/dis7/ChangeOptions.java @@ -13,6 +13,8 @@ */ public class ChangeOptions extends Object implements Serializable { + + protected short changeOptions; /** * Constructor */ @@ -21,12 +23,21 @@ public ChangeOptions() { public int getMarshalledSize() { int marshalSize = 0; - + marshalSize = marshalSize + 1; return marshalSize; } + public short getValue() { + return changeOptions; + } + + public void setValue(short changeOptions) { + this.changeOptions = changeOptions; + } + public void marshal(DataOutputStream dos) { try { + dos.writeByte((byte) changeOptions); } // end try catch (Exception e) { System.out.println(e); @@ -35,6 +46,7 @@ public void marshal(DataOutputStream dos) { public void unmarshal(DataInputStream dis) { try { + changeOptions = (short) dis.readByte(); } // end try catch (Exception e) { System.out.println(e); @@ -51,6 +63,7 @@ public void unmarshal(DataInputStream dis) { * @since ?? */ public void marshal(java.nio.ByteBuffer buff) { + buff.put((byte) changeOptions); } // end of marshal method /** @@ -62,6 +75,7 @@ public void marshal(java.nio.ByteBuffer buff) { * @since ?? */ public void unmarshal(java.nio.ByteBuffer buff) { + changeOptions = (short) buff.get(); } // end of unmarshal method @@ -102,6 +116,9 @@ public boolean equalsImpl(Object obj) { final ChangeOptions rhs = (ChangeOptions) obj; + if(!(changeOptions == rhs.changeOptions)){ + ivarsEqual = false; + } return ivarsEqual; } } // end of class diff --git a/src/main/java/edu/nps/moves/dis7/IFFLayer1.java b/src/main/java/edu/nps/moves/dis7/IFFLayer1.java new file mode 100644 index 0000000..9e3ead4 --- /dev/null +++ b/src/main/java/edu/nps/moves/dis7/IFFLayer1.java @@ -0,0 +1,226 @@ +package edu.nps.moves.dis7; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.Serializable; + +/** + * + * @author fo + */ +public class IFFLayer1 extends Object implements Serializable { + + /** + * Identify the entity that is the source of the emissions + */ + protected EntityID emittingEntityId = new EntityID(); + + /** + * Contain a number generated by the issuing simulator to associate related + * events. + */ + protected EventIdentifier eventId = new EventIdentifier(); + + /** + * Relative location of a designated primary antenna for this IFF system + */ + protected Vector3Float relativeAntennaLocation = new Vector3Float(); + + /** + * A specific interrogator or transponder system for the emitting system + */ + protected SystemIdentifier systemId = new SystemIdentifier(); + + /** + * a unique decimal number assigned to this interrogator or transponder to + * distinguish it from multiple interrogators or transponders that are + * associated with the same entity + */ + protected short systemDesignator; + + /** + * variable format field containing 8 bits of data whose meaning is defined + * for each specific system + */ + protected short systemSpecificData; + + /** + * Identify certain basic operational data for the IFF emitting system + */ + protected FundamentalOperationalData fundamentalOperationalData = new FundamentalOperationalData(); + + public IFFLayer1() { + } + + public int getMarshalledSize() { + int marshalSize = 0; + + marshalSize = marshalSize + emittingEntityId.getMarshalledSize();//emittingEntityId + marshalSize = marshalSize + eventId.getMarshalledSize();//eventId + marshalSize = marshalSize + relativeAntennaLocation.getMarshalledSize();//relativeAntennaLocation + marshalSize = marshalSize + systemId.getMarshalledSize();//systemId + marshalSize = marshalSize + 1;//systemDesignator + marshalSize = marshalSize + 1;//systemSpecificData + marshalSize = marshalSize + fundamentalOperationalData.getMarshalledSize();//fundamentalOperationalData + return marshalSize; + } + + public EntityID getEmittingEntityId() { + return emittingEntityId; + } + + public void setEmittingEntityId(EntityID emittingEntityId) { + this.emittingEntityId = emittingEntityId; + } + + public EventIdentifier getEventId() { + return eventId; + } + + public void setEventId(EventIdentifier eventId) { + this.eventId = eventId; + } + + public Vector3Float getRelativeAntennaLocation() { + return relativeAntennaLocation; + } + + public void setRelativeAntennaLocation(Vector3Float relativeAntennaLocation) { + this.relativeAntennaLocation = relativeAntennaLocation; + } + + public SystemIdentifier getSystemId() { + return systemId; + } + + public void setSystemId(SystemIdentifier systemId) { + this.systemId = systemId; + } + + public short getSystemDesignator() { + return systemDesignator; + } + + public void setSystemDesignator(short systemDesignator) { + this.systemDesignator = systemDesignator; + } + + public short getSystemSpecificData() { + return systemSpecificData; + } + + public void setSystemSpecificData(short systemSpecificData) { + this.systemSpecificData = systemSpecificData; + } + + public FundamentalOperationalData getFundamentalOperationalData() { + return fundamentalOperationalData; + } + + public void setFundamentalOperationalData(FundamentalOperationalData fundamentalOperationalData) { + this.fundamentalOperationalData = fundamentalOperationalData; + } + + public void marshal(DataOutputStream dos) { + try { + emittingEntityId.marshal(dos); + eventId.marshal(dos); + relativeAntennaLocation.marshal(dos); + systemId.marshal(dos); + dos.writeByte((byte) systemDesignator); + dos.writeByte((byte) systemSpecificData); + fundamentalOperationalData.marshal(dos); + } // end try + catch (Exception e) { + System.out.println(e); + } + } // end of marshal method + + public void unmarshal(DataInputStream dis) { + + try { + emittingEntityId.unmarshal(dis); + eventId.unmarshal(dis); + relativeAntennaLocation.unmarshal(dis); + systemId.unmarshal(dis); + systemDesignator = (short) dis.readUnsignedByte(); + systemSpecificData = (short) dis.readUnsignedByte(); + fundamentalOperationalData.unmarshal(dis); + } // end try + catch (Exception e) { + System.out.println(e); + } + } // end of unmarshal method + + public void marshal(java.nio.ByteBuffer buff) { + emittingEntityId.marshal(buff); + eventId.marshal(buff); + relativeAntennaLocation.marshal(buff); + systemId.marshal(buff); + buff.put((byte) systemDesignator); + buff.put((byte) systemSpecificData); + fundamentalOperationalData.marshal(buff); + } // end of marshal method + + public void unmarshal(java.nio.ByteBuffer buff) { + emittingEntityId.unmarshal(buff); + eventId.unmarshal(buff); + relativeAntennaLocation.unmarshal(buff); + systemId.unmarshal(buff); + systemDesignator = (short) buff.get(); + systemSpecificData = (short) buff.get(); + fundamentalOperationalData.unmarshal(buff); + } // end of unmarshal method + + @Override + public boolean equals(Object obj) { + + if (this == obj) { + return true; + } + + if (obj == null) { + return false; + } + + if (getClass() != obj.getClass()) { + return false; + } + + return equalsImpl(obj); + } + + public boolean equalsImpl(Object obj) { + boolean ivarsEqual = true; + + if (!(obj instanceof IFFLayer1)) { + return false; + } + final IFFLayer1 rhs = (IFFLayer1) obj; + + if (!(emittingEntityId.equals(rhs.emittingEntityId))) { + ivarsEqual = false; + } + if (!(eventId.equals(rhs.eventId))) { + ivarsEqual = false; + } + if (!(relativeAntennaLocation.equals(rhs.relativeAntennaLocation))) { + ivarsEqual = false; + } + if (!(systemId.equals(rhs.systemId))) { + ivarsEqual = false; + } + if (!(systemDesignator == rhs.systemDesignator)) { + ivarsEqual = false; + } + if (!(systemSpecificData == rhs.systemSpecificData)) { + ivarsEqual = false; + } + + if (!(fundamentalOperationalData.equals(rhs.fundamentalOperationalData))) { + ivarsEqual = false; + } + + return ivarsEqual; + } +} diff --git a/src/main/java/edu/nps/moves/dis7/IFFLayer2.java b/src/main/java/edu/nps/moves/dis7/IFFLayer2.java new file mode 100644 index 0000000..31e0319 --- /dev/null +++ b/src/main/java/edu/nps/moves/dis7/IFFLayer2.java @@ -0,0 +1,193 @@ +package edu.nps.moves.dis7; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author fo + */ +public class IFFLayer2 extends Object implements Serializable { + + /** + * Layer Header + */ + protected LayerHeader layerHeader = new LayerHeader(); + + /** + * Beam Data, specifies beam-specific data + */ + protected BeamData beamData = new BeamData(); + + /** + * identifies certain secondary operational data for the interrogator or + * transponder emitting system + */ + protected SecondaryOperationalData secondaryOperationalData = new SecondaryOperationalData(); + + /** + * The fundamental energy radiation emissions characteristics of the mode(s) + * for an IFF system type shall be represented by an IFF Fundamental + * Parameter Data record. At least one IFF Fundamental Parameter Data record + * is required. + */ + protected List iffFundamentalParameterData = new ArrayList<>(); + + public IFFLayer2() { + } + + public LayerHeader getLayerHeader() { + return layerHeader; + } + + public void setLayerHeader(LayerHeader layerHeader) { + this.layerHeader = layerHeader; + } + + public BeamData getBeamData() { + return beamData; + } + + public void setBeamData(BeamData beamData) { + this.beamData = beamData; + } + + public SecondaryOperationalData getSecondaryOperationalData() { + return secondaryOperationalData; + } + + public void setSecondaryOperationalData(SecondaryOperationalData secondaryOperationalData) { + this.secondaryOperationalData = secondaryOperationalData; + } + + public List getIffFundamentalParameterData() { + return iffFundamentalParameterData; + } + + public void setIffFundamentalParameterData(List iffFundamentalParameterData) { + this.iffFundamentalParameterData = iffFundamentalParameterData; + } + + public int getMarshalledSize() { + int marshalSize = 0; + marshalSize = marshalSize + layerHeader.getMarshalledSize(); + marshalSize = marshalSize + beamData.getMarshalledSize(); + marshalSize = marshalSize + secondaryOperationalData.getMarshalledSize(); + for (int idx = 0; idx < iffFundamentalParameterData.size(); idx++) { + marshalSize = marshalSize + iffFundamentalParameterData.get(idx).getMarshalledSize(); + } + return marshalSize; + } + + public void marshal(DataOutputStream dos) { + try { + updateLayerHeader(); + layerHeader.marshal(dos); + beamData.marshal(dos); + updateIffFundamentalParameterRecordNumber(); + secondaryOperationalData.marshal(dos); + for (int idx = 0; idx < iffFundamentalParameterData.size(); idx++) { + iffFundamentalParameterData.get(idx).marshal(dos); + } + + } // end try // end try + catch (Exception e) { + System.out.println(e); + } + } // end of marshal method + + public void unmarshal(DataInputStream dis) { + try { + layerHeader.unmarshal(dis); + beamData.unmarshal(dis); + secondaryOperationalData.unmarshal(dis); + for (int idx = 0; idx < secondaryOperationalData.getNumberOfIFFFundamentalParameterRecords(); idx++) { + IFFFundamentalParameterData paramData = new IFFFundamentalParameterData(); + paramData.unmarshal(dis); + iffFundamentalParameterData.add(paramData); + } + } // end try + catch (Exception e) { + System.out.println(e); + } + } // end of unmarshal method + + public void marshal(java.nio.ByteBuffer buff) { + updateLayerHeader(); + layerHeader.marshal(buff); + beamData.marshal(buff); + updateIffFundamentalParameterRecordNumber(); + secondaryOperationalData.marshal(buff); + for (int idx = 0; idx < iffFundamentalParameterData.size(); idx++) { + iffFundamentalParameterData.get(idx).marshal(buff); + } + } // end of marshal method + + private void updateLayerHeader() { + layerHeader.setLayerNumber((short) 2); + layerHeader.setLength(getMarshalledSize()); + } + + private void updateIffFundamentalParameterRecordNumber() { + secondaryOperationalData.setNumberOfIFFFundamentalParameterRecords(iffFundamentalParameterData.size()); + } + + public void unmarshal(java.nio.ByteBuffer buff) { + layerHeader.unmarshal(buff); + beamData.unmarshal(buff); + secondaryOperationalData.unmarshal(buff); + for (int idx = 0; idx < secondaryOperationalData.getNumberOfIFFFundamentalParameterRecords(); idx++) { + IFFFundamentalParameterData paramData = new IFFFundamentalParameterData(); + paramData.unmarshal(buff); + iffFundamentalParameterData.add(paramData); + } + } // end of unmarshal method + + @Override + public boolean equals(Object obj) { + + if (this == obj) { + return true; + } + + if (obj == null) { + return false; + } + + if (getClass() != obj.getClass()) { + return false; + } + + return equalsImpl(obj); + } + + public boolean equalsImpl(Object obj) { + boolean ivarsEqual = true; + + if (!(obj instanceof IFFLayer2)) { + return false; + } + + final IFFLayer2 rhs = (IFFLayer2) obj; + + if (!(layerHeader.equals(rhs.layerHeader))) { + ivarsEqual = false; + } + if (!(beamData.equals(rhs.beamData))) { + ivarsEqual = false; + } + if (!(secondaryOperationalData.equals(rhs.secondaryOperationalData))) { + ivarsEqual = false; + } + + for (int idx = 0; idx < iffFundamentalParameterData.size(); idx++) { + if (!(iffFundamentalParameterData.get(idx).equals(rhs.iffFundamentalParameterData.get(idx)))) { + ivarsEqual = false; + } + } + return ivarsEqual; + } +} diff --git a/src/main/java/edu/nps/moves/dis7/IFFPdu.java b/src/main/java/edu/nps/moves/dis7/IFFPdu.java new file mode 100644 index 0000000..bdbf154 --- /dev/null +++ b/src/main/java/edu/nps/moves/dis7/IFFPdu.java @@ -0,0 +1,165 @@ +package edu.nps.moves.dis7; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.Serializable; +import java.nio.ByteBuffer; + +/** + * + * @author fo + */ +public class IFFPdu extends DistributedEmissionsFamilyPdu implements Serializable { + + /** + * Basic System Data. This is the only layer that is required to be included + * in every IFF PDU regardless of the system type + */ + protected IFFLayer1 layer1 = new IFFLayer1(); + + /** + * Basic Emissions Data. This layer is used for basic emissions data when + * required to support simulations that need detailed IFF electromagnetic + * characteristics + */ + protected IFFLayer2 layer2 = null; + + // Layers not yet implemented +// protected IFFLayer3 layer3 = null; +// protected IFFLayer4 layer4 = null; +// protected IFFLayer5 layer5 = null; +// protected IFFLayer6 layer6 = null; +// protected IFFLayer7 layer7 = null; + + public IFFPdu() { + setPduType((short) 28); + } + + public int getMarshalledSize() { + int marshalSize = 0; + marshalSize = super.getMarshalledSize(); + marshalSize = marshalSize + layer1.getMarshalledSize();//emittingEntityId + if (isLayerPresent(2)) { + marshalSize = marshalSize + layer2.getMarshalledSize(); + } + + return marshalSize; + } + + public IFFLayer1 getLayer1() { + return layer1; + } + + public void setLayer1(IFFLayer1 layer1) { + this.layer1 = layer1; + } + + public IFFLayer2 getLayer2() { + return layer2; + } + + public void setLayer2(IFFLayer2 layer2) { + this.layer2 = layer2; + updateInformationLayersPresent(); + } + + private void updateInformationLayersPresent() { + short informationLayersPresent = 1; + if (layer2 != null) { + informationLayersPresent = (short) (informationLayersPresent | 0x02); + } + layer1.getFundamentalOperationalData().setInformationLayers(informationLayersPresent); + } + + public void marshal(DataOutputStream dos) { + super.marshal(dos); + try { + layer1.marshal(dos); + if (layer2 != null) { + updateInformationLayersPresent(); + layer2.marshal(dos); + } + } // end try // end try + catch (Exception e) { + System.out.println(e); + } + } // end of marshal method + + public void unmarshal(DataInputStream dis) { + super.unmarshal(dis); + try { + layer1.unmarshal(dis); + if (isLayerPresent(2)) { + layer2 = new IFFLayer2(); + layer2.unmarshal(dis); + } + } // end try + catch (Exception e) { + System.out.println(e); + } + } // end of unmarshal method + + public void marshal(java.nio.ByteBuffer buff) { + super.marshal(buff); + layer1.marshal(buff); + if (layer2 != null) { + updateInformationLayersPresent(); + layer2.marshal(buff); + } + } // end of marshal method + + public void unmarshal(java.nio.ByteBuffer buff) { + super.unmarshal(buff); + layer1.unmarshal(buff); + if (isLayerPresent(2) ) { + layer2 = new IFFLayer2(); + layer2.unmarshal(buff); + } + } // end of unmarshal method + + private boolean isLayerPresent(int layer) { + return (layer1.getFundamentalOperationalData().getInformationLayers() & layer) > 0; + } + + @Override + public boolean equals(Object obj) { + + if (this == obj) { + return true; + } + + if (obj == null) { + return false; + } + + if (getClass() != obj.getClass()) { + return false; + } + + return equalsImpl(obj); + } + + @Override + public boolean equalsImpl(Object obj) { + boolean ivarsEqual = true; + + if (!(obj instanceof IFFPdu)) { + return false; + } + final IFFPdu rhs = (IFFPdu) obj; + + if (!(layer1.equals(rhs.layer1))) { + ivarsEqual = false; + } + if (layer2 != null || rhs.layer2 != null) { + if (!(layer2 == null && rhs.layer2 == null)) { + ivarsEqual = false; + } + } + if (!(layer2.equals(rhs.layer2))) { + ivarsEqual = false; + } + + return ivarsEqual && super.equalsImpl(rhs); + } +} diff --git a/src/main/java/edu/nps/moves/dis7/PduFactory.java b/src/main/java/edu/nps/moves/dis7/PduFactory.java index aea0687..4f34322 100644 --- a/src/main/java/edu/nps/moves/dis7/PduFactory.java +++ b/src/main/java/edu/nps/moves/dis7/PduFactory.java @@ -242,6 +242,9 @@ public Pdu createPdu(ByteBuffer buff) { case ENTITY_STATE_UPDATE: aPdu = new EntityStateUpdatePdu(); break; + case IFF_ATC_NAVAIDS: + aPdu = new IFFPdu(); + break; default: this.logger.log(Level.INFO, "PDU not implemented. Type = " + pduType + "\n"); if (pduTypeEnum != null) { diff --git a/src/main/java/edu/nps/moves/dis7/SystemIdentifier.java b/src/main/java/edu/nps/moves/dis7/SystemIdentifier.java index f7f1d2e..924bbe5 100644 --- a/src/main/java/edu/nps/moves/dis7/SystemIdentifier.java +++ b/src/main/java/edu/nps/moves/dis7/SystemIdentifier.java @@ -44,7 +44,7 @@ public int getMarshalledSize() { marshalSize = marshalSize + 2; // systemType marshalSize = marshalSize + 2; // systemName - marshalSize = marshalSize + 2; // systemMode + marshalSize = marshalSize + 1; // systemMode marshalSize = marshalSize + changeOptions.getMarshalledSize(); // changeOptions return marshalSize; @@ -86,7 +86,7 @@ public void marshal(DataOutputStream dos) { try { dos.writeShort((short) systemType); dos.writeShort((short) systemName); - dos.writeShort((short) systemMode); + dos.writeByte((byte) systemMode); changeOptions.marshal(dos); } // end try catch (Exception e) { @@ -98,7 +98,7 @@ public void unmarshal(DataInputStream dis) { try { systemType = (int) dis.readUnsignedShort(); systemName = (int) dis.readUnsignedShort(); - systemMode = (int) dis.readUnsignedShort(); + systemMode = (int) dis.readUnsignedByte(); changeOptions.unmarshal(dis); } // end try catch (Exception e) { @@ -118,7 +118,7 @@ public void unmarshal(DataInputStream dis) { public void marshal(java.nio.ByteBuffer buff) { buff.putShort((short) systemType); buff.putShort((short) systemName); - buff.putShort((short) systemMode); + buff.put((byte) systemMode); changeOptions.marshal(buff); } // end of marshal method @@ -133,7 +133,7 @@ public void marshal(java.nio.ByteBuffer buff) { public void unmarshal(java.nio.ByteBuffer buff) { systemType = (int) (buff.getShort() & 0xFFFF); systemName = (int) (buff.getShort() & 0xFFFF); - systemMode = (int) (buff.getShort() & 0xFFFF); + systemMode = (int) (buff.get()& 0xFF); changeOptions.unmarshal(buff); } // end of unmarshal method diff --git a/src/test/java/edu/nps/moves/dis7/IFFPduTest.java b/src/test/java/edu/nps/moves/dis7/IFFPduTest.java new file mode 100644 index 0000000..3174dfc --- /dev/null +++ b/src/test/java/edu/nps/moves/dis7/IFFPduTest.java @@ -0,0 +1,172 @@ +package edu.nps.moves.dis7; + +import java.io.IOException; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author fo + */ +public class IFFPduTest { + + public IFFPduTest() { + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void marshal() { + IFFPdu ipdu = new IFFPdu(); + + byte[] buffer = ipdu.marshal(); + + assertEquals(buffer.length, ipdu.getLength()); + } + + @Test + public void unmarshal() throws IOException { + PduFactory factory = new PduFactory(); + Pdu pdu = factory.createPdu(edu.nps.moves.dis7.PduFileLoader.load("IFFPdu.raw")); + + // Header + assertEquals(7, pdu.getProtocolVersion()); + assertEquals(1, pdu.getExerciseID()); + assertEquals(28, pdu.getPduType()); + assertEquals(6, pdu.getProtocolFamily()); + assertEquals(136, pdu.getLength()); + assertEquals(13, pdu.getPduStatus()); + assertEquals(0, pdu.getPadding()); + + IFFPdu ipdu =(IFFPdu) pdu; + + + + //Layer1 + final IFFLayer1 layer1 = ipdu.getLayer1(); + + //EmittingEntityId + assertEquals(1, layer1.getEmittingEntityId().getSiteID()); + assertEquals(206, layer1.getEmittingEntityId().getApplicationID()); + assertEquals(55, layer1.getEmittingEntityId().getEntityID()); + + //EventId + assertEquals(1, layer1.getEventId().getSimulationAddress().getSite()); + assertEquals(206, layer1.getEventId().getSimulationAddress().getApplication()); + assertEquals(1, layer1.getEventId().getEventNumber()); + + //RelativeAntennaLocation + assertEquals(1, layer1.getRelativeAntennaLocation().getX(),0.001); + assertEquals(1, layer1.getRelativeAntennaLocation().getY(),0.001); + assertEquals(1, layer1.getRelativeAntennaLocation().getZ(),0.001); + + //SystemId + assertEquals(1, layer1.getSystemId().getSystemType()); + assertEquals(1, layer1.getSystemId().getSystemName()); + assertEquals(3, layer1.getSystemId().getSystemMode()); + assertEquals(2, layer1.getSystemId().getChangeOptions().getValue()); + + //SystemDesignator + assertEquals(55, layer1.getSystemDesignator()); + + //SystemSpecificData + assertEquals(55, layer1.getSystemSpecificData()); + + //FundamentalOperationalData + + //SystemStatus + assertEquals(1, layer1.getFundamentalOperationalData().getSystemStatus()); + + //DataField1 + assertEquals(0, layer1.getFundamentalOperationalData().getDataField1()); + + //InformationLayers + assertEquals(3, layer1.getFundamentalOperationalData().getInformationLayers()); + + //DataField2 + assertEquals(14, layer1.getFundamentalOperationalData().getDataField2()); + + //Parameter1 + assertEquals(57403, layer1.getFundamentalOperationalData().getParameter1()); + + //Parameter1 + assertEquals(61439, layer1.getFundamentalOperationalData().getParameter2()); + + //Parameter1 + assertEquals(61439, layer1.getFundamentalOperationalData().getParameter3()); + + //Parameter1 + assertEquals(57389, layer1.getFundamentalOperationalData().getParameter4()); + + //Parameter1 + assertEquals(57364, layer1.getFundamentalOperationalData().getParameter5()); + + //Parameter1 + assertEquals(57344, layer1.getFundamentalOperationalData().getParameter6()); + + + + //Layer2 + final IFFLayer2 layer2 = ipdu.getLayer2(); + + //LayerHeader + assertEquals(2, layer2.getLayerHeader().getLayerNumber()); + assertEquals(76, layer2.getLayerHeader().getLength()); + assertEquals(0, layer2.getLayerHeader().getLayerSpecificInformation()); + + //BeamData + assertEquals(56, layer2.getBeamData().getBeamAzimuthCenter(), 0.001); + assertEquals(57, layer2.getBeamData().getBeamAzimuthSweep(), 0.001); + assertEquals(58, layer2.getBeamData().getBeamElevationCenter(), 0.001); + assertEquals(60, layer2.getBeamData().getBeamElevationSweep(), 0.001); + assertEquals(59, layer2.getBeamData().getBeamSweepSync(), 0.001); + + //IffFundamentalParameterData + assertEquals(2, layer2.getIffFundamentalParameterData().size()); + + assertEquals(0, layer2.getIffFundamentalParameterData().get(0).getApplicableModes()); + assertEquals(5, layer2.getIffFundamentalParameterData().get(0).getBurstLength()); + assertEquals(5, layer2.getIffFundamentalParameterData().get(0).getErp(), 0.001); + assertEquals(5, layer2.getIffFundamentalParameterData().get(0).getFrequency(), 0.001); + assertEquals(5, layer2.getIffFundamentalParameterData().get(0).getPgrf(), 0.001); + assertEquals(5, layer2.getIffFundamentalParameterData().get(0).getPulseWidth(), 0.001); + assertEquals(3, layer2.getIffFundamentalParameterData().get(0).getSystemSpecificData().length); + assertEquals(0, layer2.getIffFundamentalParameterData().get(0).getSystemSpecificData()[0]); + assertEquals(0, layer2.getIffFundamentalParameterData().get(0).getSystemSpecificData()[1]); + assertEquals(0, layer2.getIffFundamentalParameterData().get(0).getSystemSpecificData()[2]); + + assertEquals(0, layer2.getIffFundamentalParameterData().get(1).getApplicableModes()); + assertEquals(6, layer2.getIffFundamentalParameterData().get(1).getBurstLength()); + assertEquals(6, layer2.getIffFundamentalParameterData().get(1).getErp(), 0.001); + assertEquals(6, layer2.getIffFundamentalParameterData().get(1).getFrequency(), 0.001); + assertEquals(6, layer2.getIffFundamentalParameterData().get(1).getPgrf(), 0.001); + assertEquals(6, layer2.getIffFundamentalParameterData().get(1).getPulseWidth(), 0.001); + assertEquals(3, layer2.getIffFundamentalParameterData().get(1).getSystemSpecificData().length); + assertEquals(0, layer2.getIffFundamentalParameterData().get(1).getSystemSpecificData()[0]); + assertEquals(0, layer2.getIffFundamentalParameterData().get(1).getSystemSpecificData()[1]); + assertEquals(0, layer2.getIffFundamentalParameterData().get(1).getSystemSpecificData()[2]); + + //SecondaryOperationalData + assertEquals(2, layer2.getSecondaryOperationalData().getNumberOfIFFFundamentalParameterRecords()); + assertEquals(0, layer2.getSecondaryOperationalData().getOperationalData1()); + assertEquals(0, layer2.getSecondaryOperationalData().getOperationalData2()); + } +} diff --git a/src/test/resources/edu/nps/moves/dis7/IFFPdu.raw b/src/test/resources/edu/nps/moves/dis7/IFFPdu.raw new file mode 100644 index 0000000..5902be6 Binary files /dev/null and b/src/test/resources/edu/nps/moves/dis7/IFFPdu.raw differ