diff --git a/examples/src/OpenDis4Examples/EspduReceiver.java b/examples/src/OpenDis4Examples/EspduReceiver.java index 4783ef6437959963f376bdf9dc6109664e155685..d5cfe9dcd0ce2d8ee45f15501d5b9e8e1aa95d92 100644 --- a/examples/src/OpenDis4Examples/EspduReceiver.java +++ b/examples/src/OpenDis4Examples/EspduReceiver.java @@ -1,88 +1,88 @@ -package OpenDis4Examples; - -import java.net.*; -import java.util.*; - -import edu.nps.moves.disutil.*; - -import edu.nps.moves.dis.*; -import java.io.IOException; - -/** - * Receives PDUs from the network in IEEE DIS format. - * Adapted from OpenDIS library example package edu.nps.moves.examples - * - * @author DMcG - * @version $Id:$ - */ -public class EspduReceiver -{ - /** Max size of a PDU in binary format that we can receive. This is actually - * somewhat outdated--PDUs can be larger--but this is a reasonable starting point. - */ - private static final int MAX_PDU_SIZE = 8192; - - /** Default multicast group address we send on. - * @see <a href="https://en.wikipedia.org/wiki/Multicast_address">https://en.wikipedia.org/wiki/Multicast_address</a> */ - private static final String DEFAULT_MULTICAST_ADDRESS = "239.1.2.3"; - - /** Default multicast port used, matches Wireshark DIS capture default - * @see <a href="https://en.wikipedia.org/wiki/Port_(computer_networking)">https://en.wikipedia.org/wiki/Port_(computer_networking)</a> */ - private static final int DEFAULT_MULTICAST_PORT = 3000; - - /** - * Program invocation, execution starts here - * @param args command-line arguments - */ - public static void main(String args[]) - { - System.out.println("OpenDis4Examples.EspduReceiver started..."); - - MulticastSocket socket; - DatagramPacket packet; - InetAddress address; - PduFactory pduFactory = new PduFactory(); - - try { - // Specify the socket to receive data - socket = new MulticastSocket(DEFAULT_MULTICAST_PORT); - socket.setBroadcast(true); - - // address = InetAddress.getByName(EspduSender.DEFAULT_MULTICAST_GROUP); - // socket.joinGroup(address); - - while (true) // Loop infinitely, receiving datagrams - { - byte buffer[] = new byte[MAX_PDU_SIZE]; - packet = new DatagramPacket(buffer, buffer.length); - - socket.receive(packet); - - List<Pdu> pduBundle = pduFactory.getPdusFromBundle(packet.getData()); - System.out.println("Bundle size is " + pduBundle.size()); - - Iterator iterator = pduBundle.iterator(); - - while(iterator.hasNext()) - { - Pdu aPdu = (Pdu)iterator.next(); - - System.out.print("got PDU of type: " + aPdu.getClass().getName()); - if(aPdu instanceof EntityStatePdu) - { - EntityID eid = ((EntityStatePdu)aPdu).getEntityID(); - Vector3Double position = ((EntityStatePdu)aPdu).getEntityLocation(); - 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.println(); - } // end trop through PDU bundle - } // end while - } // End try - catch (IOException e) - { - System.out.println("Problem with OpenDis4Examples.EspduReceiver, see exception trace:"); - System.out.println(e); - } - } // end main -} // end class +package OpenDis4Examples; + +import java.net.*; +import java.util.*; + +import edu.nps.moves.disutil.*; + +import edu.nps.moves.dis.*; +import java.io.IOException; + +/** + * Receives PDUs from the network in IEEE DIS format. + * Adapted from OpenDIS library example package edu.nps.moves.examples + * + * @author DMcG + * @version $Id:$ + */ +public class EspduReceiver +{ + /** Max size of a PDU in binary format that we can receive. This is actually + * somewhat outdated--PDUs can be larger--but this is a reasonable starting point. + */ + private static final int MAX_PDU_SIZE = 8192; + + /** Default multicast group address we send on. + * @see <a href="https://en.wikipedia.org/wiki/Multicast_address">https://en.wikipedia.org/wiki/Multicast_address</a> */ + private static final String DEFAULT_MULTICAST_ADDRESS = "239.1.2.3"; + + /** Default multicast port used, matches Wireshark DIS capture default + * @see <a href="https://en.wikipedia.org/wiki/Port_(computer_networking)">https://en.wikipedia.org/wiki/Port_(computer_networking)</a> */ + private static final int DEFAULT_MULTICAST_PORT = 3000; + + /** + * Program invocation, execution starts here + * @param args command-line arguments + */ + public static void main(String args[]) + { + System.out.println("OpenDis4Examples.EspduReceiver started..."); + + MulticastSocket socket; + DatagramPacket packet; + InetAddress address; + PduFactory pduFactory = new PduFactory(); + + try { + // Specify the socket to receive data + socket = new MulticastSocket(DEFAULT_MULTICAST_PORT); + socket.setBroadcast(true); + + // address = InetAddress.getByName(EspduSender.DEFAULT_MULTICAST_GROUP); + // socket.joinGroup(address); + + while (true) // Loop infinitely, receiving datagrams + { + byte buffer[] = new byte[MAX_PDU_SIZE]; + packet = new DatagramPacket(buffer, buffer.length); + + socket.receive(packet); + + List<Pdu> pduBundle = pduFactory.getPdusFromBundle(packet.getData()); + System.out.println("Bundle size is " + pduBundle.size()); + + Iterator iterator = pduBundle.iterator(); + + while(iterator.hasNext()) + { + Pdu aPdu = (Pdu)iterator.next(); + + System.out.print("got PDU of type: " + aPdu.getClass().getSimpleName()); + if(aPdu instanceof EntityStatePdu) + { + EntityID eid = ((EntityStatePdu)aPdu).getEntityID(); + Vector3Double position = ((EntityStatePdu)aPdu).getEntityLocation(); + 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.println(); + } // end trop through PDU bundle + } // end while + } // End try + catch (IOException e) + { + System.out.println("Problem with OpenDis4Examples.EspduReceiver, see exception trace:"); + System.out.println(e); + } + } // end main +} // end class diff --git a/examples/src/OpenDis4Examples/PduReceiver.java b/examples/src/OpenDis4Examples/PduReceiver.java index b6c3cadf6d925887c30e8d898a5ab5364adcc3e6..c5e6adb6452ffc38b4c5aa1ebf09300bd159fe41 100644 --- a/examples/src/OpenDis4Examples/PduReceiver.java +++ b/examples/src/OpenDis4Examples/PduReceiver.java @@ -53,7 +53,7 @@ public class PduReceiver if (pdu != null) { short currentPduType = pdu.getPduType(); - String currentPduTypeName = pdu.getClass().getName(); + String currentPduTypeName = pdu.getClass().getSimpleName(); short currentProtocolFamilyID = pdu.getProtocolFamily(); String currentPduFamilyName = pdu.getClass().getSuperclass().getSimpleName(); diff --git a/examples/src/OpenDis4Examples/PduSender.java b/examples/src/OpenDis4Examples/PduSender.java index 601d7116e027b63c5edd961a26309eaaebe68071..c10e980a51688febf2b36555afb2178078b08e9d 100644 --- a/examples/src/OpenDis4Examples/PduSender.java +++ b/examples/src/OpenDis4Examples/PduSender.java @@ -184,7 +184,7 @@ public class PduSender buffer = baos.toByteArray(); DatagramPacket packet = new DatagramPacket(buffer, buffer.length, localMulticastAddress, DEFAULT_MULTICAST_PORT); socket.send(packet); - System.out.println("Sent PDU of type " + aPdu.getClass().getName()); + System.out.println("Sent PDU of type " + aPdu.getClass().getSimpleName()); } // write the PDUs out to an XML file. //PduContainer container = new PduContainer(); diff --git a/examples/src/OpenDis7Examples/ExampleSimulationProgram.java b/examples/src/OpenDis7Examples/ExampleSimulationProgram.java index 8e691af4f63ac4d1cefc7dd35439ab284e7870f5..75446336ba85902536de0d4df8c669f91dbfe4ed 100644 --- a/examples/src/OpenDis7Examples/ExampleSimulationProgram.java +++ b/examples/src/OpenDis7Examples/ExampleSimulationProgram.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2021, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. + * Copyright (c) 2008-2022, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. * This work is provided under a BSD open-source license, see project license.html and license.txt * @author brutzman@nps.edu */ diff --git a/examples/src/OpenDis7Examples/ExampleTrackInterpolation.java b/examples/src/OpenDis7Examples/ExampleTrackInterpolation.java index fe053b234f1b2a7eb945a47d434a1e5d3347e279..117dbc67010167a7b4699dfaae44902d6736a16f 100644 --- a/examples/src/OpenDis7Examples/ExampleTrackInterpolation.java +++ b/examples/src/OpenDis7Examples/ExampleTrackInterpolation.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2021, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. + * Copyright (c) 2008-2022, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. * This work is provided under a BSD open-source license, see project license.html and license.txt * * @author brutzman@nps.edu diff --git a/examples/src/OpenDis7Examples/PduListenerSaver.java b/examples/src/OpenDis7Examples/PduListenerSaver.java index 1bde47c9ff6bdda1a16bf403ed044202d03752e4..b6750d288616713142c39a64e1a12a05cf2b9b2c 100644 --- a/examples/src/OpenDis7Examples/PduListenerSaver.java +++ b/examples/src/OpenDis7Examples/PduListenerSaver.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2021, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. + * Copyright (c) 2008-2022, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. * This work is provided under a BSD open-source license, see project license.html and license.txt */ package OpenDis7Examples; diff --git a/examples/src/OpenDis7Examples/PduReaderPlayer.java b/examples/src/OpenDis7Examples/PduReaderPlayer.java index b380569cba7ae7e9c017623e8315d91839c9ab37..913f9a40820ee81cc9e12fe6f8a10b148be3b11d 100644 --- a/examples/src/OpenDis7Examples/PduReaderPlayer.java +++ b/examples/src/OpenDis7Examples/PduReaderPlayer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2021, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. + * Copyright (c) 2008-2022, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. * This work is provided under a BSD open-source license, see project license.html and license.txt */ package OpenDis7Examples; diff --git a/examples/src/OpenDis7Examples/SimulationManager.java b/examples/src/OpenDis7Examples/SimulationManager.java index 6e28e064372fce9c97f0b70fe41fa69deec435eb..401f2da5b19a9edc4e1ec60ff2d3e69a7df72d08 100644 --- a/examples/src/OpenDis7Examples/SimulationManager.java +++ b/examples/src/OpenDis7Examples/SimulationManager.java @@ -1,5 +1,5 @@ /* -Copyright (c) 1995-2021 held by the author(s). All rights reserved. +Copyright (c) 1995-2022 held by the author(s). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions