Skip to content
Snippets Groups Projects
Commit f5ba97bb authored by ctsfi's avatar ctsfi
Browse files

Project Progress

parent 4b1e33a9
No related branches found
No related tags found
No related merge requests found
......@@ -102,15 +102,31 @@ public class PDUReciever {
else if (aPdu instanceof CommentReliablePdu){
System.out.println(receiptMessage);
ArrayList<VariableDatum> payloadList = (ArrayList)((CommentReliablePdu) aPdu).getVariableDatumRecords();
if (!payloadList.isEmpty())
System.out.print (" messages: ");
for (VariableDatum variableDatum : payloadList)
{
String nextComment = new String(variableDatum.getVariableDatumValue()); // convert byte[] to String
System.out.print (" \"" + nextComment + "\"");
System.out.println();
if (!payloadList.isEmpty())
System.out.print (" messages: ");
for (VariableDatum variableDatum : payloadList)
{
String nextComment = new String(variableDatum.getVariableDatumValue()); // convert byte[] to String
System.out.print (" \"" + nextComment + "\"");
System.out.println();
}
}
else if (aPdu instanceof ResupplyOfferPdu){
System.out.println(receiptMessage);
EntityID receiverID = ((ResupplyOfferPdu) aPdu).getReceivingEntityID();
EntityID supplierID = ((ResupplyOfferPdu) aPdu).getSupplyingEntityID();
List<SupplyQuantity> supplyList = ((ResupplyOfferPdu) aPdu).getSupplies();
System.out.println(" Resupply Offer from Entity [" + supplierID.getSiteID() + ", "+ supplierID.getApplicationID() + ", " + supplierID.getEntityID() + "] to resupply Entity ["+ receiverID.getSiteID() + ", "+ receiverID.getApplicationID() + ", " + receiverID.getEntityID() + "]" );
for (int i = 0; i < supplyList.size(); i++){
SupplyQuantity supplyQ = supplyList.get(i);
EntityType entityType = supplyQ.getSupplyType();
float supplyQuantity = supplyQ.getQuantity();
System.out.println(" Supplies Offered: [Quantity: " + supplyQuantity + ", Type: " +entityType.getEntityKind() + " "+ entityType.getDomain() + " "+ entityType.getCountry() + " "+ entityType.getCategory() + " "+ entityType.getSubCategory() + " "+ entityType.getSpecific() + " ]");
}
}
} //OTHER PDU TYPES
//OTHER PDU TYPES
else {
System.out.println(receiptMessage);
}
......
......@@ -16,6 +16,7 @@ import java.net.InetAddress;
import java.net.MulticastSocket;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
......@@ -226,8 +227,10 @@ public class WhiteSimulation
double[] loc3 = CoordinateConversions.getXYZfromLatLonDegrees(36.600757, -121.869309, 0 );//NPS Corner by lake
EntityID entityID_1 = new EntityID();
entityID_1.setSiteID(1).setApplicationID(2).setEntityID(3); // made-up example ID
entityID_1.setSiteID(1).setApplicationID(2).setEntityID(3); // made-up example ID
EntityStatePdu entityStatePdu = pduFactory.makeEntityStatePdu();
entityStatePdu.setEntityID(entityID_1);
......@@ -324,12 +327,30 @@ public class WhiteSimulation
EntityID HEID = new EntityID();
HEID.setEntityID(1);
firePdu.setMunitionExpendibleID(HEID);
CommentReliablePdu bmpDestroyedComment = pduFactory.makeCommentReliablePdu("BMP2 DESTROYED BY LAV25-A2 AFTER TWO BURSTS OF 25mm HEI-T ON TARGET");
CommentReliablePdu bmpSightedComment = pduFactory.makeCommentReliablePdu("LAV25-A2 ACQUIRES TARGET BMP2 WITHIN FIRING DISTANCE");
//if(eloc1.getX())
ResupplyOfferPdu resupplyOfferPdu = pduFactory.makeResupplyOfferPdu();
ArrayList<SupplyQuantity> pSupplies = new ArrayList<SupplyQuantity>();
SupplyQuantity ammoSupplyQ = new SupplyQuantity();
ammoSupplyQ.setSupplyType(HEType);
ammoSupplyQ.setQuantity(500);
//EntityType ammoSupply = new EntityType();
// ammoSupply.setEntityKind(EntityKind.MUNITION);
//ammoSupply.setDomain(Entity)
//ammoSupplyQ.setSupplyType(EntityType.)
pSupplies.add(ammoSupplyQ);
resupplyOfferPdu.setSupplies(pSupplies);
resupplyOfferPdu.setReceivingEntityID(lavID);
resupplyOfferPdu.setSupplyingEntityID(bmpID);
// should we customize this munition? what is it for your simulation?
while (loopCount < MAX_LOOP_COUNT) // loop the simulation while allowed, can set additional conditions to break
......@@ -397,8 +418,10 @@ public class WhiteSimulation
sendPDU(entityStatePdu2);
if (fireBool)
sendPDU(firePdu);
if (destBool)
if (destBool){
sendPDU(bmpDestroyedComment);
sendPDU(resupplyOfferPdu);
}
System.out.println ("... PDUs successfully sent");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment