Skip to content
Snippets Groups Projects
Commit 58bb6f67 authored by cs2017's avatar cs2017
Browse files

AngelBlank upto but not including filter

parent 80972ce8
No related branches found
No related tags found
No related merge requests found
...@@ -46,16 +46,6 @@ public class ABEspduReceiverAtoTCP { ...@@ -46,16 +46,6 @@ public class ABEspduReceiverAtoTCP {
while (true) { while (true) {
try try
{ {
// Create TCP Bridge
System.out.println("Opening Bridge.");
Socket clientConnection = new Socket("localhost", TCP_DESTINATION_PORT);
OutputStream os = clientConnection.getOutputStream();
PrintStream ps = new PrintStream(os);
//ByteArrayOutputStream baos = new ByteArrayOutputStream();
//DataOutputStream dos = new DataOutputStream(baos);
System.out.println("Bridging Complete.");
byte buffer[] = new byte[MAX_PDU_SIZE]; byte buffer[] = new byte[MAX_PDU_SIZE];
packet = new DatagramPacket(buffer, buffer.length); packet = new DatagramPacket(buffer, buffer.length);
...@@ -73,10 +63,23 @@ public class ABEspduReceiverAtoTCP { ...@@ -73,10 +63,23 @@ public class ABEspduReceiverAtoTCP {
{ {
Pdu aPdu = (Pdu)it.next(); Pdu aPdu = (Pdu)it.next();
System.out.print("got PDU of type: " + aPdu.getClass().getName()); // System.out.print("got PDU of type: " + aPdu.getClass().getName());
if(aPdu instanceof EntityStatePdu) if(aPdu instanceof EntityStatePdu)
{ {
EntityID eid = ((EntityStatePdu)aPdu).getEntityID(); EntityID eid = ((EntityStatePdu)aPdu).getEntityID();
if (eid.getSite() == 100){
// Create TCP Bridge
System.out.println("Opening Bridge.");
Socket clientConnection = new Socket("localhost", TCP_DESTINATION_PORT);
OutputStream os = clientConnection.getOutputStream();
PrintStream ps = new PrintStream(os);
//ByteArrayOutputStream baos = new ByteArrayOutputStream();
//DataOutputStream dos = new DataOutputStream(baos);
System.out.println("Bridging Complete.");
EntityType entityType = ((EntityStatePdu)aPdu).getEntityType(); EntityType entityType = ((EntityStatePdu)aPdu).getEntityType();
ps.println(eid.getSite()); ps.println(eid.getSite());
ps.println(eid.getApplication()); ps.println(eid.getApplication());
...@@ -91,6 +94,7 @@ public class ABEspduReceiverAtoTCP { ...@@ -91,6 +94,7 @@ public class ABEspduReceiverAtoTCP {
Vector3Double position = ((EntityStatePdu)aPdu).getEntityLocation(); Vector3Double position = ((EntityStatePdu)aPdu).getEntityLocation();
System.out.print(" EID:[" + eid.getSite() + ", " + eid.getApplication() + ", " + eid.getEntity() + "] "); System.out.print(" EID:[" + eid.getSite() + ", " + eid.getApplication() + ", " + eid.getEntity() + "] ");
System.out.print(" Location in DIS coordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]"); System.out.print(" Location in DIS coordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]");
}
} }
System.out.println(); System.out.println();
} // end trop through PDU bundle } // end trop through PDU bundle
......
...@@ -46,16 +46,6 @@ public class ABEspduReceiverBtoTCP { ...@@ -46,16 +46,6 @@ public class ABEspduReceiverBtoTCP {
while (true) { while (true) {
try try
{ {
// Create TCP Bridge
System.out.println("Opening Bridge.");
Socket clientConnection = new Socket("localhost", TCP_DESTINATION_PORT);
OutputStream os = clientConnection.getOutputStream();
PrintStream ps = new PrintStream(os);
//ByteArrayOutputStream baos = new ByteArrayOutputStream();
//DataOutputStream dos = new DataOutputStream(baos);
System.out.println("Bridging Complete.");
byte buffer[] = new byte[MAX_PDU_SIZE]; byte buffer[] = new byte[MAX_PDU_SIZE];
packet = new DatagramPacket(buffer, buffer.length); packet = new DatagramPacket(buffer, buffer.length);
...@@ -73,10 +63,22 @@ public class ABEspduReceiverBtoTCP { ...@@ -73,10 +63,22 @@ public class ABEspduReceiverBtoTCP {
{ {
Pdu aPdu = (Pdu)it.next(); Pdu aPdu = (Pdu)it.next();
System.out.print("got PDU of type: " + aPdu.getClass().getName()); //System.out.print("got PDU of type: " + aPdu.getClass().getName());
if(aPdu instanceof EntityStatePdu) if(aPdu instanceof EntityStatePdu)
{ {
EntityID eid = ((EntityStatePdu)aPdu).getEntityID(); EntityID eid = ((EntityStatePdu)aPdu).getEntityID();
if (eid.getSite() == 200){
// Create TCP Bridge
System.out.println("Opening Bridge.");
Socket clientConnection = new Socket("localhost", TCP_DESTINATION_PORT);
OutputStream os = clientConnection.getOutputStream();
PrintStream ps = new PrintStream(os);
//ByteArrayOutputStream baos = new ByteArrayOutputStream();
//DataOutputStream dos = new DataOutputStream(baos);
System.out.println("Bridging Complete.");
EntityType entityType = ((EntityStatePdu)aPdu).getEntityType(); EntityType entityType = ((EntityStatePdu)aPdu).getEntityType();
ps.println(eid.getSite()); ps.println(eid.getSite());
ps.println(eid.getApplication()); ps.println(eid.getApplication());
...@@ -91,6 +93,7 @@ public class ABEspduReceiverBtoTCP { ...@@ -91,6 +93,7 @@ public class ABEspduReceiverBtoTCP {
Vector3Double position = ((EntityStatePdu)aPdu).getEntityLocation(); Vector3Double position = ((EntityStatePdu)aPdu).getEntityLocation();
System.out.print(" EID:[" + eid.getSite() + ", " + eid.getApplication() + ", " + eid.getEntity() + "] "); System.out.print(" EID:[" + eid.getSite() + ", " + eid.getApplication() + ", " + eid.getEntity() + "] ");
System.out.print(" Location in DIS coordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]"); System.out.print(" Location in DIS coordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]");
}
} }
System.out.println(); System.out.println();
} // end trop through PDU bundle } // end trop through PDU bundle
......
...@@ -237,8 +237,8 @@ public static void main(String args[]) ...@@ -237,8 +237,8 @@ public static void main(String args[])
DataOutputStream dos = new DataOutputStream(baos); DataOutputStream dos = new DataOutputStream(baos);
espdu.marshal(dos); espdu.marshal(dos);
FirePdu fire = new FirePdu(); //FirePdu fire = new FirePdu();
byte[] fireArray = fire.marshal(); //byte[] fireArray = fire.marshal();
// The byte array here is the packet in DIS format. We put that into a // The byte array here is the packet in DIS format. We put that into a
......
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