if (typeof dis === "undefined") dis = {}; // Support for node.js style modules; ignore if not using node.js require if (typeof exports === "undefined") exports = {}; dis.CoordinateConversion = function() { this.RADIANS_TO_DEGREES = 180.0/Math.PI; this.DEGREES_TO_RADIANS = Math.PI/180.0; this.a = 6378137.0; //semi major axis (WGS 84) this.b = 6356752.3142; //semi minor axis (WGS 84) /** * Converts DIS xyz world coordinates to latitude and longitude (IN DEGREES). This algorithm may not be 100% accurate * near the poles. Uses WGS84 , though you can change the ellipsoid constants a and b if you want to use something * else. These formulas were obtained from Military Handbook 600008. The code itself has been * translated from C to Java to Javascript over the years, so hold onto your hats. * * @param position {x:, y:, z:} * @return {latitude:, longitude: altitude:} */ dis.CoordinateConversion.prototype.convertDisToLatLongInDegrees = function(position) { var x = position.x; var y = position.y; var z = position.z; var answer = []; answer[0] = 0.0; answer[1] = 0.0; answer[2] = 0.0; var eSquared; //first eccentricity squared var rSubN; //radius of the curvature of the prime vertical var ePrimeSquared; //second eccentricity squared var W = Math.sqrt((x*x + y*y)); var a = 6378137.0; // shorter variable names var b = 6356752.3142; eSquared = (a*a - b*b) / (a*a); ePrimeSquared = (a*a - b*b) / (b*b); /** * Get the longitude. */ if(x >= 0 ) { answer[1] = Math.atan(y/x); } else if(x < 0 && y >= 0) { answer[1] = Math.atan(y/x) + Math.PI; } else { answer[1] = Math.atan(y/x) - Math.PI; } /** * Longitude calculation done. Now calculate latitude. * NOTE: The handbook mentions using the calculated phi (latitude) value to recalculate B * using tan B = (1-f) tan phi and then performing the entire calculation again to get more accurate values. * However, for terrestrial applications, one iteration is accurate to .1 millimeter on the surface of the * earth (Rapp, 1984, p.124), so one iteration is enough for our purposes */ var tanBZero = (a*z) / (b * W); var BZero = Math.atan((tanBZero)); var tanPhi = (z + (ePrimeSquared * b * (Math.pow(Math.sin(BZero), 3))) ) /(W - (a * eSquared * (Math.pow(Math.cos(BZero), 3)))); var phi = Math.atan(tanPhi); answer[0] = phi; /** * Latitude done, now get the elevation. Note: The handbook states that near the poles, it is preferable to use * h = (Z / sin phi ) - rSubN + (eSquared * rSubN). Our applications are never near the poles, so this formula * was left unimplemented. */ rSubN = (a * a) / Math.sqrt(((a * a) * (Math.cos(phi)*Math.cos(phi)) + ((b*b) * (Math.sin(phi)*Math.sin(phi))))); answer[2] = (W / Math.cos(phi)) - rSubN; var result = {latitude:answer[0] * this.RADIANS_TO_DEGREES, longitude:answer[1] * this.RADIANS_TO_DEGREES, altitude:answer[2]}; return result; }; /** * Converts lat long and geodetic height (elevation) into DIS XYZ * This algorithm also uses the WGS84 ellipsoid, though you can change the values * of a and b for a different ellipsoid. Adapted from Military Handbook 600008 * @param latLonAlt {lat: lon: alt:} in degrees and meters * @return {x: y: z:} in meters */ dis.CoordinateConversion.prototype.getXYZfromLatLonAltDegrees = function(latLonAlt) { var latitudeRadians = latLonAlt.lat * this.DEGREES_TO_RADIANS; var longtitudeRadians = latLonAlt.lon * this.DEGREES_TO_RADIANS; var cosLat = Math.cos(latitudeRadians); var sinLat = Math.sin(latitudeRadians); var rSubN = (this.a * this.a) / Math.sqrt(((this.a * this.a) * (cosLat * cosLat) + ((this.b * this.b) * (sinLat*sinLat)))); var X = (rSubN + latLonAlt.alt) * cosLat * Math.cos(longtitudeRadians); var Y = (rSubN + latLonAlt.alt) * cosLat * Math.sin(longtitudeRadians); var Z = ((((this.b * this.b) / (this.a * this.a)) * rSubN) + latLonAlt.alt) * sinLat; return {x:X, y:Y, z:Z}; }; }; exports.CoordinateConversion = dis.CoordinateConversion; /** * Obsolete--the code generation now includes methods for accessing bit * fields such as this. Remains only for backward compatiblity, and I doubt * anyone is using it. * * Some code to extract the entity apperance bit fields.<p> * * The entityAppearance field in the espdu is a 32 bit integer. To save * space, several different fields are contained within it. * Specifically: * * Name bit position Purpose * ---- ------------ -------- * Paint 0 0 = uniform color, 1=camo * Mobility 1 0 = no mobility kill, 1 = mobility kill * Fire Power 2 0 = no firepower kill, 1 = firepower kill * Damage 3-4 0=no damange, 1=slight, 2=moderate, 3=destroyed * Smoke 5-6 0=not smoking, 1=smoke plume, 2=emitting engine smoke, 3=engine smoke + smoke plume * Trailing effects 7-8 dust cloud, 0=none, 1=small, 2=medium, 3=large * hatch 9-11 0=NA, 1=hatch closed, 2=popped, 3=popped + person visible, 4=open, 5=open and visible * head lights 12 0=off, 1=on * tail light 13 0=off, 1=on * brake lights 14 0=off, 1=on * flaming 15 0=none, 1=flames present * launcher 16 0=not raised, 1=raised * camo type 17-18 0=desert, 1=winter, 2=forest * concealed 19 0=not concealed, 1=prepared concealed position (netting, etc) * frozen status 20 0=not frozen, 1=frozen (in simulation terms) * power plant 22 0=power plant off 1=on * state 23 0=active, 1=deactivated * tent 24 0=not extended 1=extended * ramp 25 0=not extended, 1=extended * blackout lights 26 0=off, 1=on * blackout brake 27 0=off, 1=on * spot lights 28 0=off, 1=on * interior lights 29 0=off, 1=on * unused 30-31 * * Typical use: * * var entityAppearance = new DisAppearance(espdu.entityAppearance); * var damage = entityAppearance.getBitfield(3, 4); * * This returns the "damage" bitfield in bits 3-4. * * var mobility = entityAppearance.getBitfield(1, 1); * * Returns the mobility field, 0 = no mobo kill, 1 = mobility kill * * @author DMcG **/ if (typeof dis === "undefined") dis = {}; // Support for node.js style modules; ignore if not using node.js require if (typeof exports === "undefined") exports = {}; /** Constructor. Takes the integer value extracted from the DIS Entity State Field appearance * * @param {type} integerValue the entity appearance from the espdu * @returns {undefined} */ dis.DisAppearance = function(integerValue) { this.entityAppearance = integerValue; } /** * Test code for creating the correct bitmask * @returns {undefined} */ dis.DisAppearance.prototype.getTestMask = function() { mask = 0; for(var idx = 0; idx < 7; idx++) { mask = mask + this.bit_set(mask, idx); } return mask; }; /** * * @param {integer} startPosition * @param {integer} finishPosition * @returns {integer} */ dis.DisAppearance.prototype.getBitField = function(startPosition, finishPosition) { // do some sanity checks if(startPosition < 0 || startPosition > 31 || finishPosition < 0 || finishPosition > 31 || startPosition > finishPosition) { console.log("invalid start or finish for bitfield values: ", startPosition, " ", finishPosition); return 0; } // Develop the mask. Addition is equivalent to setting multiple bits. var mask = 0; for(var idx = startPosition; idx <= finishPosition; idx++) { mask = mask + this.bit_set(0, idx); } // do the bitmask var maskedValue = this.entityAppearance & mask; // Shift bits to get the normalized value var fieldValue = maskedValue >>> startPosition; return fieldValue; }; /** Set the "bit" position in a number to 1 * * @param {integer} num the number whose bit we are setting. Typically zero. * @param {integer} bit which bit to set * @return {integer} the number passed in, with the "bit"th bit flipped on. **/ dis.DisAppearance.prototype.bit_set = function(num, bit) { return num | 1<<bit; } exports.DisAppearance = dis.DisAppearance; //var BigInteger = require('BigInteger'); if (typeof dis === "undefined") dis = {}; // Support for node.js style modules; ignore if not using node.js require if (typeof exports === "undefined") exports = {}; dis.InputStream = function(binaryData) { this.dataView = new DataView(binaryData, 0); // data, byte offset this.currentPosition = 0; // ptr to "current" position in array dis.InputStream.prototype.readUByte = function() { var data = this.dataView.getUint8(this.currentPosition); this.currentPosition = this.currentPosition + 1; return data; }; dis.InputStream.prototype.readByte = function() { var data = this.dataView.getInt8(this.currentPosition); this.currentPosition = this.currentPosition + 1; return data; }; dis.InputStream.prototype.readUShort = function() { var data = this.dataView.getUint16(this.currentPosition); this.currentPosition = this.currentPosition + 2; return data; }; dis.InputStream.prototype.readShort = function() { var data = this.dataView.getInt16(this.currentPosition); this.currentPosition = this.currentPosition + 2; return data; }; dis.InputStream.prototype.readUInt = function() { var data = this.dataView.getUint32(this.currentPosition); this.currentPosition = this.currentPosition + 4; return data; }; dis.InputStream.prototype.readInt = function() { var data = this.dataView.getInt32(this.currentPosition); this.currentPosition = this.currentPosition + 4; return data; }; /** Read a long integer. Assumes big endian format. Uses the BigInteger package. */ dis.InputStream.prototype.readLongInt = function() { var data1 = this.dataView.getInt32(this.currentPosition); var data2 = this.dataView.getInt32(this.currentPosition + 4); this.currentPosition = this.currentPosition + 8; }; dis.InputStream.prototype.readFloat32 = function() { var data = this.dataView.getFloat32(this.currentPosition); this.currentPosition = this.currentPosition + 4; return data; }; dis.InputStream.prototype.readFloat64 = function() { var data = this.dataView.getFloat64(this.currentPosition); this.currentPosition = this.currentPosition + 8; return data; }; dis.InputStream.prototype.readLong = function() { console.log("Problem in dis.InputStream. Javascript cannot natively handle 64 bit ints"); console.log("Returning 0 from read, which is almost certainly wrong"); this.currentPosition = this.currentPosition + 8; return 0; }; }; exports.InputStream = dis.InputStream; if (typeof dis === "undefined") dis = {}; // Support for node.js style modules; ignore if not using node.js require if (typeof exports === "undefined") exports = {}; /** * @param binaryDataBuffer ArrayBuffer */ dis.OutputStream = function(binaryDataBuffer) { this.binaryData = binaryDataBuffer; this.dataView = new DataView(this.binaryData); // data, byte offset this.currentPosition = 0; // ptr to current position in array /** * Returns a byte array trimmed to the maximum number of bytes written * to the stream. Eg, if we initialize with a 500 byte bufer, and we * only write 10 bytes to the output stream, this will return the first * ten bytes of the array. * * @returns {ArrayBuffer} Only the data written */ dis.OutputStream.prototype.toByteArray = function() { var trimmedData = this.binaryData.slice(0, this.currentPosition); return trimmedData; }; dis.OutputStream.prototype.writeUByte = function(userData) { this.dataView.setUint8(this.currentPosition, userData); this.currentPosition = this.currentPosition + 1; }; dis.OutputStream.prototype.writeByte = function(userData) { this.dataView.setInt8(this.currentPosition, userData); this.currentPosition = this.currentPosition + 1; }; dis.OutputStream.prototype.writeUShort = function(userData) { this.dataView.setUint16(this.currentPosition, userData); this.currentPosition = this.currentPosition + 2; }; dis.OutputStream.prototype.writeShort = function(userData) { this.dataView.setInt16(this.currentPosition, userData); this.currentPosition = this.currentPosition + 2; }; dis.OutputStream.prototype.writeUInt = function(userData) { this.dataView.setUint32(this.currentPosition, userData); this.currentPosition = this.currentPosition + 4; }; dis.OutputStream.prototype.writeInt = function(userData) { this.dataView.setInt32(this.currentPosition, userData); this.currentPosition = this.currentPosition + 4; }; dis.OutputStream.prototype.writeFloat32 = function(userData) { this.dataView.setFloat32(this.currentPosition, userData); this.currentPosition = this.currentPosition + 4; }; dis.OutputStream.prototype.writeFloat64 = function(userData) { this.dataView.setFloat64(this.currentPosition, userData); this.currentPosition = this.currentPosition + 8; }; dis.OutputStream.prototype.writeLong = function(userData) { console.log("Problem in dis.outputStream. Javascript cannot natively handle 64 bit ints"); console.log("writing 0, which is almost certainly wrong"); this.dataView.setInt32(this.currentPosition, 0); this.dataView.setInt32(this.currentPosition + 4, 0); this.currentPosition = this.currentPosition + 8; }; }; exports.OutputStream = dis.OutputStream; if (typeof dis === "undefined") dis = {}; // Support for node.js style modules; ignore if not using node.js require if (typeof exports === "undefined") exports = {}; /** * The PDU factory is responsible for decoding binary data and turning * it into the appropriate type of PDU. * * The websocket will typically send the web page a IEEE 1278.1 binary * array of data. It could be any one of dozens of PDUs. The start of * all PDUs is the same--they have the same header. One of the fields in * the header is the PduType, an 8 bit integer with a unqiue value for * each type of PDU. We have to peak at that value, decide what type * of PDU to create of the binary we have received, and then decode it. * * * @DMcG */ dis.PduFactory = function() { }; /** * decode incoming binary data and * return the correct type of PDU. * * @param {type} data the IEEE 1278.1 binary data * @returns {Pdu} Returns an instance of some PDU, be it espdu, fire, detonation, etc. Exception if PduType not known. */ dis.PduFactory.prototype.createPdu = function(data) { var asUint8Array = new Uint8Array(data); var pduType = asUint8Array[2]; var inputStream = new dis.InputStream(data); var newPdu = null; //try //{ switch(pduType) { case 1: // entity state PDU newPdu = new dis.EntityStatePdu(); newPdu.initFromBinary(inputStream); break; case 2: // Fire newPdu = new dis.FirePdu(); newPdu.initFromBinary(inputStream); break; case 3: // detonation newPdu = new dis.DetonationPdu(); newPdu.initFromBinary(inputStream); break; case 4: // Collision newPdu = new dis.CollisionPdu(); newPdu.initFromBinary(inputStream); break; case 11: // Create entity newPdu = new dis.CreateEntityPdu(); newPdu.initFromBinary(inputStream); break; case 12: // Remove entity newPdu = new dis.RemoveEntityPdu(); newPdu.initFromBinary(inputStream); break; case 20: // data newPdu = new dis.DataPdu(); newPdu.initFromBinary(inputStream); break; default: throw "PduType: " + pduType + " Unrecognized PDUType. Add PDU in dis.PduFactory."; } //} // This also picks up any errors decoding what we though was a "normal" PDU //catch(error) //{ // newPdu = null; //} return newPdu; }; dis.PduFactory.prototype.getPdusFromBundle = function(data) { } exports.PduFactory = dis.PduFactory; /** * Sets up a local tangent place (ENU) coordinate system at a given location * and altitude, and handles conversions between geodetic, ECEF, and local * tangent plane coordinate systems. * * For reference see "Conversion of Geodetic coordinates to the Local * Tangent Plane", version 2.01, * http://www.psas.pdx.edu/CoordinateSystem/Latitude_to_LocalTangent.pdf * * and "Geodetic Systems", * http://wiki.gis.com/wiki/index.php/Geodetic_system#From_geodetic_coordinates_to_local_ENU_coordinates * * There's also a bunch of ancient code from older versions that someone, somewhere, * lifted from a military handbook, originally written in C, translated to Java, * and now translated to Javascript. * * Terminology: * * ECEF: earth centered, earth fixed coordinate system, same as DIS. Cartesian, * origin at center of the earth, z through north pole, x out the equator and * prime meridian, y out equator and 90 deg east. This coordinate system rotates * with the earth, ie the x axis always points out the prime meridian and equator * even as the earth rotates. * * Geodetic: latitude, longitude, altitude. * * WGS84: Shape of the earth, an ellipsoid roughly, with a and b the semimajor and semiminor axes * * ENU: East, North, Up: local coordinate system with a given geodetic origin. Tangent * plane to the earth. * * All Errors mine * * @DMcG * * @param {float} lat latitude in degrees of the origin of the local tangent plane coordinate system * @param {float} lon longitude, in degrees, of origin * @param {float} alt altitude, in meters, of the origin of the local tangent plane coordinate system */ if (typeof dis === "undefined") dis = {}; // Support for node.js style modules; ignore if not using node.js require if (typeof exports === "undefined") exports = {}; /** Constructor, creates an object that can do coordinate systems conversions. * Takes a geodetic point that is the origin of a tangent plane to the surface * of the earth. This is useful for doing local simulation work. The local * coordinate system has postive x east, positive y north, and positive Z up, * aka an ENU coordinate system. Methods for converting from that coordinate system * to the DIS (ECEF) coordinate system or geotetic coordinate systems are provided. * * @param {type} lat latitude, in degrees, of where the local tangent plane is located * @param {type} lon longitude, in degrees, of the origin of the local tangent plane * @param {type} alt altitude, in meters, of the origin of the local tangent plane * @returns {RangeCoordinates} An object that can do coordinate system conversions */ dis.RangeCoordinates = function(lat, lon, alt) { this.RADIANS_PER_DEGREE = 2 * Math.PI / 360.0; this.DEGREES_PER_RADIAN = 360.0 / (2* Math.PI); /** WGS84 semimajor axis (constant) */ this.a = 6378137.0; /** WGS84 semiminor axis (constant) */ this.b = 6356752.3142; /** Ellipsoidal Flatness (constant) */ this.f = (this.a - this.b) / this.a; // Should be 3.3528107 X 10^-3 /** Eccentricity (constant) */ this.e = Math.sqrt(this.f * (2 - this.f)); // Should be 8.1819191 X 10^-2 // The origin of the local, East-North-Up (ENU) coordinate system, in lat/lon degrees and meters. this.ENUOrigin = {}; this.ENUOrigin.latitude = lat; this.ENUOrigin.longitude = lon; this.ENUOrigin.altitude = alt; // Find the origin of the ENU in earth-centered, earth-fixed ECEF aka DIS coordinates this.ENUOriginInECEF = {}; this.ENUOriginInECEF = this.latLonAltDegreesToECEF(lat, lon, alt); }; /** Determines N, the distance from a normal plane at the given * latitude to the Z-axis running through the center of the earth. * This is NOT the same as the distance to the center of the earth. * * @param {float} lambda the latitude, in radians. * @returns {float} distance in meters from the latitude to the axis of the earth */ dis.RangeCoordinates.prototype.N = function(lambda) { //N(lambda) = a / sqrt( 1 - e^2 * sin^2(lambda) ) var val = this.a / Math.sqrt(1- ( Math.pow(this.e, 2) * Math.pow( Math.sin(lambda), 2) ) ); return val; }; /** * Converts a latitude, longitude, and altitude object to DIS rectilinear * coordinates, aka earth-centered, earth-fixed, rectilinear. * * @param {latitude:longitude:altitude:} latLonAlt The lat/lon/alt, in degrees and meters * @returns {x, y, z} rectilienar coordinates in ECEF, aka DIS coordinates */ dis.RangeCoordinates.prototype.latLonAltDegreesObjectToECEF = function(latLonAlt) { return this.latLonAltDegreesToECEF(latLonAlt.latitude, latLonAlt.longitude, latLonAlt.altitude); }; /** * Converts a latitude, longitude, and altitude to DIS rectilinear * coordinates, aka earth-centered, earth-fixed, rectilinear. * * @param {float} latitude (in radians) * @param {float} longitude (in radians) * @param {float} altitude (in meters) * @returns {x, y, z} rectilienar coordinates in ECEF-r, aka DIS coordinates */ dis.RangeCoordinates.prototype.latLonAltRadiansToECEF = function(latitude, longitude, altitude) { /* // altitude corresponds to h in the paper, lambda to latitude, phi to longitude var x = (altitude + this.N(latitude)) * Math.cos(latitude) * Math.cos(longitude); var y = (altitude + this.N(latitude)) * Math.cos(latitude) * Math.sin(longitude); var z = (altitude + (1 - Math.pow(this.e, 2) ) * this.N(latitude)) * Math.sin(longitude); var coordinates = {}; coordinates.x = x; coordinates.y = y; coordinates.z = z; */ var cosLat = Math.cos(latitude); var sinLat = Math.sin(latitude); var rSubN = (this.a*this.a) / Math.sqrt(((this.a*this.a) * (cosLat*cosLat) + ((this.b*this.b) * (sinLat*sinLat)))); var X = (rSubN + altitude) * cosLat * Math.cos(longitude); var Y = (rSubN + altitude) * cosLat * Math.sin(longitude); var Z = ((((this.b*this.b) / (this.a*this.a)) * rSubN) + altitude) * sinLat; return {x:X, y:Y, z:Z}; }; /* * * @param {type} latitude in degrees * @param {type} longitude in degrees * @param {type} altitude in meters * @returns {x,y,z} coordinates in ECEF, in meters aka DIS global coordinates */ dis.RangeCoordinates.prototype.latLonAltDegreesToECEF = function(latitude, longitude, altitude) { return this.latLonAltRadiansToECEF(latitude * this.RADIANS_PER_DEGREE, longitude * this.RADIANS_PER_DEGREE, altitude); }; /** * Converts DIS xyz world coordinates to latitude and longitude (IN DEGREES). This algorithm may not be 100% accurate * near the poles. Uses WGS84 , though you can change the ellipsoid constants a and b if you want to use something * else. These formulas were obtained from Military Handbook 600008. The code itself has been * translated from C to Java to Javascript over the years, so hold onto your hats. (This is * copied from other sources than those listed above. Seems to work, though.) * * @param position {x:, y:, z:} * @return {latitude:, longitude: altitude:} */ dis.RangeCoordinates.prototype.ECEFObjectToLatLongAltInDegrees = function(position) { var x = position.x; var y = position.y; var z = position.z; var answer = []; answer[0] = 0.0; answer[1] = 0.0; answer[2] = 0.0; var a = this.a; // semi major axis (WGS 84) var b = this.b; //semi minor axis (WGS 84) var eSquared; //first eccentricity squared var rSubN; //radius of the curvature of the prime vertical var ePrimeSquared;//second eccentricity squared var W = Math.sqrt((x*x + y*y)); eSquared = (a*a - b*b) / (a*a); ePrimeSquared = (a*a - b*b) / (b*b); /** * Get the longitude. */ if(x >= 0 ) { answer[1] = Math.atan(y/x); } else if(x < 0 && y >= 0) { answer[1] = Math.atan(y/x) + Math.PI; } else { answer[1] = Math.atan(y/x) - Math.PI; } /** * Longitude calculation done. Now calculate latitude. * NOTE: The handbook mentions using the calculated phi (latitude) value to recalculate B * using tan B = (1-f) tan phi and then performing the entire calculation again to get more accurate values. * However, for terrestrial applications, one iteration is accurate to .1 millimeter on the surface of the * earth (Rapp, 1984, p.124), so one iteration is enough for our purposes */ var tanBZero = (a*z) / (b * W); var BZero = Math.atan((tanBZero)); var tanPhi = (z + (ePrimeSquared * b * (Math.pow(Math.sin(BZero), 3))) ) /(W - (a * eSquared * (Math.pow(Math.cos(BZero), 3)))); var phi = Math.atan(tanPhi); answer[0] = phi; /** * Latitude done, now get the elevation. Note: The handbook states that near the poles, it is preferable to use * h = (Z / sin phi ) - rSubN + (eSquared * rSubN). Our applications are never near the poles, so this formula * was left unimplemented. */ rSubN = (a*a) / Math.sqrt(((a*a) * (Math.cos(phi)*Math.cos(phi)) + ((b*b) * (Math.sin(phi)*Math.sin(phi))))); answer[2] = (W / Math.cos(phi)) - rSubN; var ld = answer[0] * this.DEGREES_PER_RADIAN; var lnd = answer[1] * this.DEGREES_PER_RADIAN; var result = {latitude:ld, longitude:lnd, altitude:answer[2]}; return result; }; /** * Converts an ECEF position to the local ENU coordinate system. Units are meters, * and the origin of the ENU coordinate system is set in the constructor. * * @param {x:y:z:} ecefPosition ecef position (in meters) * @returns {x:y:z:} object with x, y, and z local coordinates, ENU */ dis.RangeCoordinates.prototype.ECEFObjectToENU = function(ecefPosition) { return this.ECEFtoENU(ecefPosition.x, ecefPosition.y, ecefPosition.z); }; /** * Converts an ECEF position to the local ENU coordinate system. Units are meters, * and the origin of the ENU coordinate system is set in the constructor. * * @param {float} X the X coordinate of the ECEF position * @param {float} Y the Y coordinate * @param {float} Z the Z coordinate * @returns {x:y:z:} object with x, y, and z local coordinates, ENU */ dis.RangeCoordinates.prototype.ECEFtoENU = function(X, Y, Z) { // Origin of ENU tangent plane coordinate system in ECEF coordinate system var Xr = this.ENUOriginInECEF.x; var Yr = this.ENUOriginInECEF.y; var Zr = this.ENUOriginInECEF.z; var originLonRadians = this.ENUOrigin.longitude * this.RADIANS_PER_DEGREE; var originLatRadians = this.ENUOrigin.latitude * this.RADIANS_PER_DEGREE; e = -(Math.sin(originLonRadians)) * (X-Xr) + Math.cos(originLonRadians) * (Y-Yr); n = -(Math.sin(originLatRadians)) * Math.cos(originLonRadians) * (X-Xr) - Math.sin(originLatRadians) * Math.sin(originLonRadians) * (Y-Yr) + Math.cos(originLatRadians) * (Z-Zr); u = Math.cos(originLatRadians) * Math.cos(originLonRadians) * (X-Xr) + Math.cos(originLatRadians) * Math.sin(originLonRadians) * (Y-Yr) + Math.sin(originLatRadians) * (Z-Zr); // Local coordinate system x, y, z return {x:e, y:n, z:u}; }; /** * Converts a local coordinate system / ENU/ Local Tangent Plane object to ECEF, aka DIS coordinates. * * @param enuPosition {x:y:z:} local coordinate object * @returns {x:y:z:} point in ECEF / DIS coordinate system */ dis.RangeCoordinates.prototype.ENUObjectToECEF = function(enuPosition) { return this.ENUtoECEF(enuPosition.x, enuPosition.y, enuPosition.z); }; /** * Converts a local coordinate system / ENU/ Local Tangent Plane point to ECEF, aka DIS coordinates. * * @param localX {float} local coordinate system X * @param localY {float} local coordinate system Y * @param localZ {float} local coordinate system Z * @returns {x:y:z:} point in ECEF / DIS coordinate system */ dis.RangeCoordinates.prototype.ENUtoECEF = function(localX, localY, localZ) { // ENU local coordinate system origin, in ECEF var Xr = this.ENUOriginInECEF.x; var Yr = this.ENUOriginInECEF.y; var Zr = this.ENUOriginInECEF.z; var refLong = this.ENUOrigin.longitude; var refLat = this.ENUOrigin.latitude; /** original code this was copied from function [X, Y, Z] = enu2xyz(refLat, refLong, refH, e, n, u) % Convert east, north, up coordinates (labeled e, n, u) to ECEF % coordinates. The reference point (phi, lambda, h) must be given. All distances are in metres [Xr,Yr,Zr] = llh2xyz(refLat,refLong, refH); % location of reference point X = -sin(refLong)*e - cos(refLong)*sin(refLat)*n + cos(refLong)*cos(refLat)*u + Xr; Y = cos(refLong)*e - sin(refLong)*sin(refLat)*n + cos(refLat)*sin(refLong)*u + Yr; Z = cos(refLat)*n + sin(refLat)*u + Zr; */ X = -(Math.sin(refLong)) * localX - Math.cos(refLong) * Math.sin(refLat) * localY + Math.cos(refLong) * Math.cos(refLat) * localZ + Xr; Y = Math.cos(refLong) * localX - Math.sin(refLong) * Math.sin(refLat) * localY + Math.cos(refLat) * Math.sin(refLong) * localZ + Yr; Z = Math.cos(refLat) * localY + Math.sin(refLat) * localZ + Zr; return {x:X, y:Y, z:Z}; }; exports.RangeCoordinates = dis.RangeCoordinates;if (typeof dis === "undefined") dis = {}; // Support for node.js style modules; ignore if not using node.js require if (typeof exports === "undefined") exports = {}; /** * Utility class that converts between strings and the DIS ESPDU marking * field. The marking field is 12 bytes long, with the first byte being * the character set used, and the remaining 11 bytes character codes in * that character set. This is often used for debugging or "billboard" * displays in 3D; it's intended for humans. The string character values * are clamped (or filled) to exactly 11 bytes, so "This is a long string" * will be clamped to "This is a l" (in charachter codes) and "foo" will * be filled to "foo\0\0\0\0\0\0\0\0".<p> * * It is recommended that only ASCII character set (character set = 1) * be used. * * @returns {undefined} */ dis.StringConversion = function() { }; /** * Given a string, returns a DIS marking field. The character set is set to * 1, for ascii. The length is clamped to 11, and zero-filled if the string * is shorter than 11. * * @returns {array} disMarking field, 12 bytes long, character set = 1 (ascii) in 0, zero-filled to 11 character codes */ dis.StringConversion.prototype.StringToDisMarking = function(markingString) { var byteMarking = []; // character set 1 = ascii byteMarking.push(1); var markingLength = markingString.length; // Clamp it to 11 bytes of character data if(markingLength > 11) markingLength = 11; // If the string is shorter than 11 bytes, we zero-fill the array var diff = 11 - markingLength; for(var idx = 0; idx < markingLength; idx++) { byteMarking.push(markingString.charCodeAt(idx)); } for(var idx = markingLength; idx < 11; idx++) { byteMarking.push(0); } return byteMarking; }; /** * Given a DIS marking field, returns a string. Assumes always ascii. * * @param {array} disMarking dis marking field, [0] = character set, the rest character codes * @returns {string} string equivalent of the marking field */ dis.StringConversion.prototype.DisMarkingToString = function(disMarking) { var marking = ""; for(var idx = 1; idx < disMarking.length; idx++) { marking = marking + String.fromCharCode(disMarking[idx]); } return marking; }; // This is a temporary placeholder until full require.js code // support is present. if (typeof exports === "undefined") exports = {}; exports.RangeCoordinates = dis.RangeCoordinates; exports.InputStream = dis.InputStream; exports.OutputStream = dis.OutputStream; /** * Section 5.3.6.5. Acknowledge the receiptof a start/resume, stop/freeze, or RemoveEntityPDU. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.AcknowledgePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 15; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 5; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is sending message */ this.originatingEntityID = new dis.EntityID(); /** Entity that is intended to receive message */ this.receivingEntityID = new dis.EntityID(); /** type of message being acknowledged */ this.acknowledgeFlag = 0; /** Whether or not the receiving entity was able to comply with the request */ this.responseFlag = 0; /** Request ID that is unique */ this.requestID = 0; dis.AcknowledgePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.acknowledgeFlag = inputStream.readUShort(); this.responseFlag = inputStream.readUShort(); this.requestID = inputStream.readUInt(); }; dis.AcknowledgePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUShort(this.acknowledgeFlag); outputStream.writeUShort(this.responseFlag); outputStream.writeUInt(this.requestID); }; }; // end of class // node.js module support exports.AcknowledgePdu = dis.AcknowledgePdu; // End of AcknowledgePdu class /** * Section 5.3.12.5: Ack receipt of a start-resume, stop-freeze, create-entity or remove enitty (reliable) pdus. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.AcknowledgeReliablePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 55; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); /** ack flags */ this.acknowledgeFlag = 0; /** response flags */ this.responseFlag = 0; /** Request ID */ this.requestID = 0; dis.AcknowledgeReliablePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.acknowledgeFlag = inputStream.readUShort(); this.responseFlag = inputStream.readUShort(); this.requestID = inputStream.readUInt(); }; dis.AcknowledgeReliablePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUShort(this.acknowledgeFlag); outputStream.writeUShort(this.responseFlag); outputStream.writeUInt(this.requestID); }; }; // end of class // node.js module support exports.AcknowledgeReliablePdu = dis.AcknowledgeReliablePdu; // End of AcknowledgeReliablePdu class /** * Used in UA PDU * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.AcousticBeamData = function() { /** beam data length */ this.beamDataLength = 0; /** beamIDNumber */ this.beamIDNumber = 0; /** padding */ this.pad2 = 0; /** fundamental data parameters */ this.fundamentalDataParameters = new dis.AcousticBeamFundamentalParameter(); dis.AcousticBeamData.prototype.initFromBinary = function(inputStream) { this.beamDataLength = inputStream.readUShort(); this.beamIDNumber = inputStream.readUByte(); this.pad2 = inputStream.readUShort(); this.fundamentalDataParameters.initFromBinary(inputStream); }; dis.AcousticBeamData.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.beamDataLength); outputStream.writeUByte(this.beamIDNumber); outputStream.writeUShort(this.pad2); this.fundamentalDataParameters.encodeToBinary(outputStream); }; }; // end of class // node.js module support exports.AcousticBeamData = dis.AcousticBeamData; // End of AcousticBeamData class /** * Used in UaPdu * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.AcousticBeamFundamentalParameter = function() { /** parameter index */ this.activeEmissionParameterIndex = 0; /** scan pattern */ this.scanPattern = 0; /** beam center azimuth */ this.beamCenterAzimuth = 0; /** azimuthal beamwidth */ this.azimuthalBeamwidth = 0; /** beam center */ this.beamCenterDE = 0; /** DE beamwidth (vertical beamwidth) */ this.deBeamwidth = 0; dis.AcousticBeamFundamentalParameter.prototype.initFromBinary = function(inputStream) { this.activeEmissionParameterIndex = inputStream.readUShort(); this.scanPattern = inputStream.readUShort(); this.beamCenterAzimuth = inputStream.readFloat32(); this.azimuthalBeamwidth = inputStream.readFloat32(); this.beamCenterDE = inputStream.readFloat32(); this.deBeamwidth = inputStream.readFloat32(); }; dis.AcousticBeamFundamentalParameter.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.activeEmissionParameterIndex); outputStream.writeUShort(this.scanPattern); outputStream.writeFloat32(this.beamCenterAzimuth); outputStream.writeFloat32(this.azimuthalBeamwidth); outputStream.writeFloat32(this.beamCenterDE); outputStream.writeFloat32(this.deBeamwidth); }; }; // end of class // node.js module support exports.AcousticBeamFundamentalParameter = dis.AcousticBeamFundamentalParameter; // End of AcousticBeamFundamentalParameter class /** * Section 5.2.35. information about a specific UA emmtter * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.AcousticEmitter = function() { /** the system for a particular UA emitter, and an enumeration */ this.acousticName = 0; /** The function of the acoustic system */ this.function = 0; /** The UA emitter identification number relative to a specific system */ this.acousticIdNumber = 0; dis.AcousticEmitter.prototype.initFromBinary = function(inputStream) { this.acousticName = inputStream.readUShort(); this.function = inputStream.readUByte(); this.acousticIdNumber = inputStream.readUByte(); }; dis.AcousticEmitter.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.acousticName); outputStream.writeUByte(this.function); outputStream.writeUByte(this.acousticIdNumber); }; }; // end of class // node.js module support exports.AcousticEmitter = dis.AcousticEmitter; // End of AcousticEmitter class /** * 5.3.35: Information about a particular UA emitter shall be represented using an Acoustic Emitter System record. This record shall consist of three fields: Acoustic Name, Function, and Acoustic ID Number * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.AcousticEmitterSystem = function() { /** This field shall specify the system for a particular UA emitter. */ this.acousticName = 0; /** This field shall describe the function of the acoustic system. */ this.acousticFunction = 0; /** This field shall specify the UA emitter identification number relative to a specific system. This field shall be represented by an 8-bit unsigned integer. This field allows the differentiation of multiple systems on an entity, even if in some instances two or more of the systems may be identical UA emitter types. Numbering of systems shall begin with the value 1. */ this.acousticID = 0; dis.AcousticEmitterSystem.prototype.initFromBinary = function(inputStream) { this.acousticName = inputStream.readUShort(); this.acousticFunction = inputStream.readUByte(); this.acousticID = inputStream.readUByte(); }; dis.AcousticEmitterSystem.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.acousticName); outputStream.writeUByte(this.acousticFunction); outputStream.writeUByte(this.acousticID); }; }; // end of class // node.js module support exports.AcousticEmitterSystem = dis.AcousticEmitterSystem; // End of AcousticEmitterSystem class /** * Used in the UA pdu; ties together an emmitter and a location. This requires manual cleanup; the beam data should not be attached to each emitter system. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.AcousticEmitterSystemData = function() { /** Length of emitter system data */ this.emitterSystemDataLength = 0; /** Number of beams */ this.numberOfBeams = 0; /** padding */ this.pad2 = 0; /** This field shall specify the system for a particular UA emitter. */ this.acousticEmitterSystem = new dis.AcousticEmitterSystem(); /** Represents the location wrt the entity */ this.emitterLocation = new dis.Vector3Float(); /** For each beam in numberOfBeams, an emitter system. This is not right--the beam records need to be at the end of the PDU, rather than attached to each system. */ this.beamRecords = new Array(); dis.AcousticEmitterSystemData.prototype.initFromBinary = function(inputStream) { this.emitterSystemDataLength = inputStream.readUByte(); this.numberOfBeams = inputStream.readUByte(); this.pad2 = inputStream.readUShort(); this.acousticEmitterSystem.initFromBinary(inputStream); this.emitterLocation.initFromBinary(inputStream); for(var idx = 0; idx < this.numberOfBeams; idx++) { var anX = new dis.AcousticBeamData(); anX.initFromBinary(inputStream); this.beamRecords.push(anX); } }; dis.AcousticEmitterSystemData.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.emitterSystemDataLength); outputStream.writeUByte(this.numberOfBeams); outputStream.writeUShort(this.pad2); this.acousticEmitterSystem.encodeToBinary(outputStream); this.emitterLocation.encodeToBinary(outputStream); for(var idx = 0; idx < this.beamRecords.length; idx++) { beamRecords[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.AcousticEmitterSystemData = dis.AcousticEmitterSystemData; // End of AcousticEmitterSystemData class /** * Section 5.3.6.6. Request from simulation manager to an entity. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ActionRequestPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 16; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 5; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is sending message */ this.originatingEntityID = new dis.EntityID(); /** Entity that is intended to receive message */ this.receivingEntityID = new dis.EntityID(); /** Request ID that is unique */ this.requestID = 0; /** identifies the action being requested */ this.actionID = 0; /** Number of fixed datum records */ this.numberOfFixedDatumRecords = 0; /** Number of variable datum records */ this.numberOfVariableDatumRecords = 0; /** variable length list of fixed datums */ this.fixedDatums = new Array(); /** variable length list of variable length datums */ this.variableDatums = new Array(); dis.ActionRequestPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requestID = inputStream.readUInt(); this.actionID = inputStream.readUInt(); this.numberOfFixedDatumRecords = inputStream.readUInt(); this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfFixedDatumRecords; idx++) { var anX = new dis.FixedDatum(); anX.initFromBinary(inputStream); this.fixedDatums.push(anX); } for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.variableDatums.push(anX); } }; dis.ActionRequestPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.requestID); outputStream.writeUInt(this.actionID); outputStream.writeUInt(this.numberOfFixedDatumRecords); outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.fixedDatums.length; idx++) { fixedDatums[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.variableDatums.length; idx++) { variableDatums[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.ActionRequestPdu = dis.ActionRequestPdu; // End of ActionRequestPdu class /** * Section 5.3.12.6: request from a simulation manager to a managed entity to perform a specified action. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ActionRequestReliablePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 56; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); /** level of reliability service used for this transaction */ this.requiredReliabilityService = 0; /** padding */ this.pad1 = 0; /** padding */ this.pad2 = 0; /** request ID */ this.requestID = 0; /** request ID */ this.actionID = 0; /** Fixed datum record count */ this.numberOfFixedDatumRecords = 0; /** variable datum record count */ this.numberOfVariableDatumRecords = 0; /** Fixed datum records */ this.fixedDatumRecords = new Array(); /** Variable datum records */ this.variableDatumRecords = new Array(); dis.ActionRequestReliablePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requiredReliabilityService = inputStream.readUByte(); this.pad1 = inputStream.readUShort(); this.pad2 = inputStream.readUByte(); this.requestID = inputStream.readUInt(); this.actionID = inputStream.readUInt(); this.numberOfFixedDatumRecords = inputStream.readUInt(); this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfFixedDatumRecords; idx++) { var anX = new dis.FixedDatum(); anX.initFromBinary(inputStream); this.fixedDatumRecords.push(anX); } for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.variableDatumRecords.push(anX); } }; dis.ActionRequestReliablePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUByte(this.requiredReliabilityService); outputStream.writeUShort(this.pad1); outputStream.writeUByte(this.pad2); outputStream.writeUInt(this.requestID); outputStream.writeUInt(this.actionID); outputStream.writeUInt(this.numberOfFixedDatumRecords); outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.fixedDatumRecords.length; idx++) { fixedDatumRecords[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.variableDatumRecords.length; idx++) { variableDatumRecords[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.ActionRequestReliablePdu = dis.ActionRequestReliablePdu; // End of ActionRequestReliablePdu class /** * Section 5.3.6.7. response to an action request PDU. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ActionResponsePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 17; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 5; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is sending message */ this.originatingEntityID = new dis.EntityID(); /** Entity that is intended to receive message */ this.receivingEntityID = new dis.EntityID(); /** Request ID that is unique */ this.requestID = 0; /** Status of response */ this.requestStatus = 0; /** Number of fixed datum records */ this.numberOfFixedDatumRecords = 0; /** Number of variable datum records */ this.numberOfVariableDatumRecords = 0; /** variable length list of fixed datums */ this.fixedDatums = new Array(); /** variable length list of variable length datums */ this.variableDatums = new Array(); dis.ActionResponsePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requestID = inputStream.readUInt(); this.requestStatus = inputStream.readUInt(); this.numberOfFixedDatumRecords = inputStream.readUInt(); this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfFixedDatumRecords; idx++) { var anX = new dis.FixedDatum(); anX.initFromBinary(inputStream); this.fixedDatums.push(anX); } for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.variableDatums.push(anX); } }; dis.ActionResponsePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.requestID); outputStream.writeUInt(this.requestStatus); outputStream.writeUInt(this.numberOfFixedDatumRecords); outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.fixedDatums.length; idx++) { fixedDatums[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.variableDatums.length; idx++) { variableDatums[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.ActionResponsePdu = dis.ActionResponsePdu; // End of ActionResponsePdu class /** * Section 5.3.12.7: Response from an entity to an action request PDU. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ActionResponseReliablePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 57; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); /** request ID */ this.requestID = 0; /** status of response */ this.responseStatus = 0; /** Fixed datum record count */ this.numberOfFixedDatumRecords = 0; /** variable datum record count */ this.numberOfVariableDatumRecords = 0; /** Fixed datum records */ this.fixedDatumRecords = new Array(); /** Variable datum records */ this.variableDatumRecords = new Array(); dis.ActionResponseReliablePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requestID = inputStream.readUInt(); this.responseStatus = inputStream.readUInt(); this.numberOfFixedDatumRecords = inputStream.readUInt(); this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfFixedDatumRecords; idx++) { var anX = new dis.FixedDatum(); anX.initFromBinary(inputStream); this.fixedDatumRecords.push(anX); } for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.variableDatumRecords.push(anX); } }; dis.ActionResponseReliablePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.requestID); outputStream.writeUInt(this.responseStatus); outputStream.writeUInt(this.numberOfFixedDatumRecords); outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.fixedDatumRecords.length; idx++) { fixedDatumRecords[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.variableDatumRecords.length; idx++) { variableDatumRecords[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.ActionResponseReliablePdu = dis.ActionResponseReliablePdu; // End of ActionResponseReliablePdu class /** * Section 5.2.36. Each agregate in a given simulation app is given an aggregate identifier number unique for all other aggregates in that app and in that exercise. The id is valid for the duration of the the exercise. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.AggregateID = function() { /** The site ID */ this.site = 0; /** The application ID */ this.application = 0; /** the aggregate ID */ this.aggregateID = 0; dis.AggregateID.prototype.initFromBinary = function(inputStream) { this.site = inputStream.readUShort(); this.application = inputStream.readUShort(); this.aggregateID = inputStream.readUShort(); }; dis.AggregateID.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.site); outputStream.writeUShort(this.application); outputStream.writeUShort(this.aggregateID); }; }; // end of class // node.js module support exports.AggregateID = dis.AggregateID; // End of AggregateID class /** * Section 5.2.37. Specifies the character set used inthe first byte, followed by up to 31 characters of text data. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.AggregateMarking = function() { /** The character set */ this.characterSet = 0; /** The characters */ this.characters = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); dis.AggregateMarking.prototype.initFromBinary = function(inputStream) { this.characterSet = inputStream.readUByte(); for(var idx = 0; idx < 31; idx++) { this.characters[ idx ] = inputStream.readByte(); } }; dis.AggregateMarking.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.characterSet); for(var idx = 0; idx < 31; idx++) { outputStream.writeByte(this.characters[ idx ] ); } }; }; // end of class // node.js module support exports.AggregateMarking = dis.AggregateMarking; // End of AggregateMarking class /** * Section 5.3.9.1 informationa bout aggregating entities anc communicating information about the aggregated entities. requires manual intervention to fix the padding between entityID lists and silent aggregate sysem lists--this padding is dependent on how many entityIDs there are, and needs to be on a 32 bit word boundary. UNFINISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.AggregateStatePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 33; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 7; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of aggregated entities */ this.aggregateID = new dis.EntityID(); /** force ID */ this.forceID = 0; /** state of aggregate */ this.aggregateState = 0; /** entity type of the aggregated entities */ this.aggregateType = new dis.EntityType(); /** formation of aggregated entities */ this.formation = 0; /** marking for aggregate; first char is charset type, rest is char data */ this.aggregateMarking = new dis.AggregateMarking(); /** dimensions of bounding box for the aggregated entities, origin at the center of mass */ this.dimensions = new dis.Vector3Float(); /** orientation of the bounding box */ this.orientation = new dis.Orientation(); /** center of mass of the aggregation */ this.centerOfMass = new dis.Vector3Double(); /** velocity of aggregation */ this.velocity = new dis.Vector3Float(); /** number of aggregates */ this.numberOfDisAggregates = 0; /** number of entities */ this.numberOfDisEntities = 0; /** number of silent aggregate types */ this.numberOfSilentAggregateTypes = 0; /** number of silent entity types */ this.numberOfSilentEntityTypes = 0; /** aggregates list */ this.aggregateIDList = new Array(); /** entity ID list */ this.entityIDList = new Array(); /** ^^^padding to put the start of the next list on a 32 bit boundary. This needs to be fixed */ this.pad2 = 0; /** silent entity types */ this.silentAggregateSystemList = new Array(); /** silent entity types */ this.silentEntitySystemList = new Array(); /** number of variable datum records */ this.numberOfVariableDatumRecords = 0; /** variableDatums */ this.variableDatumList = new Array(); dis.AggregateStatePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.aggregateID.initFromBinary(inputStream); this.forceID = inputStream.readUByte(); this.aggregateState = inputStream.readUByte(); this.aggregateType.initFromBinary(inputStream); this.formation = inputStream.readUInt(); this.aggregateMarking.initFromBinary(inputStream); this.dimensions.initFromBinary(inputStream); this.orientation.initFromBinary(inputStream); this.centerOfMass.initFromBinary(inputStream); this.velocity.initFromBinary(inputStream); this.numberOfDisAggregates = inputStream.readUShort(); this.numberOfDisEntities = inputStream.readUShort(); this.numberOfSilentAggregateTypes = inputStream.readUShort(); this.numberOfSilentEntityTypes = inputStream.readUShort(); for(var idx = 0; idx < this.numberOfDisAggregates; idx++) { var anX = new dis.AggregateID(); anX.initFromBinary(inputStream); this.aggregateIDList.push(anX); } for(var idx = 0; idx < this.numberOfDisEntities; idx++) { var anX = new dis.EntityID(); anX.initFromBinary(inputStream); this.entityIDList.push(anX); } this.pad2 = inputStream.readUByte(); for(var idx = 0; idx < this.numberOfSilentAggregateTypes; idx++) { var anX = new dis.EntityType(); anX.initFromBinary(inputStream); this.silentAggregateSystemList.push(anX); } for(var idx = 0; idx < this.numberOfSilentEntityTypes; idx++) { var anX = new dis.EntityType(); anX.initFromBinary(inputStream); this.silentEntitySystemList.push(anX); } this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.variableDatumList.push(anX); } }; dis.AggregateStatePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.aggregateID.encodeToBinary(outputStream); outputStream.writeUByte(this.forceID); outputStream.writeUByte(this.aggregateState); this.aggregateType.encodeToBinary(outputStream); outputStream.writeUInt(this.formation); this.aggregateMarking.encodeToBinary(outputStream); this.dimensions.encodeToBinary(outputStream); this.orientation.encodeToBinary(outputStream); this.centerOfMass.encodeToBinary(outputStream); this.velocity.encodeToBinary(outputStream); outputStream.writeUShort(this.numberOfDisAggregates); outputStream.writeUShort(this.numberOfDisEntities); outputStream.writeUShort(this.numberOfSilentAggregateTypes); outputStream.writeUShort(this.numberOfSilentEntityTypes); for(var idx = 0; idx < this.aggregateIDList.length; idx++) { aggregateIDList[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.entityIDList.length; idx++) { entityIDList[idx].encodeToBinary(outputStream); } outputStream.writeUByte(this.pad2); for(var idx = 0; idx < this.silentAggregateSystemList.length; idx++) { silentAggregateSystemList[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.silentEntitySystemList.length; idx++) { silentEntitySystemList[idx].encodeToBinary(outputStream); } outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.variableDatumList.length; idx++) { variableDatumList[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.AggregateStatePdu = dis.AggregateStatePdu; // End of AggregateStatePdu class /** * Section 5.2.38. Identifies the type of aggregate including kind of entity, domain (surface, subsurface, air, etc) country, category, etc. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.AggregateType = function() { /** Kind of entity */ this.aggregateKind = 0; /** Domain of entity (air, surface, subsurface, space, etc) */ this.domain = 0; /** country to which the design of the entity is attributed */ this.country = 0; /** category of entity */ this.category = 0; /** subcategory of entity */ this.subcategory = 0; /** specific info based on subcategory field, sql has a reserved word for specific */ this.specificInfo = 0; this.extra = 0; dis.AggregateType.prototype.initFromBinary = function(inputStream) { this.aggregateKind = inputStream.readUByte(); this.domain = inputStream.readUByte(); this.country = inputStream.readUShort(); this.category = inputStream.readUByte(); this.subcategory = inputStream.readUByte(); this.specificInfo = inputStream.readUByte(); this.extra = inputStream.readUByte(); }; dis.AggregateType.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.aggregateKind); outputStream.writeUByte(this.domain); outputStream.writeUShort(this.country); outputStream.writeUByte(this.category); outputStream.writeUByte(this.subcategory); outputStream.writeUByte(this.specificInfo); outputStream.writeUByte(this.extra); }; }; // end of class // node.js module support exports.AggregateType = dis.AggregateType; // End of AggregateType class /** * 5.2.2: angular velocity measured in radians per second out each of the entity's own coordinate axes. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.AngularVelocityVector = function() { /** velocity about the x axis */ this.x = 0; /** velocity about the y axis */ this.y = 0; /** velocity about the zaxis */ this.z = 0; dis.AngularVelocityVector.prototype.initFromBinary = function(inputStream) { this.x = inputStream.readFloat32(); this.y = inputStream.readFloat32(); this.z = inputStream.readFloat32(); }; dis.AngularVelocityVector.prototype.encodeToBinary = function(outputStream) { outputStream.writeFloat32(this.x); outputStream.writeFloat32(this.y); outputStream.writeFloat32(this.z); }; }; // end of class // node.js module support exports.AngularVelocityVector = dis.AngularVelocityVector; // End of AngularVelocityVector class /** * 5.2.3: location of the radiating portion of the antenna, specified in world coordinates and entity coordinates. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.AntennaLocation = function() { /** Location of the radiating portion of the antenna in world coordinates */ this.antennaLocation = new dis.Vector3Double(); /** Location of the radiating portion of the antenna in entity coordinates */ this.relativeAntennaLocation = new dis.Vector3Float(); dis.AntennaLocation.prototype.initFromBinary = function(inputStream) { this.antennaLocation.initFromBinary(inputStream); this.relativeAntennaLocation.initFromBinary(inputStream); }; dis.AntennaLocation.prototype.encodeToBinary = function(outputStream) { this.antennaLocation.encodeToBinary(outputStream); this.relativeAntennaLocation.encodeToBinary(outputStream); }; }; // end of class // node.js module support exports.AntennaLocation = dis.AntennaLocation; // End of AntennaLocation class /** * Used in UA PDU * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ApaData = function() { /** Index of APA parameter */ this.parameterIndex = 0; /** Index of APA parameter */ this.parameterValue = 0; dis.ApaData.prototype.initFromBinary = function(inputStream) { this.parameterIndex = inputStream.readUShort(); this.parameterValue = inputStream.readShort(); }; dis.ApaData.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.parameterIndex); outputStream.writeShort(this.parameterValue); }; }; // end of class // node.js module support exports.ApaData = dis.ApaData; // End of ApaData class /** * Section 5.3.11.5: Information about the addition/modification of an oobject that is geometrically achored to the terrain with a set of three or more points that come to a closure. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ArealObjectStatePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 45; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 9; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object in synthetic environment */ this.objectID = new dis.EntityID(); /** Object with which this point object is associated */ this.referencedObjectID = new dis.EntityID(); /** unique update number of each state transition of an object */ this.updateNumber = 0; /** force ID */ this.forceID = 0; /** modifications enumeration */ this.modifications = 0; /** Object type */ this.objectType = new dis.EntityType(); /** Object appearance */ this.objectAppearance = new dis.SixByteChunk(); /** Number of points */ this.numberOfPoints = 0; /** requesterID */ this.requesterID = new dis.SimulationAddress(); /** receiver ID */ this.receivingID = new dis.SimulationAddress(); /** location of object */ this.objectLocation = new Array(); dis.ArealObjectStatePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.objectID.initFromBinary(inputStream); this.referencedObjectID.initFromBinary(inputStream); this.updateNumber = inputStream.readUShort(); this.forceID = inputStream.readUByte(); this.modifications = inputStream.readUByte(); this.objectType.initFromBinary(inputStream); this.objectAppearance.initFromBinary(inputStream); this.numberOfPoints = inputStream.readUShort(); this.requesterID.initFromBinary(inputStream); this.receivingID.initFromBinary(inputStream); for(var idx = 0; idx < this.numberOfPoints; idx++) { var anX = new dis.Vector3Double(); anX.initFromBinary(inputStream); this.objectLocation.push(anX); } }; dis.ArealObjectStatePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.objectID.encodeToBinary(outputStream); this.referencedObjectID.encodeToBinary(outputStream); outputStream.writeUShort(this.updateNumber); outputStream.writeUByte(this.forceID); outputStream.writeUByte(this.modifications); this.objectType.encodeToBinary(outputStream); this.objectAppearance.encodeToBinary(outputStream); outputStream.writeUShort(this.numberOfPoints); this.requesterID.encodeToBinary(outputStream); this.receivingID.encodeToBinary(outputStream); for(var idx = 0; idx < this.objectLocation.length; idx++) { objectLocation[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.ArealObjectStatePdu = dis.ArealObjectStatePdu; // End of ArealObjectStatePdu class /** * Section 5.2.5. Articulation parameters for movable parts and attached parts of an entity. Specifes wether or not a change has occured, the part identifcation of the articulated part to which it is attached, and the type and value of each parameter. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ArticulationParameter = function() { this.parameterTypeDesignator = 0; this.changeIndicator = 0; this.partAttachedTo = 0; this.parameterType = 0; this.parameterValue = 0; dis.ArticulationParameter.prototype.initFromBinary = function(inputStream) { this.parameterTypeDesignator = inputStream.readUByte(); this.changeIndicator = inputStream.readUByte(); this.partAttachedTo = inputStream.readUShort(); this.parameterType = inputStream.readInt(); this.parameterValue = inputStream.readFloat64(); }; dis.ArticulationParameter.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.parameterTypeDesignator); outputStream.writeUByte(this.changeIndicator); outputStream.writeUShort(this.partAttachedTo); outputStream.writeInt(this.parameterType); outputStream.writeFloat64(this.parameterValue); }; }; // end of class // node.js module support exports.ArticulationParameter = dis.ArticulationParameter; // End of ArticulationParameter class /** * Section 5.2.4.2. Used when the antenna pattern type field has a value of 1. Specifies the direction, patter, and polarization of radiation from an antenna. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.BeamAntennaPattern = function() { /** The rotation that transformst he reference coordinate sytem into the beam coordinate system. Either world coordinates or entity coordinates may be used as the reference coordinate system, as specified by teh reference system field of the antenna pattern record. */ this.beamDirection = new dis.Orientation(); this.azimuthBeamwidth = 0; this.elevationBeamwidth = 0; this.referenceSystem = 0; this.padding1 = 0; this.padding2 = 0; /** Magnigute of the z-component in beam coordinates at some arbitrary single point in the mainbeam and in the far field of the antenna. */ this.ez = 0; /** Magnigute of the x-component in beam coordinates at some arbitrary single point in the mainbeam and in the far field of the antenna. */ this.ex = 0; /** THe phase angle between Ez and Ex in radians. */ this.phase = 0; dis.BeamAntennaPattern.prototype.initFromBinary = function(inputStream) { this.beamDirection.initFromBinary(inputStream); this.azimuthBeamwidth = inputStream.readFloat32(); this.elevationBeamwidth = inputStream.readFloat32(); this.referenceSystem = inputStream.readFloat32(); this.padding1 = inputStream.readShort(); this.padding2 = inputStream.readByte(); this.ez = inputStream.readFloat32(); this.ex = inputStream.readFloat32(); this.phase = inputStream.readFloat32(); }; dis.BeamAntennaPattern.prototype.encodeToBinary = function(outputStream) { this.beamDirection.encodeToBinary(outputStream); outputStream.writeFloat32(this.azimuthBeamwidth); outputStream.writeFloat32(this.elevationBeamwidth); outputStream.writeFloat32(this.referenceSystem); outputStream.writeShort(this.padding1); outputStream.writeByte(this.padding2); outputStream.writeFloat32(this.ez); outputStream.writeFloat32(this.ex); outputStream.writeFloat32(this.phase); }; }; // end of class // node.js module support exports.BeamAntennaPattern = dis.BeamAntennaPattern; // End of BeamAntennaPattern class /** * Section 5.2.39. Specification of the data necessary to describe the scan volume of an emitter. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.BeamData = function() { /** Specifies the beam azimuth an elevation centers and corresponding half-angles to describe the scan volume */ this.beamAzimuthCenter = 0; /** Specifies the beam azimuth sweep to determine scan volume */ this.beamAzimuthSweep = 0; /** Specifies the beam elevation center to determine scan volume */ this.beamElevationCenter = 0; /** Specifies the beam elevation sweep to determine scan volume */ this.beamElevationSweep = 0; /** allows receiver to synchronize its regenerated scan pattern to that of the emmitter. Specifies the percentage of time a scan is through its pattern from its origion. */ this.beamSweepSync = 0; dis.BeamData.prototype.initFromBinary = function(inputStream) { this.beamAzimuthCenter = inputStream.readFloat32(); this.beamAzimuthSweep = inputStream.readFloat32(); this.beamElevationCenter = inputStream.readFloat32(); this.beamElevationSweep = inputStream.readFloat32(); this.beamSweepSync = inputStream.readFloat32(); }; dis.BeamData.prototype.encodeToBinary = function(outputStream) { outputStream.writeFloat32(this.beamAzimuthCenter); outputStream.writeFloat32(this.beamAzimuthSweep); outputStream.writeFloat32(this.beamElevationCenter); outputStream.writeFloat32(this.beamElevationSweep); outputStream.writeFloat32(this.beamSweepSync); }; }; // end of class // node.js module support exports.BeamData = dis.BeamData; // End of BeamData class /** * Section 5.2.7. Specifies the type of muntion fired, the type of warhead, the type of fuse, the number of rounds fired, and the rate at which the roudns are fired in rounds per minute. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.BurstDescriptor = function() { /** What munition was used in the burst */ this.munition = new dis.EntityType(); /** type of warhead */ this.warhead = 0; /** type of fuse used */ this.fuse = 0; /** how many of the munition were fired */ this.quantity = 0; /** rate at which the munition was fired */ this.rate = 0; dis.BurstDescriptor.prototype.initFromBinary = function(inputStream) { this.munition.initFromBinary(inputStream); this.warhead = inputStream.readUShort(); this.fuse = inputStream.readUShort(); this.quantity = inputStream.readUShort(); this.rate = inputStream.readUShort(); }; dis.BurstDescriptor.prototype.encodeToBinary = function(outputStream) { this.munition.encodeToBinary(outputStream); outputStream.writeUShort(this.warhead); outputStream.writeUShort(this.fuse); outputStream.writeUShort(this.quantity); outputStream.writeUShort(this.rate); }; }; // end of class // node.js module support exports.BurstDescriptor = dis.BurstDescriptor; // End of BurstDescriptor class /** * Section 5.2.8. Time measurements that exceed one hour. Hours is the number of hours since January 1, 1970, UTC * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ClockTime = function() { /** Hours in UTC */ this.hour = 0; /** Time past the hour */ this.timePastHour = 0; dis.ClockTime.prototype.initFromBinary = function(inputStream) { this.hour = inputStream.readInt(); this.timePastHour = inputStream.readUInt(); }; dis.ClockTime.prototype.encodeToBinary = function(outputStream) { outputStream.writeInt(this.hour); outputStream.writeUInt(this.timePastHour); }; }; // end of class // node.js module support exports.ClockTime = dis.ClockTime; // End of ClockTime class /** * 5.3.3.3. Information about elastic collisions in a DIS exercise shall be communicated using a Collision-Elastic PDU. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.CollisionElasticPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 66; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 1; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of the entity that issued the collision PDU */ this.issuingEntityID = new dis.EntityID(); /** ID of entity that has collided with the issuing entity ID */ this.collidingEntityID = new dis.EntityID(); /** ID of event */ this.collisionEventID = new dis.EventID(); /** some padding */ this.pad = 0; /** velocity at collision */ this.contactVelocity = new dis.Vector3Float(); /** mass of issuing entity */ this.mass = 0; /** Location with respect to entity the issuing entity collided with */ this.location = new dis.Vector3Float(); /** tensor values */ this.collisionResultXX = 0; /** tensor values */ this.collisionResultXY = 0; /** tensor values */ this.collisionResultXZ = 0; /** tensor values */ this.collisionResultYY = 0; /** tensor values */ this.collisionResultYZ = 0; /** tensor values */ this.collisionResultZZ = 0; /** This record shall represent the normal vector to the surface at the point of collision detection. The surface normal shall be represented in world coordinates. */ this.unitSurfaceNormal = new dis.Vector3Float(); /** This field shall represent the degree to which energy is conserved in a collision */ this.coefficientOfRestitution = 0; dis.CollisionElasticPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.issuingEntityID.initFromBinary(inputStream); this.collidingEntityID.initFromBinary(inputStream); this.collisionEventID.initFromBinary(inputStream); this.pad = inputStream.readShort(); this.contactVelocity.initFromBinary(inputStream); this.mass = inputStream.readFloat32(); this.location.initFromBinary(inputStream); this.collisionResultXX = inputStream.readFloat32(); this.collisionResultXY = inputStream.readFloat32(); this.collisionResultXZ = inputStream.readFloat32(); this.collisionResultYY = inputStream.readFloat32(); this.collisionResultYZ = inputStream.readFloat32(); this.collisionResultZZ = inputStream.readFloat32(); this.unitSurfaceNormal.initFromBinary(inputStream); this.coefficientOfRestitution = inputStream.readFloat32(); }; dis.CollisionElasticPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.issuingEntityID.encodeToBinary(outputStream); this.collidingEntityID.encodeToBinary(outputStream); this.collisionEventID.encodeToBinary(outputStream); outputStream.writeShort(this.pad); this.contactVelocity.encodeToBinary(outputStream); outputStream.writeFloat32(this.mass); this.location.encodeToBinary(outputStream); outputStream.writeFloat32(this.collisionResultXX); outputStream.writeFloat32(this.collisionResultXY); outputStream.writeFloat32(this.collisionResultXZ); outputStream.writeFloat32(this.collisionResultYY); outputStream.writeFloat32(this.collisionResultYZ); outputStream.writeFloat32(this.collisionResultZZ); this.unitSurfaceNormal.encodeToBinary(outputStream); outputStream.writeFloat32(this.coefficientOfRestitution); }; }; // end of class // node.js module support exports.CollisionElasticPdu = dis.CollisionElasticPdu; // End of CollisionElasticPdu class /** * Section 5.3.3.2. Information about a collision. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.CollisionPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 4; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 1; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of the entity that issued the collision PDU */ this.issuingEntityID = new dis.EntityID(); /** ID of entity that has collided with the issuing entity ID */ this.collidingEntityID = new dis.EntityID(); /** ID of event */ this.eventID = new dis.EventID(); /** ID of event */ this.collisionType = 0; /** some padding */ this.pad = 0; /** velocity at collision */ this.velocity = new dis.Vector3Float(); /** mass of issuing entity */ this.mass = 0; /** Location with respect to entity the issuing entity collided with */ this.location = new dis.Vector3Float(); dis.CollisionPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.issuingEntityID.initFromBinary(inputStream); this.collidingEntityID.initFromBinary(inputStream); this.eventID.initFromBinary(inputStream); this.collisionType = inputStream.readUByte(); this.pad = inputStream.readByte(); this.velocity.initFromBinary(inputStream); this.mass = inputStream.readFloat32(); this.location.initFromBinary(inputStream); }; dis.CollisionPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.issuingEntityID.encodeToBinary(outputStream); this.collidingEntityID.encodeToBinary(outputStream); this.eventID.encodeToBinary(outputStream); outputStream.writeUByte(this.collisionType); outputStream.writeByte(this.pad); this.velocity.encodeToBinary(outputStream); outputStream.writeFloat32(this.mass); this.location.encodeToBinary(outputStream); }; }; // end of class // node.js module support exports.CollisionPdu = dis.CollisionPdu; // End of CollisionPdu class /** * Section 5.3.6.12. Arbitrary messages can be entered into the data stream via use of this PDU. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.CommentPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 22; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 5; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is sending message */ this.originatingEntityID = new dis.EntityID(); /** Entity that is intended to receive message */ this.receivingEntityID = new dis.EntityID(); /** Number of fixed datum records */ this.numberOfFixedDatumRecords = 0; /** Number of variable datum records */ this.numberOfVariableDatumRecords = 0; /** variable length list of fixed datums */ this.fixedDatums = new Array(); /** variable length list of variable length datums */ this.variableDatums = new Array(); dis.CommentPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.numberOfFixedDatumRecords = inputStream.readUInt(); this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfFixedDatumRecords; idx++) { var anX = new dis.FixedDatum(); anX.initFromBinary(inputStream); this.fixedDatums.push(anX); } for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.variableDatums.push(anX); } }; dis.CommentPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.numberOfFixedDatumRecords); outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.fixedDatums.length; idx++) { fixedDatums[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.variableDatums.length; idx++) { variableDatums[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.CommentPdu = dis.CommentPdu; // End of CommentPdu class /** * Section 5.3.12.12: Arbitrary messages. Only reliable this time. Neds manual intervention to fix padding in variable datums. UNFINISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.CommentReliablePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 62; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); /** Fixed datum record count */ this.numberOfFixedDatumRecords = 0; /** variable datum record count */ this.numberOfVariableDatumRecords = 0; /** Fixed datum records */ this.fixedDatumRecords = new Array(); /** Variable datum records */ this.variableDatumRecords = new Array(); dis.CommentReliablePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.numberOfFixedDatumRecords = inputStream.readUInt(); this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfFixedDatumRecords; idx++) { var anX = new dis.FixedDatum(); anX.initFromBinary(inputStream); this.fixedDatumRecords.push(anX); } for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.variableDatumRecords.push(anX); } }; dis.CommentReliablePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.numberOfFixedDatumRecords); outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.fixedDatumRecords.length; idx++) { fixedDatumRecords[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.variableDatumRecords.length; idx++) { variableDatumRecords[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.CommentReliablePdu = dis.CommentReliablePdu; // End of CommentReliablePdu class /** * Section 5.3.6.1. Create a new entity. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.CreateEntityPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 11; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 5; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is sending message */ this.originatingEntityID = new dis.EntityID(); /** Entity that is intended to receive message */ this.receivingEntityID = new dis.EntityID(); /** Identifier for the request */ this.requestID = 0; dis.CreateEntityPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requestID = inputStream.readUInt(); }; dis.CreateEntityPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.requestID); }; }; // end of class // node.js module support exports.CreateEntityPdu = dis.CreateEntityPdu; // End of CreateEntityPdu class /** * Section 5.3.12.1: creation of an entity , reliable. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.CreateEntityReliablePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 51; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); /** level of reliability service used for this transaction */ this.requiredReliabilityService = 0; /** padding */ this.pad1 = 0; /** padding */ this.pad2 = 0; /** Request ID */ this.requestID = 0; dis.CreateEntityReliablePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requiredReliabilityService = inputStream.readUByte(); this.pad1 = inputStream.readUShort(); this.pad2 = inputStream.readUByte(); this.requestID = inputStream.readUInt(); }; dis.CreateEntityReliablePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUByte(this.requiredReliabilityService); outputStream.writeUShort(this.pad1); outputStream.writeUByte(this.pad2); outputStream.writeUInt(this.requestID); }; }; // end of class // node.js module support exports.CreateEntityReliablePdu = dis.CreateEntityReliablePdu; // End of CreateEntityReliablePdu class /** * Section 5.3.6.10. Information issued in response to a data query pdu or a set data pdu is communicated using a data pdu. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.DataPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 20; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 5; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is sending message */ this.originatingEntityID = new dis.EntityID(); /** Entity that is intended to receive message */ this.receivingEntityID = new dis.EntityID(); /** ID of request */ this.requestID = 0; /** padding */ this.padding1 = 0; /** Number of fixed datum records */ this.numberOfFixedDatumRecords = 0; /** Number of variable datum records */ this.numberOfVariableDatumRecords = 0; /** variable length list of fixed datums */ this.fixedDatums = new Array(); /** variable length list of variable length datums */ this.variableDatums = new Array(); dis.DataPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requestID = inputStream.readUInt(); this.padding1 = inputStream.readUInt(); this.numberOfFixedDatumRecords = inputStream.readUInt(); this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfFixedDatumRecords; idx++) { var anX = new dis.FixedDatum(); anX.initFromBinary(inputStream); this.fixedDatums.push(anX); } for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.variableDatums.push(anX); } }; dis.DataPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.requestID); outputStream.writeUInt(this.padding1); outputStream.writeUInt(this.numberOfFixedDatumRecords); outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.fixedDatums.length; idx++) { fixedDatums[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.variableDatums.length; idx++) { variableDatums[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.DataPdu = dis.DataPdu; // End of DataPdu class /** * Section 5.3.6.8. Request for data from an entity. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.DataQueryPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 18; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 5; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is sending message */ this.originatingEntityID = new dis.EntityID(); /** Entity that is intended to receive message */ this.receivingEntityID = new dis.EntityID(); /** ID of request */ this.requestID = 0; /** time issues between issues of Data PDUs. Zero means send once only. */ this.timeInterval = 0; /** Number of fixed datum records */ this.numberOfFixedDatumRecords = 0; /** Number of variable datum records */ this.numberOfVariableDatumRecords = 0; /** variable length list of fixed datums */ this.fixedDatums = new Array(); /** variable length list of variable length datums */ this.variableDatums = new Array(); dis.DataQueryPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requestID = inputStream.readUInt(); this.timeInterval = inputStream.readUInt(); this.numberOfFixedDatumRecords = inputStream.readUInt(); this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfFixedDatumRecords; idx++) { var anX = new dis.UnsignedIntegerWrapper(); anX.initFromBinary(inputStream); this.fixedDatums.push(anX); } for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.UnsignedIntegerWrapper(); anX.initFromBinary(inputStream); this.variableDatums.push(anX); } }; dis.DataQueryPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.requestID); outputStream.writeUInt(this.timeInterval); outputStream.writeUInt(this.numberOfFixedDatumRecords); outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.fixedDatums.length; idx++) { fixedDatums[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.variableDatums.length; idx++) { variableDatums[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.DataQueryPdu = dis.DataQueryPdu; // End of DataQueryPdu class /** * Section 5.3.12.8: request for data from an entity. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.DataQueryReliablePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 58; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); /** level of reliability service used for this transaction */ this.requiredReliabilityService = 0; /** padding */ this.pad1 = 0; /** padding */ this.pad2 = 0; /** request ID */ this.requestID = 0; /** time interval between issuing data query PDUs */ this.timeInterval = 0; /** Fixed datum record count */ this.numberOfFixedDatumRecords = 0; /** variable datum record count */ this.numberOfVariableDatumRecords = 0; /** Fixed datum records */ this.fixedDatumRecords = new Array(); /** Variable datum records */ this.variableDatumRecords = new Array(); dis.DataQueryReliablePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requiredReliabilityService = inputStream.readUByte(); this.pad1 = inputStream.readUShort(); this.pad2 = inputStream.readUByte(); this.requestID = inputStream.readUInt(); this.timeInterval = inputStream.readUInt(); this.numberOfFixedDatumRecords = inputStream.readUInt(); this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfFixedDatumRecords; idx++) { var anX = new dis.FixedDatum(); anX.initFromBinary(inputStream); this.fixedDatumRecords.push(anX); } for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.variableDatumRecords.push(anX); } }; dis.DataQueryReliablePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUByte(this.requiredReliabilityService); outputStream.writeUShort(this.pad1); outputStream.writeUByte(this.pad2); outputStream.writeUInt(this.requestID); outputStream.writeUInt(this.timeInterval); outputStream.writeUInt(this.numberOfFixedDatumRecords); outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.fixedDatumRecords.length; idx++) { fixedDatumRecords[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.variableDatumRecords.length; idx++) { variableDatumRecords[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.DataQueryReliablePdu = dis.DataQueryReliablePdu; // End of DataQueryReliablePdu class /** * Section 5.3.12.10: issued in response to a data query R or set dataR pdu. Needs manual intervention to fix padding on variable datums. UNFINSIHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.DataReliablePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 60; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); /** Request ID */ this.requestID = 0; /** level of reliability service used for this transaction */ this.requiredReliabilityService = 0; /** padding */ this.pad1 = 0; /** padding */ this.pad2 = 0; /** Fixed datum record count */ this.numberOfFixedDatumRecords = 0; /** variable datum record count */ this.numberOfVariableDatumRecords = 0; /** Fixed datum records */ this.fixedDatumRecords = new Array(); /** Variable datum records */ this.variableDatumRecords = new Array(); dis.DataReliablePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requestID = inputStream.readUInt(); this.requiredReliabilityService = inputStream.readUByte(); this.pad1 = inputStream.readUShort(); this.pad2 = inputStream.readUByte(); this.numberOfFixedDatumRecords = inputStream.readUInt(); this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfFixedDatumRecords; idx++) { var anX = new dis.FixedDatum(); anX.initFromBinary(inputStream); this.fixedDatumRecords.push(anX); } for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.variableDatumRecords.push(anX); } }; dis.DataReliablePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.requestID); outputStream.writeUByte(this.requiredReliabilityService); outputStream.writeUShort(this.pad1); outputStream.writeUByte(this.pad2); outputStream.writeUInt(this.numberOfFixedDatumRecords); outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.fixedDatumRecords.length; idx++) { fixedDatumRecords[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.variableDatumRecords.length; idx++) { variableDatumRecords[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.DataReliablePdu = dis.DataReliablePdu; // End of DataReliablePdu class /** * represents values used in dead reckoning algorithms * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.DeadReckoningParameter = function() { /** enumeration of what dead reckoning algorighm to use */ this.deadReckoningAlgorithm = 0; /** other parameters to use in the dead reckoning algorithm */ this.otherParameters = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); /** Linear acceleration of the entity */ this.entityLinearAcceleration = new dis.Vector3Float(); /** angular velocity of the entity */ this.entityAngularVelocity = new dis.Vector3Float(); dis.DeadReckoningParameter.prototype.initFromBinary = function(inputStream) { this.deadReckoningAlgorithm = inputStream.readUByte(); for(var idx = 0; idx < 15; idx++) { this.otherParameters[ idx ] = inputStream.readByte(); } this.entityLinearAcceleration.initFromBinary(inputStream); this.entityAngularVelocity.initFromBinary(inputStream); }; dis.DeadReckoningParameter.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.deadReckoningAlgorithm); for(var idx = 0; idx < 15; idx++) { outputStream.writeByte(this.otherParameters[ idx ] ); } this.entityLinearAcceleration.encodeToBinary(outputStream); this.entityAngularVelocity.encodeToBinary(outputStream); }; }; // end of class // node.js module support exports.DeadReckoningParameter = dis.DeadReckoningParameter; // End of DeadReckoningParameter class /** * Section 5.3.7.2. Handles designating operations. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.DesignatorPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 24; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 6; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of the entity designating */ this.designatingEntityID = new dis.EntityID(); /** This field shall specify a unique emitter database number assigned to differentiate between otherwise similar or identical emitter beams within an emitter system. */ this.codeName = 0; /** ID of the entity being designated */ this.designatedEntityID = new dis.EntityID(); /** This field shall identify the designator code being used by the designating entity */ this.designatorCode = 0; /** This field shall identify the designator output power in watts */ this.designatorPower = 0; /** This field shall identify the designator wavelength in units of microns */ this.designatorWavelength = 0; /** designtor spot wrt the designated entity */ this.designatorSpotWrtDesignated = new dis.Vector3Float(); /** designtor spot wrt the designated entity */ this.designatorSpotLocation = new dis.Vector3Double(); /** Dead reckoning algorithm */ this.deadReckoningAlgorithm = 0; /** padding */ this.padding1 = 0; /** padding */ this.padding2 = 0; /** linear accelleration of entity */ this.entityLinearAcceleration = new dis.Vector3Float(); dis.DesignatorPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.designatingEntityID.initFromBinary(inputStream); this.codeName = inputStream.readUShort(); this.designatedEntityID.initFromBinary(inputStream); this.designatorCode = inputStream.readUShort(); this.designatorPower = inputStream.readFloat32(); this.designatorWavelength = inputStream.readFloat32(); this.designatorSpotWrtDesignated.initFromBinary(inputStream); this.designatorSpotLocation.initFromBinary(inputStream); this.deadReckoningAlgorithm = inputStream.readByte(); this.padding1 = inputStream.readUShort(); this.padding2 = inputStream.readByte(); this.entityLinearAcceleration.initFromBinary(inputStream); }; dis.DesignatorPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.designatingEntityID.encodeToBinary(outputStream); outputStream.writeUShort(this.codeName); this.designatedEntityID.encodeToBinary(outputStream); outputStream.writeUShort(this.designatorCode); outputStream.writeFloat32(this.designatorPower); outputStream.writeFloat32(this.designatorWavelength); this.designatorSpotWrtDesignated.encodeToBinary(outputStream); this.designatorSpotLocation.encodeToBinary(outputStream); outputStream.writeByte(this.deadReckoningAlgorithm); outputStream.writeUShort(this.padding1); outputStream.writeByte(this.padding2); this.entityLinearAcceleration.encodeToBinary(outputStream); }; }; // end of class // node.js module support exports.DesignatorPdu = dis.DesignatorPdu; // End of DesignatorPdu class /** * Section 5.3.4.2. Information about stuff exploding. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.DetonationPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 3; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 2; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of the entity that shot */ this.firingEntityID = new dis.EntityID(); /** ID of the entity that is being shot at */ this.targetEntityID = new dis.EntityID(); /** ID of muntion that was fired */ this.munitionID = new dis.EntityID(); /** ID firing event */ this.eventID = new dis.EventID(); /** ID firing event */ this.velocity = new dis.Vector3Float(); /** where the detonation is, in world coordinates */ this.locationInWorldCoordinates = new dis.Vector3Double(); /** Describes munition used */ this.burstDescriptor = new dis.BurstDescriptor(); /** location of the detonation or impact in the target entity's coordinate system. This information should be used for damage assessment. */ this.locationInEntityCoordinates = new dis.Vector3Float(); /** result of the explosion */ this.detonationResult = 0; /** How many articulation parameters we have */ this.numberOfArticulationParameters = 0; /** padding */ this.pad = 0; this.articulationParameters = new Array(); dis.DetonationPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.firingEntityID.initFromBinary(inputStream); this.targetEntityID.initFromBinary(inputStream); this.munitionID.initFromBinary(inputStream); this.eventID.initFromBinary(inputStream); this.velocity.initFromBinary(inputStream); this.locationInWorldCoordinates.initFromBinary(inputStream); this.burstDescriptor.initFromBinary(inputStream); this.locationInEntityCoordinates.initFromBinary(inputStream); this.detonationResult = inputStream.readUByte(); this.numberOfArticulationParameters = inputStream.readUByte(); this.pad = inputStream.readShort(); for(var idx = 0; idx < this.numberOfArticulationParameters; idx++) { var anX = new dis.ArticulationParameter(); anX.initFromBinary(inputStream); this.articulationParameters.push(anX); } }; dis.DetonationPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.firingEntityID.encodeToBinary(outputStream); this.targetEntityID.encodeToBinary(outputStream); this.munitionID.encodeToBinary(outputStream); this.eventID.encodeToBinary(outputStream); this.velocity.encodeToBinary(outputStream); this.locationInWorldCoordinates.encodeToBinary(outputStream); this.burstDescriptor.encodeToBinary(outputStream); this.locationInEntityCoordinates.encodeToBinary(outputStream); outputStream.writeUByte(this.detonationResult); outputStream.writeUByte(this.numberOfArticulationParameters); outputStream.writeShort(this.pad); for(var idx = 0; idx < this.articulationParameters.length; idx++) { articulationParameters[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.DetonationPdu = dis.DetonationPdu; // End of DetonationPdu class /** * Section 5.3.7. Electronic Emissions. Abstract superclass for distirubted emissions PDU * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.DistributedEmissionsFamilyPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 0; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 6; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; dis.DistributedEmissionsFamilyPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); }; dis.DistributedEmissionsFamilyPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); }; }; // end of class // node.js module support exports.DistributedEmissionsFamilyPdu = dis.DistributedEmissionsFamilyPdu; // End of DistributedEmissionsFamilyPdu class /** * 64 bit piece of data * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.EightByteChunk = function() { /** Eight bytes of arbitrary data */ this.otherParameters = new Array(0, 0, 0, 0, 0, 0, 0, 0); dis.EightByteChunk.prototype.initFromBinary = function(inputStream) { for(var idx = 0; idx < 8; idx++) { this.otherParameters[ idx ] = inputStream.readByte(); } }; dis.EightByteChunk.prototype.encodeToBinary = function(outputStream) { for(var idx = 0; idx < 8; idx++) { outputStream.writeByte(this.otherParameters[ idx ] ); } }; }; // end of class // node.js module support exports.EightByteChunk = dis.EightByteChunk; // End of EightByteChunk class /** * Description of one electronic emission beam * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ElectronicEmissionBeamData = function() { /** This field shall specify the length of this beams data in 32 bit words */ this.beamDataLength = 0; /** This field shall specify a unique emitter database number assigned to differentiate between otherwise similar or identical emitter beams within an emitter system. */ this.beamIDNumber = 0; /** This field shall specify a Beam Parameter Index number that shall be used by receiving entities in conjunction with the Emitter Name field to provide a pointer to the stored database parameters required to regenerate the beam. */ this.beamParameterIndex = 0; /** Fundamental parameter data such as frequency range, beam sweep, etc. */ this.fundamentalParameterData = new dis.FundamentalParameterData(); /** beam function of a particular beam */ this.beamFunction = 0; /** Number of track/jam targets */ this.numberOfTrackJamTargets = 0; /** wheher or not the receiving simulation apps can assume all the targets in the scan pattern are being tracked/jammed */ this.highDensityTrackJam = 0; /** padding */ this.pad4 = 0; /** identify jamming techniques used */ this.jammingModeSequence = 0; /** variable length variablelist of track/jam targets */ this.trackJamTargets = new Array(); dis.ElectronicEmissionBeamData.prototype.initFromBinary = function(inputStream) { this.beamDataLength = inputStream.readUByte(); this.beamIDNumber = inputStream.readUByte(); this.beamParameterIndex = inputStream.readUShort(); this.fundamentalParameterData.initFromBinary(inputStream); this.beamFunction = inputStream.readUByte(); this.numberOfTrackJamTargets = inputStream.readUByte(); this.highDensityTrackJam = inputStream.readUByte(); this.pad4 = inputStream.readUByte(); this.jammingModeSequence = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfTrackJamTargets; idx++) { var anX = new dis.TrackJamTarget(); anX.initFromBinary(inputStream); this.trackJamTargets.push(anX); } }; dis.ElectronicEmissionBeamData.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.beamDataLength); outputStream.writeUByte(this.beamIDNumber); outputStream.writeUShort(this.beamParameterIndex); this.fundamentalParameterData.encodeToBinary(outputStream); outputStream.writeUByte(this.beamFunction); outputStream.writeUByte(this.numberOfTrackJamTargets); outputStream.writeUByte(this.highDensityTrackJam); outputStream.writeUByte(this.pad4); outputStream.writeUInt(this.jammingModeSequence); for(var idx = 0; idx < this.trackJamTargets.length; idx++) { trackJamTargets[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.ElectronicEmissionBeamData = dis.ElectronicEmissionBeamData; // End of ElectronicEmissionBeamData class /** * Data about one electronic system * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ElectronicEmissionSystemData = function() { /** This field shall specify the length of this emitter system�s data (including beam data and its track/jam information) in 32-bit words. The length shall include the System Data Length field. */ this.systemDataLength = 0; /** This field shall specify the number of beams being described in the current PDU for the system being described. */ this.numberOfBeams = 0; /** padding. */ this.emissionsPadding2 = 0; /** This field shall specify information about a particular emitter system */ this.emitterSystem = new dis.EmitterSystem(); /** Location with respect to the entity */ this.location = new dis.Vector3Float(); /** variable length variablelist of beam data records */ this.beamDataRecords = new Array(); dis.ElectronicEmissionSystemData.prototype.initFromBinary = function(inputStream) { this.systemDataLength = inputStream.readUByte(); this.numberOfBeams = inputStream.readUByte(); this.emissionsPadding2 = inputStream.readUShort(); this.emitterSystem.initFromBinary(inputStream); this.location.initFromBinary(inputStream); for(var idx = 0; idx < this.numberOfBeams; idx++) { var anX = new dis.ElectronicEmissionBeamData(); anX.initFromBinary(inputStream); this.beamDataRecords.push(anX); } }; dis.ElectronicEmissionSystemData.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.systemDataLength); outputStream.writeUByte(this.numberOfBeams); outputStream.writeUShort(this.emissionsPadding2); this.emitterSystem.encodeToBinary(outputStream); this.location.encodeToBinary(outputStream); for(var idx = 0; idx < this.beamDataRecords.length; idx++) { beamDataRecords[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.ElectronicEmissionSystemData = dis.ElectronicEmissionSystemData; // End of ElectronicEmissionSystemData class /** * Section 5.3.7.1. Information about active electronic warfare (EW) emissions and active EW countermeasures shall be communicated using an Electromagnetic Emission PDU. COMPLETE (I think) * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ElectronicEmissionsPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 23; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 6; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of the entity emitting */ this.emittingEntityID = new dis.EntityID(); /** ID of event */ this.eventID = new dis.EventID(); /** This field shall be used to indicate if the data in the PDU represents a state update or just data that has changed since issuance of the last Electromagnetic Emission PDU [relative to the identified entity and emission system(s)]. */ this.stateUpdateIndicator = 0; /** This field shall specify the number of emission systems being described in the current PDU. */ this.numberOfSystems = 0; /** padding */ this.paddingForEmissionsPdu = 0; /** Electronic emmissions systems */ this.systems = new Array(); dis.ElectronicEmissionsPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.emittingEntityID.initFromBinary(inputStream); this.eventID.initFromBinary(inputStream); this.stateUpdateIndicator = inputStream.readUByte(); this.numberOfSystems = inputStream.readUByte(); this.paddingForEmissionsPdu = inputStream.readUShort(); for(var idx = 0; idx < this.numberOfSystems; idx++) { var anX = new dis.ElectronicEmissionSystemData(); anX.initFromBinary(inputStream); this.systems.push(anX); } }; dis.ElectronicEmissionsPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.emittingEntityID.encodeToBinary(outputStream); this.eventID.encodeToBinary(outputStream); outputStream.writeUByte(this.stateUpdateIndicator); outputStream.writeUByte(this.numberOfSystems); outputStream.writeUShort(this.paddingForEmissionsPdu); for(var idx = 0; idx < this.systems.length; idx++) { systems[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.ElectronicEmissionsPdu = dis.ElectronicEmissionsPdu; // End of ElectronicEmissionsPdu class /** * Section 5.2.11. This field shall specify information about a particular emitter system * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.EmitterSystem = function() { /** Name of the emitter, 16 bit enumeration */ this.emitterName = 0; /** function of the emitter, 8 bit enumeration */ this.function = 0; /** emitter ID, 8 bit enumeration */ this.emitterIdNumber = 0; dis.EmitterSystem.prototype.initFromBinary = function(inputStream) { this.emitterName = inputStream.readUShort(); this.function = inputStream.readUByte(); this.emitterIdNumber = inputStream.readUByte(); }; dis.EmitterSystem.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.emitterName); outputStream.writeUByte(this.function); outputStream.writeUByte(this.emitterIdNumber); }; }; // end of class // node.js module support exports.EmitterSystem = dis.EmitterSystem; // End of EmitterSystem class /** * Each entity in a given DIS simulation application shall be given an entity identifier number unique to all other entities in that application. This identifier number is valid for the duration of the exercise; however, entity identifier numbers may be reused when all possible numbers have been exhausted. No entity shall have an entity identifier number of NO_ENTITY, ALL_ENTITIES, or RQST_ASSIGN_ID. The entity iden- tifier number need not be registered or retained for future exercises. The entity identifier number shall be specified by a 16-bit unsigned integer. An entity identifier number equal to zero with valid site and application identification shall address a simulation application. An entity identifier number equal to ALL_ENTITIES shall mean all entities within the specified site and application. An entity identifier number equal to RQST_ASSIGN_ID allows the receiver of the create entity to define the entity identifier number of the new entity. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.EntityID = function() { /** The site ID */ this.site = 0; /** The application ID */ this.application = 0; /** the entity ID */ this.entity = 0; dis.EntityID.prototype.initFromBinary = function(inputStream) { this.site = inputStream.readUShort(); this.application = inputStream.readUShort(); this.entity = inputStream.readUShort(); }; dis.EntityID.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.site); outputStream.writeUShort(this.application); outputStream.writeUShort(this.entity); }; }; // end of class // node.js module support exports.EntityID = dis.EntityID; // End of EntityID class /** * Section 5.3.3. Common superclass for EntityState, Collision, collision-elastic, and entity state update PDUs. This should be abstract. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.EntityInformationFamilyPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 0; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 1; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; dis.EntityInformationFamilyPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); }; dis.EntityInformationFamilyPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); }; }; // end of class // node.js module support exports.EntityInformationFamilyPdu = dis.EntityInformationFamilyPdu; // End of EntityInformationFamilyPdu class /** * Section 5.3.9. Common superclass for EntityManagment PDUs, including aggregate state, isGroupOf, TransferControLRequest, and isPartOf * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.EntityManagementFamilyPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 0; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 7; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; dis.EntityManagementFamilyPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); }; dis.EntityManagementFamilyPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); }; }; // end of class // node.js module support exports.EntityManagementFamilyPdu = dis.EntityManagementFamilyPdu; // End of EntityManagementFamilyPdu class /** * Section 5.3.3.1. Represents the postion and state of one entity in the world. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.EntityStatePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 1; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 1; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Unique ID for an entity that is tied to this state information */ this.entityID = new dis.EntityID(); /** What force this entity is affiliated with, eg red, blue, neutral, etc */ this.forceId = 0; /** How many articulation parameters are in the variable length list */ this.numberOfArticulationParameters = 0; /** Describes the type of entity in the world */ this.entityType = new dis.EntityType(); this.alternativeEntityType = new dis.EntityType(); /** Describes the speed of the entity in the world */ this.entityLinearVelocity = new dis.Vector3Float(); /** describes the location of the entity in the world */ this.entityLocation = new dis.Vector3Double(); /** describes the orientation of the entity, in euler angles */ this.entityOrientation = new dis.Orientation(); /** a series of bit flags that are used to help draw the entity, such as smoking, on fire, etc. */ this.entityAppearance = 0; /** parameters used for dead reckoning */ this.deadReckoningParameters = new dis.DeadReckoningParameter(); /** characters that can be used for debugging, or to draw unique strings on the side of entities in the world */ this.marking = new dis.Marking(); /** a series of bit flags */ this.capabilities = 0; /** variable length list of articulation parameters */ this.articulationParameters = new Array(); dis.EntityStatePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.entityID.initFromBinary(inputStream); this.forceId = inputStream.readUByte(); this.numberOfArticulationParameters = inputStream.readByte(); this.entityType.initFromBinary(inputStream); this.alternativeEntityType.initFromBinary(inputStream); this.entityLinearVelocity.initFromBinary(inputStream); this.entityLocation.initFromBinary(inputStream); this.entityOrientation.initFromBinary(inputStream); this.entityAppearance = inputStream.readInt(); this.deadReckoningParameters.initFromBinary(inputStream); this.marking.initFromBinary(inputStream); this.capabilities = inputStream.readInt(); for(var idx = 0; idx < this.numberOfArticulationParameters; idx++) { var anX = new dis.ArticulationParameter(); anX.initFromBinary(inputStream); this.articulationParameters.push(anX); } }; dis.EntityStatePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.entityID.encodeToBinary(outputStream); outputStream.writeUByte(this.forceId); outputStream.writeByte(this.numberOfArticulationParameters); this.entityType.encodeToBinary(outputStream); this.alternativeEntityType.encodeToBinary(outputStream); this.entityLinearVelocity.encodeToBinary(outputStream); this.entityLocation.encodeToBinary(outputStream); this.entityOrientation.encodeToBinary(outputStream); outputStream.writeInt(this.entityAppearance); this.deadReckoningParameters.encodeToBinary(outputStream); this.marking.encodeToBinary(outputStream); outputStream.writeInt(this.capabilities); for(var idx = 0; idx < this.articulationParameters.length; idx++) { articulationParameters[idx].encodeToBinary(outputStream); } }; /** 0 uniform color, 1 camouflage */ dis.EntityStatePdu.prototype.getEntityAppearance_paintScheme = function() { var val = this.entityAppearance & 0x1; return val >> 0; }; /** 0 uniform color, 1 camouflage */ dis.EntityStatePdu.prototype.setEntityAppearance_paintScheme= function(val) { this.entityAppearance &= ~0x1; // Zero existing bits val = val << 0; this.entityAppearance = this.entityAppearance | val; }; /** 0 no mobility kill, 1 mobility kill */ dis.EntityStatePdu.prototype.getEntityAppearance_mobility = function() { var val = this.entityAppearance & 0x2; return val >> 1; }; /** 0 no mobility kill, 1 mobility kill */ dis.EntityStatePdu.prototype.setEntityAppearance_mobility= function(val) { this.entityAppearance &= ~0x2; // Zero existing bits val = val << 1; this.entityAppearance = this.entityAppearance | val; }; /** 0 no firepower iill, 1 firepower kill */ dis.EntityStatePdu.prototype.getEntityAppearance_firepower = function() { var val = this.entityAppearance & 0x4; return val >> 2; }; /** 0 no firepower iill, 1 firepower kill */ dis.EntityStatePdu.prototype.setEntityAppearance_firepower= function(val) { this.entityAppearance &= ~0x4; // Zero existing bits val = val << 2; this.entityAppearance = this.entityAppearance | val; }; /** 0 no damage, 1 slight damage, 2 moderate, 3 destroyed */ dis.EntityStatePdu.prototype.getEntityAppearance_damage = function() { var val = this.entityAppearance & 0x18; return val >> 3; }; /** 0 no damage, 1 slight damage, 2 moderate, 3 destroyed */ dis.EntityStatePdu.prototype.setEntityAppearance_damage= function(val) { this.entityAppearance &= ~0x18; // Zero existing bits val = val << 3; this.entityAppearance = this.entityAppearance | val; }; /** 0 no smoke, 1 smoke plume, 2 engine smoke, 3 engine smoke and plume */ dis.EntityStatePdu.prototype.getEntityAppearance_smoke = function() { var val = this.entityAppearance & 0x60; return val >> 5; }; /** 0 no smoke, 1 smoke plume, 2 engine smoke, 3 engine smoke and plume */ dis.EntityStatePdu.prototype.setEntityAppearance_smoke= function(val) { this.entityAppearance &= ~0x60; // Zero existing bits val = val << 5; this.entityAppearance = this.entityAppearance | val; }; /** dust cloud, 0 none 1 small 2 medium 3 large */ dis.EntityStatePdu.prototype.getEntityAppearance_trailingEffects = function() { var val = this.entityAppearance & 0x180; return val >> 7; }; /** dust cloud, 0 none 1 small 2 medium 3 large */ dis.EntityStatePdu.prototype.setEntityAppearance_trailingEffects= function(val) { this.entityAppearance &= ~0x180; // Zero existing bits val = val << 7; this.entityAppearance = this.entityAppearance | val; }; /** 0 NA 1 closed popped 3 popped and person visible 4 open 5 open and person visible */ dis.EntityStatePdu.prototype.getEntityAppearance_hatch = function() { var val = this.entityAppearance & 0xe00; return val >> 9; }; /** 0 NA 1 closed popped 3 popped and person visible 4 open 5 open and person visible */ dis.EntityStatePdu.prototype.setEntityAppearance_hatch= function(val) { this.entityAppearance &= ~0xe00; // Zero existing bits val = val << 9; this.entityAppearance = this.entityAppearance | val; }; /** 0 off 1 on */ dis.EntityStatePdu.prototype.getEntityAppearance_headlights = function() { var val = this.entityAppearance & 0x1000; return val >> 12; }; /** 0 off 1 on */ dis.EntityStatePdu.prototype.setEntityAppearance_headlights= function(val) { this.entityAppearance &= ~0x1000; // Zero existing bits val = val << 12; this.entityAppearance = this.entityAppearance | val; }; /** 0 off 1 on */ dis.EntityStatePdu.prototype.getEntityAppearance_tailLights = function() { var val = this.entityAppearance & 0x2000; return val >> 13; }; /** 0 off 1 on */ dis.EntityStatePdu.prototype.setEntityAppearance_tailLights= function(val) { this.entityAppearance &= ~0x2000; // Zero existing bits val = val << 13; this.entityAppearance = this.entityAppearance | val; }; /** 0 off 1 on */ dis.EntityStatePdu.prototype.getEntityAppearance_brakeLights = function() { var val = this.entityAppearance & 0x4000; return val >> 14; }; /** 0 off 1 on */ dis.EntityStatePdu.prototype.setEntityAppearance_brakeLights= function(val) { this.entityAppearance &= ~0x4000; // Zero existing bits val = val << 14; this.entityAppearance = this.entityAppearance | val; }; /** 0 off 1 on */ dis.EntityStatePdu.prototype.getEntityAppearance_flaming = function() { var val = this.entityAppearance & 0x8000; return val >> 15; }; /** 0 off 1 on */ dis.EntityStatePdu.prototype.setEntityAppearance_flaming= function(val) { this.entityAppearance &= ~0x8000; // Zero existing bits val = val << 15; this.entityAppearance = this.entityAppearance | val; }; /** 0 not raised 1 raised */ dis.EntityStatePdu.prototype.getEntityAppearance_launcher = function() { var val = this.entityAppearance & 0x10000; return val >> 16; }; /** 0 not raised 1 raised */ dis.EntityStatePdu.prototype.setEntityAppearance_launcher= function(val) { this.entityAppearance &= ~0x10000; // Zero existing bits val = val << 16; this.entityAppearance = this.entityAppearance | val; }; /** 0 desert 1 winter 2 forest 3 unused */ dis.EntityStatePdu.prototype.getEntityAppearance_camouflageType = function() { var val = this.entityAppearance & 0x60000; return val >> 17; }; /** 0 desert 1 winter 2 forest 3 unused */ dis.EntityStatePdu.prototype.setEntityAppearance_camouflageType= function(val) { this.entityAppearance &= ~0x60000; // Zero existing bits val = val << 17; this.entityAppearance = this.entityAppearance | val; }; }; // end of class // node.js module support exports.EntityStatePdu = dis.EntityStatePdu; // End of EntityStatePdu class /** * 5.3.3.4. Nonstatic information about a particular entity may be communicated by issuing an Entity State Update PDU. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.EntityStateUpdatePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 67; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 1; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** This field shall identify the entity issuing the PDU */ this.entityID = new dis.EntityID(); /** Padding */ this.padding1 = 0; /** How many articulation parameters are in the variable length list */ this.numberOfArticulationParameters = 0; /** Describes the speed of the entity in the world */ this.entityLinearVelocity = new dis.Vector3Float(); /** describes the location of the entity in the world */ this.entityLocation = new dis.Vector3Double(); /** describes the orientation of the entity, in euler angles */ this.entityOrientation = new dis.Orientation(); /** a series of bit flags that are used to help draw the entity, such as smoking, on fire, etc. */ this.entityAppearance = 0; this.articulationParameters = new Array(); dis.EntityStateUpdatePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.entityID.initFromBinary(inputStream); this.padding1 = inputStream.readByte(); this.numberOfArticulationParameters = inputStream.readUByte(); this.entityLinearVelocity.initFromBinary(inputStream); this.entityLocation.initFromBinary(inputStream); this.entityOrientation.initFromBinary(inputStream); this.entityAppearance = inputStream.readInt(); for(var idx = 0; idx < this.numberOfArticulationParameters; idx++) { var anX = new dis.ArticulationParameter(); anX.initFromBinary(inputStream); this.articulationParameters.push(anX); } }; dis.EntityStateUpdatePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.entityID.encodeToBinary(outputStream); outputStream.writeByte(this.padding1); outputStream.writeUByte(this.numberOfArticulationParameters); this.entityLinearVelocity.encodeToBinary(outputStream); this.entityLocation.encodeToBinary(outputStream); this.entityOrientation.encodeToBinary(outputStream); outputStream.writeInt(this.entityAppearance); for(var idx = 0; idx < this.articulationParameters.length; idx++) { articulationParameters[idx].encodeToBinary(outputStream); } }; /** 0 uniform color, 1 camouflage */ dis.EntityStateUpdatePdu.prototype.getEntityAppearance_paintScheme = function() { var val = this.entityAppearance & 0x1; return val >> 0; }; /** 0 uniform color, 1 camouflage */ dis.EntityStateUpdatePdu.prototype.setEntityAppearance_paintScheme= function(val) { this.entityAppearance &= ~0x1; // Zero existing bits val = val << 0; this.entityAppearance = this.entityAppearance | val; }; /** 0 no mobility kill, 1 mobility kill */ dis.EntityStateUpdatePdu.prototype.getEntityAppearance_mobility = function() { var val = this.entityAppearance & 0x2; return val >> 1; }; /** 0 no mobility kill, 1 mobility kill */ dis.EntityStateUpdatePdu.prototype.setEntityAppearance_mobility= function(val) { this.entityAppearance &= ~0x2; // Zero existing bits val = val << 1; this.entityAppearance = this.entityAppearance | val; }; /** 0 no firepower iill, 1 firepower kill */ dis.EntityStateUpdatePdu.prototype.getEntityAppearance_firepower = function() { var val = this.entityAppearance & 0x4; return val >> 2; }; /** 0 no firepower iill, 1 firepower kill */ dis.EntityStateUpdatePdu.prototype.setEntityAppearance_firepower= function(val) { this.entityAppearance &= ~0x4; // Zero existing bits val = val << 2; this.entityAppearance = this.entityAppearance | val; }; /** 0 no damage, 1 slight damage, 2 moderate, 3 destroyed */ dis.EntityStateUpdatePdu.prototype.getEntityAppearance_damage = function() { var val = this.entityAppearance & 0x18; return val >> 3; }; /** 0 no damage, 1 slight damage, 2 moderate, 3 destroyed */ dis.EntityStateUpdatePdu.prototype.setEntityAppearance_damage= function(val) { this.entityAppearance &= ~0x18; // Zero existing bits val = val << 3; this.entityAppearance = this.entityAppearance | val; }; /** 0 no smoke, 1 smoke plume, 2 engine smoke, 3 engine smoke and plume */ dis.EntityStateUpdatePdu.prototype.getEntityAppearance_smoke = function() { var val = this.entityAppearance & 0x60; return val >> 5; }; /** 0 no smoke, 1 smoke plume, 2 engine smoke, 3 engine smoke and plume */ dis.EntityStateUpdatePdu.prototype.setEntityAppearance_smoke= function(val) { this.entityAppearance &= ~0x60; // Zero existing bits val = val << 5; this.entityAppearance = this.entityAppearance | val; }; /** dust cloud, 0 none 1 small 2 medium 3 large */ dis.EntityStateUpdatePdu.prototype.getEntityAppearance_trailingEffects = function() { var val = this.entityAppearance & 0x180; return val >> 7; }; /** dust cloud, 0 none 1 small 2 medium 3 large */ dis.EntityStateUpdatePdu.prototype.setEntityAppearance_trailingEffects= function(val) { this.entityAppearance &= ~0x180; // Zero existing bits val = val << 7; this.entityAppearance = this.entityAppearance | val; }; /** 0 NA 1 closed popped 3 popped and person visible 4 open 5 open and person visible */ dis.EntityStateUpdatePdu.prototype.getEntityAppearance_hatch = function() { var val = this.entityAppearance & 0xe00; return val >> 9; }; /** 0 NA 1 closed popped 3 popped and person visible 4 open 5 open and person visible */ dis.EntityStateUpdatePdu.prototype.setEntityAppearance_hatch= function(val) { this.entityAppearance &= ~0xe00; // Zero existing bits val = val << 9; this.entityAppearance = this.entityAppearance | val; }; /** 0 off 1 on */ dis.EntityStateUpdatePdu.prototype.getEntityAppearance_headlights = function() { var val = this.entityAppearance & 0x1000; return val >> 12; }; /** 0 off 1 on */ dis.EntityStateUpdatePdu.prototype.setEntityAppearance_headlights= function(val) { this.entityAppearance &= ~0x1000; // Zero existing bits val = val << 12; this.entityAppearance = this.entityAppearance | val; }; /** 0 off 1 on */ dis.EntityStateUpdatePdu.prototype.getEntityAppearance_tailLights = function() { var val = this.entityAppearance & 0x2000; return val >> 13; }; /** 0 off 1 on */ dis.EntityStateUpdatePdu.prototype.setEntityAppearance_tailLights= function(val) { this.entityAppearance &= ~0x2000; // Zero existing bits val = val << 13; this.entityAppearance = this.entityAppearance | val; }; /** 0 off 1 on */ dis.EntityStateUpdatePdu.prototype.getEntityAppearance_brakeLights = function() { var val = this.entityAppearance & 0x4000; return val >> 14; }; /** 0 off 1 on */ dis.EntityStateUpdatePdu.prototype.setEntityAppearance_brakeLights= function(val) { this.entityAppearance &= ~0x4000; // Zero existing bits val = val << 14; this.entityAppearance = this.entityAppearance | val; }; /** 0 off 1 on */ dis.EntityStateUpdatePdu.prototype.getEntityAppearance_flaming = function() { var val = this.entityAppearance & 0x8000; return val >> 15; }; /** 0 off 1 on */ dis.EntityStateUpdatePdu.prototype.setEntityAppearance_flaming= function(val) { this.entityAppearance &= ~0x8000; // Zero existing bits val = val << 15; this.entityAppearance = this.entityAppearance | val; }; /** 0 not raised 1 raised */ dis.EntityStateUpdatePdu.prototype.getEntityAppearance_launcher = function() { var val = this.entityAppearance & 0x10000; return val >> 16; }; /** 0 not raised 1 raised */ dis.EntityStateUpdatePdu.prototype.setEntityAppearance_launcher= function(val) { this.entityAppearance &= ~0x10000; // Zero existing bits val = val << 16; this.entityAppearance = this.entityAppearance | val; }; /** 0 desert 1 winter 2 forest 3 unused */ dis.EntityStateUpdatePdu.prototype.getEntityAppearance_camouflageType = function() { var val = this.entityAppearance & 0x60000; return val >> 17; }; /** 0 desert 1 winter 2 forest 3 unused */ dis.EntityStateUpdatePdu.prototype.setEntityAppearance_camouflageType= function(val) { this.entityAppearance &= ~0x60000; // Zero existing bits val = val << 17; this.entityAppearance = this.entityAppearance | val; }; }; // end of class // node.js module support exports.EntityStateUpdatePdu = dis.EntityStateUpdatePdu; // End of EntityStateUpdatePdu class /** * Section 5.2.16. Identifies the type of entity, including kind of entity, domain (surface, subsurface, air, etc) country, category, etc. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.EntityType = function() { /** Kind of entity */ this.entityKind = 0; /** Domain of entity (air, surface, subsurface, space, etc) */ this.domain = 0; /** country to which the design of the entity is attributed */ this.country = 0; /** category of entity */ this.category = 0; /** subcategory of entity */ this.subcategory = 0; /** specific info based on subcategory field. Renamed from specific because that is a reserved word in SQL */ this.spec = 0; this.extra = 0; dis.EntityType.prototype.initFromBinary = function(inputStream) { this.entityKind = inputStream.readUByte(); this.domain = inputStream.readUByte(); this.country = inputStream.readUShort(); this.category = inputStream.readUByte(); this.subcategory = inputStream.readUByte(); this.spec = inputStream.readUByte(); this.extra = inputStream.readUByte(); }; dis.EntityType.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.entityKind); outputStream.writeUByte(this.domain); outputStream.writeUShort(this.country); outputStream.writeUByte(this.category); outputStream.writeUByte(this.subcategory); outputStream.writeUByte(this.spec); outputStream.writeUByte(this.extra); }; }; // end of class // node.js module support exports.EntityType = dis.EntityType; // End of EntityType class /** * Section 5.2.40. Information about a geometry, a state associated with a geometry, a bounding volume, or an associated entity ID. NOTE: this class requires hand coding. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.Environment = function() { /** Record type */ this.environmentType = 0; /** length, in bits */ this.length = 0; /** Identify the sequentially numbered record index */ this.recordIndex = 0; /** padding */ this.padding1 = 0; /** Geometry or state record */ this.geometry = 0; /** padding to bring the total size up to a 64 bit boundry */ this.padding2 = 0; dis.Environment.prototype.initFromBinary = function(inputStream) { this.environmentType = inputStream.readUInt(); this.length = inputStream.readUByte(); this.recordIndex = inputStream.readUByte(); this.padding1 = inputStream.readUByte(); this.geometry = inputStream.readUByte(); this.padding2 = inputStream.readUByte(); }; dis.Environment.prototype.encodeToBinary = function(outputStream) { outputStream.writeUInt(this.environmentType); outputStream.writeUByte(this.length); outputStream.writeUByte(this.recordIndex); outputStream.writeUByte(this.padding1); outputStream.writeUByte(this.geometry); outputStream.writeUByte(this.padding2); }; }; // end of class // node.js module support exports.Environment = dis.Environment; // End of Environment class /** * Section 5.3.11.1: Information about environmental effects and processes. This requires manual cleanup. the environmental record is variable, as is the padding. UNFINISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.EnvironmentalProcessPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 41; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 9; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Environmental process ID */ this.environementalProcessID = new dis.EntityID(); /** Environment type */ this.environmentType = new dis.EntityType(); /** model type */ this.modelType = 0; /** Environment status */ this.environmentStatus = 0; /** number of environment records */ this.numberOfEnvironmentRecords = 0; /** PDU sequence number for the environmentla process if pdu sequencing required */ this.sequenceNumber = 0; /** environemt records */ this.environmentRecords = new Array(); dis.EnvironmentalProcessPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.environementalProcessID.initFromBinary(inputStream); this.environmentType.initFromBinary(inputStream); this.modelType = inputStream.readUByte(); this.environmentStatus = inputStream.readUByte(); this.numberOfEnvironmentRecords = inputStream.readUByte(); this.sequenceNumber = inputStream.readUShort(); for(var idx = 0; idx < this.numberOfEnvironmentRecords; idx++) { var anX = new dis.Environment(); anX.initFromBinary(inputStream); this.environmentRecords.push(anX); } }; dis.EnvironmentalProcessPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.environementalProcessID.encodeToBinary(outputStream); this.environmentType.encodeToBinary(outputStream); outputStream.writeUByte(this.modelType); outputStream.writeUByte(this.environmentStatus); outputStream.writeUByte(this.numberOfEnvironmentRecords); outputStream.writeUShort(this.sequenceNumber); for(var idx = 0; idx < this.environmentRecords.length; idx++) { environmentRecords[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.EnvironmentalProcessPdu = dis.EnvironmentalProcessPdu; // End of EnvironmentalProcessPdu class /** * Section 5.2.18. Identifies a unique event in a simulation via the combination of three values * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.EventID = function() { /** The site ID */ this.site = 0; /** The application ID */ this.application = 0; /** the number of the event */ this.eventNumber = 0; dis.EventID.prototype.initFromBinary = function(inputStream) { this.site = inputStream.readUShort(); this.application = inputStream.readUShort(); this.eventNumber = inputStream.readUShort(); }; dis.EventID.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.site); outputStream.writeUShort(this.application); outputStream.writeUShort(this.eventNumber); }; }; // end of class // node.js module support exports.EventID = dis.EventID; // End of EventID class /** * Section 5.3.6.11. Reports occurance of a significant event to the simulation manager. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.EventReportPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 21; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 5; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is sending message */ this.originatingEntityID = new dis.EntityID(); /** Entity that is intended to receive message */ this.receivingEntityID = new dis.EntityID(); /** Type of event */ this.eventType = 0; /** padding */ this.padding1 = 0; /** Number of fixed datum records */ this.numberOfFixedDatumRecords = 0; /** Number of variable datum records */ this.numberOfVariableDatumRecords = 0; /** variable length list of fixed datums */ this.fixedDatums = new Array(); /** variable length list of variable length datums */ this.variableDatums = new Array(); dis.EventReportPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.eventType = inputStream.readUInt(); this.padding1 = inputStream.readUInt(); this.numberOfFixedDatumRecords = inputStream.readUInt(); this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfFixedDatumRecords; idx++) { var anX = new dis.FixedDatum(); anX.initFromBinary(inputStream); this.fixedDatums.push(anX); } for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.variableDatums.push(anX); } }; dis.EventReportPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.eventType); outputStream.writeUInt(this.padding1); outputStream.writeUInt(this.numberOfFixedDatumRecords); outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.fixedDatums.length; idx++) { fixedDatums[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.variableDatums.length; idx++) { variableDatums[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.EventReportPdu = dis.EventReportPdu; // End of EventReportPdu class /** * Section 5.3.12.11: reports the occurance of a significatnt event to the simulation manager. Needs manual intervention to fix padding in variable datums. UNFINISHED. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.EventReportReliablePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 61; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); /** Event type */ this.eventType = 0; /** padding */ this.pad1 = 0; /** Fixed datum record count */ this.numberOfFixedDatumRecords = 0; /** variable datum record count */ this.numberOfVariableDatumRecords = 0; /** Fixed datum records */ this.fixedDatumRecords = new Array(); /** Variable datum records */ this.variableDatumRecords = new Array(); dis.EventReportReliablePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.eventType = inputStream.readUShort(); this.pad1 = inputStream.readUInt(); this.numberOfFixedDatumRecords = inputStream.readUInt(); this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfFixedDatumRecords; idx++) { var anX = new dis.FixedDatum(); anX.initFromBinary(inputStream); this.fixedDatumRecords.push(anX); } for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.variableDatumRecords.push(anX); } }; dis.EventReportReliablePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUShort(this.eventType); outputStream.writeUInt(this.pad1); outputStream.writeUInt(this.numberOfFixedDatumRecords); outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.fixedDatumRecords.length; idx++) { fixedDatumRecords[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.variableDatumRecords.length; idx++) { variableDatumRecords[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.EventReportReliablePdu = dis.EventReportReliablePdu; // End of EventReportReliablePdu class /** * Section 5.3.3.1. Represents the postion and state of one entity in the world. This is identical in function to entity state pdu, but generates less garbage to collect in the Java world. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.FastEntityStatePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 1; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 1; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** The site ID */ this.site = 0; /** The application ID */ this.application = 0; /** the entity ID */ this.entity = 0; /** what force this entity is affiliated with, eg red, blue, neutral, etc */ this.forceId = 0; /** How many articulation parameters are in the variable length list */ this.numberOfArticulationParameters = 0; /** Kind of entity */ this.entityKind = 0; /** Domain of entity (air, surface, subsurface, space, etc) */ this.domain = 0; /** country to which the design of the entity is attributed */ this.country = 0; /** category of entity */ this.category = 0; /** subcategory of entity */ this.subcategory = 0; /** specific info based on subcategory field. Name changed from specific because that is a reserved word in SQL. */ this.specif = 0; this.extra = 0; /** Kind of entity */ this.altEntityKind = 0; /** Domain of entity (air, surface, subsurface, space, etc) */ this.altDomain = 0; /** country to which the design of the entity is attributed */ this.altCountry = 0; /** category of entity */ this.altCategory = 0; /** subcategory of entity */ this.altSubcategory = 0; /** specific info based on subcategory field */ this.altSpecific = 0; this.altExtra = 0; /** X velo */ this.xVelocity = 0; /** y Value */ this.yVelocity = 0; /** Z value */ this.zVelocity = 0; /** X value */ this.xLocation = 0; /** y Value */ this.yLocation = 0; /** Z value */ this.zLocation = 0; this.psi = 0; this.theta = 0; this.phi = 0; /** a series of bit flags that are used to help draw the entity, such as smoking, on fire, etc. */ this.entityAppearance = 0; /** enumeration of what dead reckoning algorighm to use */ this.deadReckoningAlgorithm = 0; /** other parameters to use in the dead reckoning algorithm */ this.otherParameters = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); /** X value */ this.xAcceleration = 0; /** y Value */ this.yAcceleration = 0; /** Z value */ this.zAcceleration = 0; /** X value */ this.xAngularVelocity = 0; /** y Value */ this.yAngularVelocity = 0; /** Z value */ this.zAngularVelocity = 0; /** characters that can be used for debugging, or to draw unique strings on the side of entities in the world */ this.marking = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); /** a series of bit flags */ this.capabilities = 0; /** variable length list of articulation parameters */ this.articulationParameters = new Array(); dis.FastEntityStatePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.site = inputStream.readUShort(); this.application = inputStream.readUShort(); this.entity = inputStream.readUShort(); this.forceId = inputStream.readUByte(); this.numberOfArticulationParameters = inputStream.readByte(); this.entityKind = inputStream.readUByte(); this.domain = inputStream.readUByte(); this.country = inputStream.readUShort(); this.category = inputStream.readUByte(); this.subcategory = inputStream.readUByte(); this.specif = inputStream.readUByte(); this.extra = inputStream.readUByte(); this.altEntityKind = inputStream.readUByte(); this.altDomain = inputStream.readUByte(); this.altCountry = inputStream.readUShort(); this.altCategory = inputStream.readUByte(); this.altSubcategory = inputStream.readUByte(); this.altSpecific = inputStream.readUByte(); this.altExtra = inputStream.readUByte(); this.xVelocity = inputStream.readFloat32(); this.yVelocity = inputStream.readFloat32(); this.zVelocity = inputStream.readFloat32(); this.xLocation = inputStream.readFloat64(); this.yLocation = inputStream.readFloat64(); this.zLocation = inputStream.readFloat64(); this.psi = inputStream.readFloat32(); this.theta = inputStream.readFloat32(); this.phi = inputStream.readFloat32(); this.entityAppearance = inputStream.readInt(); this.deadReckoningAlgorithm = inputStream.readUByte(); for(var idx = 0; idx < 15; idx++) { this.otherParameters[ idx ] = inputStream.readByte(); } this.xAcceleration = inputStream.readFloat32(); this.yAcceleration = inputStream.readFloat32(); this.zAcceleration = inputStream.readFloat32(); this.xAngularVelocity = inputStream.readFloat32(); this.yAngularVelocity = inputStream.readFloat32(); this.zAngularVelocity = inputStream.readFloat32(); for(var idx = 0; idx < 12; idx++) { this.marking[ idx ] = inputStream.readByte(); } this.capabilities = inputStream.readInt(); for(var idx = 0; idx < this.numberOfArticulationParameters; idx++) { var anX = new dis.ArticulationParameter(); anX.initFromBinary(inputStream); this.articulationParameters.push(anX); } }; dis.FastEntityStatePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); outputStream.writeUShort(this.site); outputStream.writeUShort(this.application); outputStream.writeUShort(this.entity); outputStream.writeUByte(this.forceId); outputStream.writeByte(this.numberOfArticulationParameters); outputStream.writeUByte(this.entityKind); outputStream.writeUByte(this.domain); outputStream.writeUShort(this.country); outputStream.writeUByte(this.category); outputStream.writeUByte(this.subcategory); outputStream.writeUByte(this.specif); outputStream.writeUByte(this.extra); outputStream.writeUByte(this.altEntityKind); outputStream.writeUByte(this.altDomain); outputStream.writeUShort(this.altCountry); outputStream.writeUByte(this.altCategory); outputStream.writeUByte(this.altSubcategory); outputStream.writeUByte(this.altSpecific); outputStream.writeUByte(this.altExtra); outputStream.writeFloat32(this.xVelocity); outputStream.writeFloat32(this.yVelocity); outputStream.writeFloat32(this.zVelocity); outputStream.writeFloat64(this.xLocation); outputStream.writeFloat64(this.yLocation); outputStream.writeFloat64(this.zLocation); outputStream.writeFloat32(this.psi); outputStream.writeFloat32(this.theta); outputStream.writeFloat32(this.phi); outputStream.writeInt(this.entityAppearance); outputStream.writeUByte(this.deadReckoningAlgorithm); for(var idx = 0; idx < 15; idx++) { outputStream.writeByte(this.otherParameters[ idx ] ); } outputStream.writeFloat32(this.xAcceleration); outputStream.writeFloat32(this.yAcceleration); outputStream.writeFloat32(this.zAcceleration); outputStream.writeFloat32(this.xAngularVelocity); outputStream.writeFloat32(this.yAngularVelocity); outputStream.writeFloat32(this.zAngularVelocity); for(var idx = 0; idx < 12; idx++) { outputStream.writeByte(this.marking[ idx ] ); } outputStream.writeInt(this.capabilities); for(var idx = 0; idx < this.articulationParameters.length; idx++) { articulationParameters[idx].encodeToBinary(outputStream); } }; /** 0 uniform color, 1 camouflage */ dis.FastEntityStatePdu.prototype.getEntityAppearance_paintScheme = function() { var val = this.entityAppearance & 0x1; return val >> 0; }; /** 0 uniform color, 1 camouflage */ dis.FastEntityStatePdu.prototype.setEntityAppearance_paintScheme= function(val) { this.entityAppearance &= ~0x1; // Zero existing bits val = val << 0; this.entityAppearance = this.entityAppearance | val; }; /** 0 no mobility kill, 1 mobility kill */ dis.FastEntityStatePdu.prototype.getEntityAppearance_mobility = function() { var val = this.entityAppearance & 0x2; return val >> 1; }; /** 0 no mobility kill, 1 mobility kill */ dis.FastEntityStatePdu.prototype.setEntityAppearance_mobility= function(val) { this.entityAppearance &= ~0x2; // Zero existing bits val = val << 1; this.entityAppearance = this.entityAppearance | val; }; /** 0 no firepower iill, 1 firepower kill */ dis.FastEntityStatePdu.prototype.getEntityAppearance_firepower = function() { var val = this.entityAppearance & 0x4; return val >> 2; }; /** 0 no firepower iill, 1 firepower kill */ dis.FastEntityStatePdu.prototype.setEntityAppearance_firepower= function(val) { this.entityAppearance &= ~0x4; // Zero existing bits val = val << 2; this.entityAppearance = this.entityAppearance | val; }; /** 0 no damage, 1 slight damage, 2 moderate, 3 destroyed */ dis.FastEntityStatePdu.prototype.getEntityAppearance_damage = function() { var val = this.entityAppearance & 0x18; return val >> 3; }; /** 0 no damage, 1 slight damage, 2 moderate, 3 destroyed */ dis.FastEntityStatePdu.prototype.setEntityAppearance_damage= function(val) { this.entityAppearance &= ~0x18; // Zero existing bits val = val << 3; this.entityAppearance = this.entityAppearance | val; }; /** 0 no smoke, 1 smoke plume, 2 engine smoke, 3 engine smoke and plume */ dis.FastEntityStatePdu.prototype.getEntityAppearance_smoke = function() { var val = this.entityAppearance & 0x60; return val >> 5; }; /** 0 no smoke, 1 smoke plume, 2 engine smoke, 3 engine smoke and plume */ dis.FastEntityStatePdu.prototype.setEntityAppearance_smoke= function(val) { this.entityAppearance &= ~0x60; // Zero existing bits val = val << 5; this.entityAppearance = this.entityAppearance | val; }; /** dust cloud, 0 none 1 small 2 medium 3 large */ dis.FastEntityStatePdu.prototype.getEntityAppearance_trailingEffects = function() { var val = this.entityAppearance & 0x180; return val >> 7; }; /** dust cloud, 0 none 1 small 2 medium 3 large */ dis.FastEntityStatePdu.prototype.setEntityAppearance_trailingEffects= function(val) { this.entityAppearance &= ~0x180; // Zero existing bits val = val << 7; this.entityAppearance = this.entityAppearance | val; }; /** 0 NA 1 closed popped 3 popped and person visible 4 open 5 open and person visible */ dis.FastEntityStatePdu.prototype.getEntityAppearance_hatch = function() { var val = this.entityAppearance & 0xe00; return val >> 9; }; /** 0 NA 1 closed popped 3 popped and person visible 4 open 5 open and person visible */ dis.FastEntityStatePdu.prototype.setEntityAppearance_hatch= function(val) { this.entityAppearance &= ~0xe00; // Zero existing bits val = val << 9; this.entityAppearance = this.entityAppearance | val; }; /** 0 off 1 on */ dis.FastEntityStatePdu.prototype.getEntityAppearance_headlights = function() { var val = this.entityAppearance & 0x1000; return val >> 12; }; /** 0 off 1 on */ dis.FastEntityStatePdu.prototype.setEntityAppearance_headlights= function(val) { this.entityAppearance &= ~0x1000; // Zero existing bits val = val << 12; this.entityAppearance = this.entityAppearance | val; }; /** 0 off 1 on */ dis.FastEntityStatePdu.prototype.getEntityAppearance_tailLights = function() { var val = this.entityAppearance & 0x2000; return val >> 13; }; /** 0 off 1 on */ dis.FastEntityStatePdu.prototype.setEntityAppearance_tailLights= function(val) { this.entityAppearance &= ~0x2000; // Zero existing bits val = val << 13; this.entityAppearance = this.entityAppearance | val; }; /** 0 off 1 on */ dis.FastEntityStatePdu.prototype.getEntityAppearance_brakeLights = function() { var val = this.entityAppearance & 0x4000; return val >> 14; }; /** 0 off 1 on */ dis.FastEntityStatePdu.prototype.setEntityAppearance_brakeLights= function(val) { this.entityAppearance &= ~0x4000; // Zero existing bits val = val << 14; this.entityAppearance = this.entityAppearance | val; }; /** 0 off 1 on */ dis.FastEntityStatePdu.prototype.getEntityAppearance_flaming = function() { var val = this.entityAppearance & 0x8000; return val >> 15; }; /** 0 off 1 on */ dis.FastEntityStatePdu.prototype.setEntityAppearance_flaming= function(val) { this.entityAppearance &= ~0x8000; // Zero existing bits val = val << 15; this.entityAppearance = this.entityAppearance | val; }; /** 0 not raised 1 raised */ dis.FastEntityStatePdu.prototype.getEntityAppearance_launcher = function() { var val = this.entityAppearance & 0x10000; return val >> 16; }; /** 0 not raised 1 raised */ dis.FastEntityStatePdu.prototype.setEntityAppearance_launcher= function(val) { this.entityAppearance &= ~0x10000; // Zero existing bits val = val << 16; this.entityAppearance = this.entityAppearance | val; }; /** 0 desert 1 winter 2 forest 3 unused */ dis.FastEntityStatePdu.prototype.getEntityAppearance_camouflageType = function() { var val = this.entityAppearance & 0x60000; return val >> 17; }; /** 0 desert 1 winter 2 forest 3 unused */ dis.FastEntityStatePdu.prototype.setEntityAppearance_camouflageType= function(val) { this.entityAppearance &= ~0x60000; // Zero existing bits val = val << 17; this.entityAppearance = this.entityAppearance | val; }; }; // end of class // node.js module support exports.FastEntityStatePdu = dis.FastEntityStatePdu; // End of FastEntityStatePdu class /** * Sectioin 5.3.4.1. Information about someone firing something. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.FirePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 2; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 2; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of the entity that shot */ this.firingEntityID = new dis.EntityID(); /** ID of the entity that is being shot at */ this.targetEntityID = new dis.EntityID(); /** ID of the munition that is being shot */ this.munitionID = new dis.EntityID(); /** ID of event */ this.eventID = new dis.EventID(); this.fireMissionIndex = 0; /** location of the firing event */ this.locationInWorldCoordinates = new dis.Vector3Double(); /** Describes munitions used in the firing event */ this.burstDescriptor = new dis.BurstDescriptor(); /** Velocity of the ammunition */ this.velocity = new dis.Vector3Float(); /** range to the target. Note the word range is a SQL reserved word. */ this.rangeToTarget = 0; dis.FirePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.firingEntityID.initFromBinary(inputStream); this.targetEntityID.initFromBinary(inputStream); this.munitionID.initFromBinary(inputStream); this.eventID.initFromBinary(inputStream); this.fireMissionIndex = inputStream.readInt(); this.locationInWorldCoordinates.initFromBinary(inputStream); this.burstDescriptor.initFromBinary(inputStream); this.velocity.initFromBinary(inputStream); this.rangeToTarget = inputStream.readFloat32(); }; dis.FirePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.firingEntityID.encodeToBinary(outputStream); this.targetEntityID.encodeToBinary(outputStream); this.munitionID.encodeToBinary(outputStream); this.eventID.encodeToBinary(outputStream); outputStream.writeInt(this.fireMissionIndex); this.locationInWorldCoordinates.encodeToBinary(outputStream); this.burstDescriptor.encodeToBinary(outputStream); this.velocity.encodeToBinary(outputStream); outputStream.writeFloat32(this.rangeToTarget); }; }; // end of class // node.js module support exports.FirePdu = dis.FirePdu; // End of FirePdu class /** * Section 5.2.18. Fixed Datum Record * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.FixedDatum = function() { /** ID of the fixed datum */ this.fixedDatumID = 0; /** Value for the fixed datum */ this.fixedDatumValue = 0; dis.FixedDatum.prototype.initFromBinary = function(inputStream) { this.fixedDatumID = inputStream.readUInt(); this.fixedDatumValue = inputStream.readUInt(); }; dis.FixedDatum.prototype.encodeToBinary = function(outputStream) { outputStream.writeUInt(this.fixedDatumID); outputStream.writeUInt(this.fixedDatumValue); }; }; // end of class // node.js module support exports.FixedDatum = dis.FixedDatum; // End of FixedDatum class /** * 32 bit piece of data * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.FourByteChunk = function() { /** four bytes of arbitrary data */ this.otherParameters = new Array(0, 0, 0, 0); dis.FourByteChunk.prototype.initFromBinary = function(inputStream) { for(var idx = 0; idx < 4; idx++) { this.otherParameters[ idx ] = inputStream.readByte(); } }; dis.FourByteChunk.prototype.encodeToBinary = function(outputStream) { for(var idx = 0; idx < 4; idx++) { outputStream.writeByte(this.otherParameters[ idx ] ); } }; }; // end of class // node.js module support exports.FourByteChunk = dis.FourByteChunk; // End of FourByteChunk class /** * Section 5.2.22. Contains electromagnetic emmision regineratin parameters that are variable throughout a scenario dependent on the actions of the participants in the simulation. Also provides basic parametric data that may be used to support low-fidelity simulations. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.FundamentalParameterData = function() { /** center frequency of the emission in hertz. */ this.frequency = 0; /** Bandwidth of the frequencies corresponding to the fequency field. */ this.frequencyRange = 0; /** Effective radiated power for the emission in DdBm. For a radar noise jammer, indicates the peak of the transmitted power. */ this.effectiveRadiatedPower = 0; /** Average repetition frequency of the emission in hertz. */ this.pulseRepetitionFrequency = 0; /** Average pulse width of the emission in microseconds. */ this.pulseWidth = 0; /** Specifies the beam azimuth an elevation centers and corresponding half-angles to describe the scan volume */ this.beamAzimuthCenter = 0; /** Specifies the beam azimuth sweep to determine scan volume */ this.beamAzimuthSweep = 0; /** Specifies the beam elevation center to determine scan volume */ this.beamElevationCenter = 0; /** Specifies the beam elevation sweep to determine scan volume */ this.beamElevationSweep = 0; /** allows receiver to synchronize its regenerated scan pattern to that of the emmitter. Specifies the percentage of time a scan is through its pattern from its origion. */ this.beamSweepSync = 0; dis.FundamentalParameterData.prototype.initFromBinary = function(inputStream) { this.frequency = inputStream.readFloat32(); this.frequencyRange = inputStream.readFloat32(); this.effectiveRadiatedPower = inputStream.readFloat32(); this.pulseRepetitionFrequency = inputStream.readFloat32(); this.pulseWidth = inputStream.readFloat32(); this.beamAzimuthCenter = inputStream.readFloat32(); this.beamAzimuthSweep = inputStream.readFloat32(); this.beamElevationCenter = inputStream.readFloat32(); this.beamElevationSweep = inputStream.readFloat32(); this.beamSweepSync = inputStream.readFloat32(); }; dis.FundamentalParameterData.prototype.encodeToBinary = function(outputStream) { outputStream.writeFloat32(this.frequency); outputStream.writeFloat32(this.frequencyRange); outputStream.writeFloat32(this.effectiveRadiatedPower); outputStream.writeFloat32(this.pulseRepetitionFrequency); outputStream.writeFloat32(this.pulseWidth); outputStream.writeFloat32(this.beamAzimuthCenter); outputStream.writeFloat32(this.beamAzimuthSweep); outputStream.writeFloat32(this.beamElevationCenter); outputStream.writeFloat32(this.beamElevationSweep); outputStream.writeFloat32(this.beamSweepSync); }; }; // end of class // node.js module support exports.FundamentalParameterData = dis.FundamentalParameterData; // End of FundamentalParameterData class /** * 5.2.45. Fundamental IFF atc data * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.FundamentalParameterDataIff = function() { /** ERP */ this.erp = 0; /** frequency */ this.frequency = 0; /** pgrf */ this.pgrf = 0; /** Pulse width */ this.pulseWidth = 0; /** Burst length */ this.burstLength = 0; /** Applicable modes enumeration */ this.applicableModes = 0; /** padding */ this.pad2 = 0; /** padding */ this.pad3 = 0; dis.FundamentalParameterDataIff.prototype.initFromBinary = function(inputStream) { this.erp = inputStream.readFloat32(); this.frequency = inputStream.readFloat32(); this.pgrf = inputStream.readFloat32(); this.pulseWidth = inputStream.readFloat32(); this.burstLength = inputStream.readUInt(); this.applicableModes = inputStream.readUByte(); this.pad2 = inputStream.readUShort(); this.pad3 = inputStream.readUByte(); }; dis.FundamentalParameterDataIff.prototype.encodeToBinary = function(outputStream) { outputStream.writeFloat32(this.erp); outputStream.writeFloat32(this.frequency); outputStream.writeFloat32(this.pgrf); outputStream.writeFloat32(this.pulseWidth); outputStream.writeUInt(this.burstLength); outputStream.writeUByte(this.applicableModes); outputStream.writeUShort(this.pad2); outputStream.writeUByte(this.pad3); }; }; // end of class // node.js module support exports.FundamentalParameterDataIff = dis.FundamentalParameterDataIff; // End of FundamentalParameterDataIff class /** * 5.2.44: Grid data record, a common abstract superclass for several subtypes * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.GridAxisRecord = function() { /** type of environmental sample */ this.sampleType = 0; /** value that describes data representation */ this.dataRepresentation = 0; dis.GridAxisRecord.prototype.initFromBinary = function(inputStream) { this.sampleType = inputStream.readUShort(); this.dataRepresentation = inputStream.readUShort(); }; dis.GridAxisRecord.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.sampleType); outputStream.writeUShort(this.dataRepresentation); }; }; // end of class // node.js module support exports.GridAxisRecord = dis.GridAxisRecord; // End of GridAxisRecord class /** * 5.2.44: Grid data record, representation 0 * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.GridAxisRecordRepresentation0 = function() { /** type of environmental sample */ this.sampleType = 0; /** value that describes data representation */ this.dataRepresentation = 0; /** number of bytes of environmental state data */ this.numberOfBytes = 0; /** variable length variablelist of data parameters ^^^this is wrong--need padding as well */ this.dataValues = new Array(); dis.GridAxisRecordRepresentation0.prototype.initFromBinary = function(inputStream) { this.sampleType = inputStream.readUShort(); this.dataRepresentation = inputStream.readUShort(); this.numberOfBytes = inputStream.readUShort(); for(var idx = 0; idx < this.numberOfBytes; idx++) { var anX = new dis.OneByteChunk(); anX.initFromBinary(inputStream); this.dataValues.push(anX); } }; dis.GridAxisRecordRepresentation0.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.sampleType); outputStream.writeUShort(this.dataRepresentation); outputStream.writeUShort(this.numberOfBytes); for(var idx = 0; idx < this.dataValues.length; idx++) { dataValues[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.GridAxisRecordRepresentation0 = dis.GridAxisRecordRepresentation0; // End of GridAxisRecordRepresentation0 class /** * 5.2.44: Grid data record, representation 1 * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.GridAxisRecordRepresentation1 = function() { /** type of environmental sample */ this.sampleType = 0; /** value that describes data representation */ this.dataRepresentation = 0; /** constant scale factor */ this.fieldScale = 0; /** constant offset used to scale grid data */ this.fieldOffset = 0; /** Number of data values */ this.numberOfValues = 0; /** variable length list of data parameters ^^^this is wrong--need padding as well */ this.dataValues = new Array(); dis.GridAxisRecordRepresentation1.prototype.initFromBinary = function(inputStream) { this.sampleType = inputStream.readUShort(); this.dataRepresentation = inputStream.readUShort(); this.fieldScale = inputStream.readFloat32(); this.fieldOffset = inputStream.readFloat32(); this.numberOfValues = inputStream.readUShort(); for(var idx = 0; idx < this.numberOfValues; idx++) { var anX = new dis.TwoByteChunk(); anX.initFromBinary(inputStream); this.dataValues.push(anX); } }; dis.GridAxisRecordRepresentation1.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.sampleType); outputStream.writeUShort(this.dataRepresentation); outputStream.writeFloat32(this.fieldScale); outputStream.writeFloat32(this.fieldOffset); outputStream.writeUShort(this.numberOfValues); for(var idx = 0; idx < this.dataValues.length; idx++) { dataValues[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.GridAxisRecordRepresentation1 = dis.GridAxisRecordRepresentation1; // End of GridAxisRecordRepresentation1 class /** * 5.2.44: Grid data record, representation 1 * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.GridAxisRecordRepresentation2 = function() { /** type of environmental sample */ this.sampleType = 0; /** value that describes data representation */ this.dataRepresentation = 0; /** number of values */ this.numberOfValues = 0; /** variable length list of data parameters ^^^this is wrong--need padding as well */ this.dataValues = new Array(); dis.GridAxisRecordRepresentation2.prototype.initFromBinary = function(inputStream) { this.sampleType = inputStream.readUShort(); this.dataRepresentation = inputStream.readUShort(); this.numberOfValues = inputStream.readUShort(); for(var idx = 0; idx < this.numberOfValues; idx++) { var anX = new dis.FourByteChunk(); anX.initFromBinary(inputStream); this.dataValues.push(anX); } }; dis.GridAxisRecordRepresentation2.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.sampleType); outputStream.writeUShort(this.dataRepresentation); outputStream.writeUShort(this.numberOfValues); for(var idx = 0; idx < this.dataValues.length; idx++) { dataValues[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.GridAxisRecordRepresentation2 = dis.GridAxisRecordRepresentation2; // End of GridAxisRecordRepresentation2 class /** * Section 5.3.11.2: Information about globat, spatially varying enviornmental effects. This requires manual cleanup; the grid axis records are variable sized. UNFINISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.GriddedDataPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 42; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 9; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** environmental simulation application ID */ this.environmentalSimulationApplicationID = new dis.EntityID(); /** unique identifier for each piece of enviornmental data */ this.fieldNumber = 0; /** sequence number for the total set of PDUS used to transmit the data */ this.pduNumber = 0; /** Total number of PDUS used to transmit the data */ this.pduTotal = 0; /** coordinate system of the grid */ this.coordinateSystem = 0; /** number of grid axes for the environmental data */ this.numberOfGridAxes = 0; /** are domain grid axes identidal to those of the priveious domain update? */ this.constantGrid = 0; /** type of environment */ this.environmentType = new dis.EntityType(); /** orientation of the data grid */ this.orientation = new dis.Orientation(); /** valid time of the enviormental data sample, 64 bit unsigned int */ this.sampleTime = 0; /** total number of all data values for all pdus for an environmental sample */ this.totalValues = 0; /** total number of data values at each grid point. */ this.vectorDimension = 0; /** padding */ this.padding1 = 0; /** padding */ this.padding2 = 0; /** Grid data ^^^This is wrong */ this.gridDataList = new Array(); dis.GriddedDataPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.environmentalSimulationApplicationID.initFromBinary(inputStream); this.fieldNumber = inputStream.readUShort(); this.pduNumber = inputStream.readUShort(); this.pduTotal = inputStream.readUShort(); this.coordinateSystem = inputStream.readUShort(); this.numberOfGridAxes = inputStream.readUByte(); this.constantGrid = inputStream.readUByte(); this.environmentType.initFromBinary(inputStream); this.orientation.initFromBinary(inputStream); this.sampleTime = inputStream.readLong(); this.totalValues = inputStream.readUInt(); this.vectorDimension = inputStream.readUByte(); this.padding1 = inputStream.readUShort(); this.padding2 = inputStream.readUByte(); for(var idx = 0; idx < this.numberOfGridAxes; idx++) { var anX = new dis.GridAxisRecord(); anX.initFromBinary(inputStream); this.gridDataList.push(anX); } }; dis.GriddedDataPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.environmentalSimulationApplicationID.encodeToBinary(outputStream); outputStream.writeUShort(this.fieldNumber); outputStream.writeUShort(this.pduNumber); outputStream.writeUShort(this.pduTotal); outputStream.writeUShort(this.coordinateSystem); outputStream.writeUByte(this.numberOfGridAxes); outputStream.writeUByte(this.constantGrid); this.environmentType.encodeToBinary(outputStream); this.orientation.encodeToBinary(outputStream); outputStream.writeLong(this.sampleTime); outputStream.writeUInt(this.totalValues); outputStream.writeUByte(this.vectorDimension); outputStream.writeUShort(this.padding1); outputStream.writeUByte(this.padding2); for(var idx = 0; idx < this.gridDataList.length; idx++) { gridDataList[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.GriddedDataPdu = dis.GriddedDataPdu; // End of GriddedDataPdu class /** * 5.3.7.4.1: Navigational and IFF PDU. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.IffAtcNavAidsLayer1Pdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 28; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 6; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of the entity that is the source of the emissions */ this.emittingEntityId = new dis.EntityID(); /** Number generated by the issuing simulation to associate realted events. */ this.eventID = new dis.EventID(); /** Location wrt entity. There is some ambugiuity in the standard here, but this is the order it is listed in the table. */ this.location = new dis.Vector3Float(); /** System ID information */ this.systemID = new dis.SystemID(); /** padding */ this.pad2 = 0; /** fundamental parameters */ this.fundamentalParameters = new dis.IffFundamentalData(); dis.IffAtcNavAidsLayer1Pdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.emittingEntityId.initFromBinary(inputStream); this.eventID.initFromBinary(inputStream); this.location.initFromBinary(inputStream); this.systemID.initFromBinary(inputStream); this.pad2 = inputStream.readUShort(); this.fundamentalParameters.initFromBinary(inputStream); }; dis.IffAtcNavAidsLayer1Pdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.emittingEntityId.encodeToBinary(outputStream); this.eventID.encodeToBinary(outputStream); this.location.encodeToBinary(outputStream); this.systemID.encodeToBinary(outputStream); outputStream.writeUShort(this.pad2); this.fundamentalParameters.encodeToBinary(outputStream); }; }; // end of class // node.js module support exports.IffAtcNavAidsLayer1Pdu = dis.IffAtcNavAidsLayer1Pdu; // End of IffAtcNavAidsLayer1Pdu class /** * Section 5.3.7.4.2 When present, layer 2 should follow layer 1 and have the following fields. This requires manual cleanup. the beamData attribute semantics are used in multiple ways. UNFINSISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.IffAtcNavAidsLayer2Pdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 28; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 6; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of the entity that is the source of the emissions */ this.emittingEntityId = new dis.EntityID(); /** Number generated by the issuing simulation to associate realted events. */ this.eventID = new dis.EventID(); /** Location wrt entity. There is some ambugiuity in the standard here, but this is the order it is listed in the table. */ this.location = new dis.Vector3Float(); /** System ID information */ this.systemID = new dis.SystemID(); /** padding */ this.pad2 = 0; /** fundamental parameters */ this.fundamentalParameters = new dis.IffFundamentalData(); /** layer header */ this.layerHeader = new dis.LayerHeader(); /** beam data */ this.beamData = new dis.BeamData(); /** Secondary operational data, 5.2.57 */ this.secondaryOperationalData = new dis.BeamData(); /** variable length list of fundamental parameters. ^^^This is wrong */ this.fundamentalIffParameters = new Array(); dis.IffAtcNavAidsLayer2Pdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.emittingEntityId.initFromBinary(inputStream); this.eventID.initFromBinary(inputStream); this.location.initFromBinary(inputStream); this.systemID.initFromBinary(inputStream); this.pad2 = inputStream.readUShort(); this.fundamentalParameters.initFromBinary(inputStream); this.layerHeader.initFromBinary(inputStream); this.beamData.initFromBinary(inputStream); this.secondaryOperationalData.initFromBinary(inputStream); for(var idx = 0; idx < this.pad2; idx++) { var anX = new dis.FundamentalParameterDataIff(); anX.initFromBinary(inputStream); this.fundamentalIffParameters.push(anX); } }; dis.IffAtcNavAidsLayer2Pdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.emittingEntityId.encodeToBinary(outputStream); this.eventID.encodeToBinary(outputStream); this.location.encodeToBinary(outputStream); this.systemID.encodeToBinary(outputStream); outputStream.writeUShort(this.pad2); this.fundamentalParameters.encodeToBinary(outputStream); this.layerHeader.encodeToBinary(outputStream); this.beamData.encodeToBinary(outputStream); this.secondaryOperationalData.encodeToBinary(outputStream); for(var idx = 0; idx < this.fundamentalIffParameters.length; idx++) { fundamentalIffParameters[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.IffAtcNavAidsLayer2Pdu = dis.IffAtcNavAidsLayer2Pdu; // End of IffAtcNavAidsLayer2Pdu class /** * 5.2.42. Basic operational data ofr IFF ATC NAVAIDS * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.IffFundamentalData = function() { /** system status */ this.systemStatus = 0; /** Alternate parameter 4 */ this.alternateParameter4 = 0; /** eight boolean fields */ this.informationLayers = 0; /** enumeration */ this.modifier = 0; /** parameter, enumeration */ this.parameter1 = 0; /** parameter, enumeration */ this.parameter2 = 0; /** parameter, enumeration */ this.parameter3 = 0; /** parameter, enumeration */ this.parameter4 = 0; /** parameter, enumeration */ this.parameter5 = 0; /** parameter, enumeration */ this.parameter6 = 0; dis.IffFundamentalData.prototype.initFromBinary = function(inputStream) { this.systemStatus = inputStream.readUByte(); this.alternateParameter4 = inputStream.readUByte(); this.informationLayers = inputStream.readUByte(); this.modifier = inputStream.readUByte(); this.parameter1 = inputStream.readUShort(); this.parameter2 = inputStream.readUShort(); this.parameter3 = inputStream.readUShort(); this.parameter4 = inputStream.readUShort(); this.parameter5 = inputStream.readUShort(); this.parameter6 = inputStream.readUShort(); }; dis.IffFundamentalData.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.systemStatus); outputStream.writeUByte(this.alternateParameter4); outputStream.writeUByte(this.informationLayers); outputStream.writeUByte(this.modifier); outputStream.writeUShort(this.parameter1); outputStream.writeUShort(this.parameter2); outputStream.writeUShort(this.parameter3); outputStream.writeUShort(this.parameter4); outputStream.writeUShort(this.parameter5); outputStream.writeUShort(this.parameter6); }; }; // end of class // node.js module support exports.IffFundamentalData = dis.IffFundamentalData; // End of IffFundamentalData class /** * 5.2.46. Intercom communcations parameters * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.IntercomCommunicationsParameters = function() { /** Type of intercom parameters record */ this.recordType = 0; /** length of record-specifid field, in octets */ this.recordLength = 0; /** variable length variablelist of data parameters */ this.parameterValues = new Array(); dis.IntercomCommunicationsParameters.prototype.initFromBinary = function(inputStream) { this.recordType = inputStream.readUShort(); this.recordLength = inputStream.readUShort(); for(var idx = 0; idx < this.recordLength; idx++) { var anX = new dis.OneByteChunk(); anX.initFromBinary(inputStream); this.parameterValues.push(anX); } }; dis.IntercomCommunicationsParameters.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.recordType); outputStream.writeUShort(this.recordLength); for(var idx = 0; idx < this.parameterValues.length; idx++) { parameterValues[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.IntercomCommunicationsParameters = dis.IntercomCommunicationsParameters; // End of IntercomCommunicationsParameters class /** * Section 5.3.8.5. Detailed inofrmation about the state of an intercom device and the actions it is requestion of another intercom device, or the response to a requested action. Required manual intervention to fix the intercom parameters, which can be of varialbe length. UNFINSISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.IntercomControlPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 32; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 4; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** control type */ this.controlType = 0; /** control type */ this.communicationsChannelType = 0; /** Source entity ID */ this.sourceEntityID = new dis.EntityID(); /** The specific intercom device being simulated within an entity. */ this.sourceCommunicationsDeviceID = 0; /** Line number to which the intercom control refers */ this.sourceLineID = 0; /** priority of this message relative to transmissons from other intercom devices */ this.transmitPriority = 0; /** current transmit state of the line */ this.transmitLineState = 0; /** detailed type requested. */ this.command = 0; /** eid of the entity that has created this intercom channel. */ this.masterEntityID = new dis.EntityID(); /** specific intercom device that has created this intercom channel */ this.masterCommunicationsDeviceID = 0; /** number of intercom parameters */ this.intercomParametersLength = 0; /** Must be */ this.intercomParameters = new Array(); dis.IntercomControlPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.controlType = inputStream.readUByte(); this.communicationsChannelType = inputStream.readUByte(); this.sourceEntityID.initFromBinary(inputStream); this.sourceCommunicationsDeviceID = inputStream.readUByte(); this.sourceLineID = inputStream.readUByte(); this.transmitPriority = inputStream.readUByte(); this.transmitLineState = inputStream.readUByte(); this.command = inputStream.readUByte(); this.masterEntityID.initFromBinary(inputStream); this.masterCommunicationsDeviceID = inputStream.readUShort(); this.intercomParametersLength = inputStream.readUInt(); for(var idx = 0; idx < this.intercomParametersLength; idx++) { var anX = new dis.IntercomCommunicationsParameters(); anX.initFromBinary(inputStream); this.intercomParameters.push(anX); } }; dis.IntercomControlPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); outputStream.writeUByte(this.controlType); outputStream.writeUByte(this.communicationsChannelType); this.sourceEntityID.encodeToBinary(outputStream); outputStream.writeUByte(this.sourceCommunicationsDeviceID); outputStream.writeUByte(this.sourceLineID); outputStream.writeUByte(this.transmitPriority); outputStream.writeUByte(this.transmitLineState); outputStream.writeUByte(this.command); this.masterEntityID.encodeToBinary(outputStream); outputStream.writeUShort(this.masterCommunicationsDeviceID); outputStream.writeUInt(this.intercomParametersLength); for(var idx = 0; idx < this.intercomParameters.length; idx++) { intercomParameters[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.IntercomControlPdu = dis.IntercomControlPdu; // End of IntercomControlPdu class /** * Section 5.3.8.4. Actual transmission of intercome voice data. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.IntercomSignalPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 31; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 4; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of the entitythat is the source of the communication */ this.entityId = new dis.EntityID(); /** particular radio within an entity */ this.communicationsDeviceID = 0; /** encoding scheme */ this.encodingScheme = 0; /** tactical data link type */ this.tdlType = 0; /** sample rate */ this.sampleRate = 0; /** data length, in bits */ this.dataLength = 0; /** samples */ this.samples = 0; /** data bytes */ this.data = new Array(); dis.IntercomSignalPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.entityId.initFromBinary(inputStream); this.communicationsDeviceID = inputStream.readUShort(); this.encodingScheme = inputStream.readUShort(); this.tdlType = inputStream.readUShort(); this.sampleRate = inputStream.readUInt(); this.dataLength = inputStream.readUShort(); this.samples = inputStream.readUShort(); for(var idx = 0; idx < this.dataLength; idx++) { var anX = new dis.OneByteChunk(); anX.initFromBinary(inputStream); this.data.push(anX); } }; dis.IntercomSignalPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.entityId.encodeToBinary(outputStream); outputStream.writeUShort(this.communicationsDeviceID); outputStream.writeUShort(this.encodingScheme); outputStream.writeUShort(this.tdlType); outputStream.writeUInt(this.sampleRate); outputStream.writeUShort(this.dataLength); outputStream.writeUShort(this.samples); for(var idx = 0; idx < this.data.length; idx++) { data[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.IntercomSignalPdu = dis.IntercomSignalPdu; // End of IntercomSignalPdu class /** * Section 5.3.9.2 Information about a particular group of entities grouped together for the purposes of netowrk bandwidth reduction or aggregation. Needs manual cleanup. The GED size requires a database lookup. UNFINISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.IsGroupOfPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 34; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 7; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of aggregated entities */ this.groupEntityID = new dis.EntityID(); /** type of entities constituting the group */ this.groupedEntityCategory = 0; /** Number of individual entities constituting the group */ this.numberOfGroupedEntities = 0; /** padding */ this.pad2 = 0; /** latitude */ this.latitude = 0; /** longitude */ this.longitude = 0; /** GED records about each individual entity in the group. ^^^this is wrong--need a database lookup to find the actual size of the list elements */ this.groupedEntityDescriptions = new Array(); dis.IsGroupOfPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.groupEntityID.initFromBinary(inputStream); this.groupedEntityCategory = inputStream.readUByte(); this.numberOfGroupedEntities = inputStream.readUByte(); this.pad2 = inputStream.readUInt(); this.latitude = inputStream.readFloat64(); this.longitude = inputStream.readFloat64(); for(var idx = 0; idx < this.numberOfGroupedEntities; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.groupedEntityDescriptions.push(anX); } }; dis.IsGroupOfPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.groupEntityID.encodeToBinary(outputStream); outputStream.writeUByte(this.groupedEntityCategory); outputStream.writeUByte(this.numberOfGroupedEntities); outputStream.writeUInt(this.pad2); outputStream.writeFloat64(this.latitude); outputStream.writeFloat64(this.longitude); for(var idx = 0; idx < this.groupedEntityDescriptions.length; idx++) { groupedEntityDescriptions[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.IsGroupOfPdu = dis.IsGroupOfPdu; // End of IsGroupOfPdu class /** * Section 5.3.9.4 The joining of two or more simulation entities is communicated by this PDU. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.IsPartOfPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 36; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 7; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of entity originating PDU */ this.orginatingEntityID = new dis.EntityID(); /** ID of entity receiving PDU */ this.receivingEntityID = new dis.EntityID(); /** relationship of joined parts */ this.relationship = new dis.Relationship(); /** location of part; centroid of part in host's coordinate system. x=range, y=bearing, z=0 */ this.partLocation = new dis.Vector3Float(); /** named location */ this.namedLocationID = new dis.NamedLocation(); /** entity type */ this.partEntityType = new dis.EntityType(); dis.IsPartOfPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.orginatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.relationship.initFromBinary(inputStream); this.partLocation.initFromBinary(inputStream); this.namedLocationID.initFromBinary(inputStream); this.partEntityType.initFromBinary(inputStream); }; dis.IsPartOfPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.orginatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); this.relationship.encodeToBinary(outputStream); this.partLocation.encodeToBinary(outputStream); this.namedLocationID.encodeToBinary(outputStream); this.partEntityType.encodeToBinary(outputStream); }; }; // end of class // node.js module support exports.IsPartOfPdu = dis.IsPartOfPdu; // End of IsPartOfPdu class /** * 5.2.47. Layer header. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.LayerHeader = function() { /** Layer number */ this.layerNumber = 0; /** Layer speccific information enumeration */ this.layerSpecificInformaiton = 0; /** information length */ this.length = 0; dis.LayerHeader.prototype.initFromBinary = function(inputStream) { this.layerNumber = inputStream.readUByte(); this.layerSpecificInformaiton = inputStream.readUByte(); this.length = inputStream.readUShort(); }; dis.LayerHeader.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.layerNumber); outputStream.writeUByte(this.layerSpecificInformaiton); outputStream.writeUShort(this.length); }; }; // end of class // node.js module support exports.LayerHeader = dis.LayerHeader; // End of LayerHeader class /** * Section 5.3.11.4: Information abut the addition or modification of a synthecic enviroment object that is anchored to the terrain with a single point and has size or orientation. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.LinearObjectStatePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 44; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 9; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object in synthetic environment */ this.objectID = new dis.EntityID(); /** Object with which this point object is associated */ this.referencedObjectID = new dis.EntityID(); /** unique update number of each state transition of an object */ this.updateNumber = 0; /** force ID */ this.forceID = 0; /** number of linear segment parameters */ this.numberOfSegments = 0; /** requesterID */ this.requesterID = new dis.SimulationAddress(); /** receiver ID */ this.receivingID = new dis.SimulationAddress(); /** Object type */ this.objectType = new dis.ObjectType(); /** Linear segment parameters */ this.linearSegmentParameters = new Array(); dis.LinearObjectStatePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.objectID.initFromBinary(inputStream); this.referencedObjectID.initFromBinary(inputStream); this.updateNumber = inputStream.readUShort(); this.forceID = inputStream.readUByte(); this.numberOfSegments = inputStream.readUByte(); this.requesterID.initFromBinary(inputStream); this.receivingID.initFromBinary(inputStream); this.objectType.initFromBinary(inputStream); for(var idx = 0; idx < this.numberOfSegments; idx++) { var anX = new dis.LinearSegmentParameter(); anX.initFromBinary(inputStream); this.linearSegmentParameters.push(anX); } }; dis.LinearObjectStatePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.objectID.encodeToBinary(outputStream); this.referencedObjectID.encodeToBinary(outputStream); outputStream.writeUShort(this.updateNumber); outputStream.writeUByte(this.forceID); outputStream.writeUByte(this.numberOfSegments); this.requesterID.encodeToBinary(outputStream); this.receivingID.encodeToBinary(outputStream); this.objectType.encodeToBinary(outputStream); for(var idx = 0; idx < this.linearSegmentParameters.length; idx++) { linearSegmentParameters[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.LinearObjectStatePdu = dis.LinearObjectStatePdu; // End of LinearObjectStatePdu class /** * 5.2.48: Linear segment parameters * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.LinearSegmentParameter = function() { /** number of segments */ this.segmentNumber = 0; /** segment appearance */ this.segmentAppearance = new dis.SixByteChunk(); /** location */ this.location = new dis.Vector3Double(); /** orientation */ this.orientation = new dis.Orientation(); /** segmentLength */ this.segmentLength = 0; /** segmentWidth */ this.segmentWidth = 0; /** segmentHeight */ this.segmentHeight = 0; /** segment Depth */ this.segmentDepth = 0; /** segment Depth */ this.pad1 = 0; dis.LinearSegmentParameter.prototype.initFromBinary = function(inputStream) { this.segmentNumber = inputStream.readUByte(); this.segmentAppearance.initFromBinary(inputStream); this.location.initFromBinary(inputStream); this.orientation.initFromBinary(inputStream); this.segmentLength = inputStream.readUShort(); this.segmentWidth = inputStream.readUShort(); this.segmentHeight = inputStream.readUShort(); this.segmentDepth = inputStream.readUShort(); this.pad1 = inputStream.readUInt(); }; dis.LinearSegmentParameter.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.segmentNumber); this.segmentAppearance.encodeToBinary(outputStream); this.location.encodeToBinary(outputStream); this.orientation.encodeToBinary(outputStream); outputStream.writeUShort(this.segmentLength); outputStream.writeUShort(this.segmentWidth); outputStream.writeUShort(this.segmentHeight); outputStream.writeUShort(this.segmentDepth); outputStream.writeUInt(this.pad1); }; }; // end of class // node.js module support exports.LinearSegmentParameter = dis.LinearSegmentParameter; // End of LinearSegmentParameter class /** * Section 5.3.5. Abstract superclass for logistics PDUs. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.LogisticsFamilyPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 0; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 3; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; dis.LogisticsFamilyPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); }; dis.LogisticsFamilyPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); }; }; // end of class // node.js module support exports.LogisticsFamilyPdu = dis.LogisticsFamilyPdu; // End of LogisticsFamilyPdu class /** * Section 5.2.15. Specifies the character set used inthe first byte, followed by 11 characters of text data. * The generated Marking class should be augmented with a patch that adds getMarking() and * setMarking() methods that convert between arrays and strings, and clamp the length * of the string to 11 characters. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.Marking = function() { /** The character set */ this.characterSet = 0; /** The characters */ this.characters = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); dis.Marking.prototype.initFromBinary = function(inputStream) { this.characterSet = inputStream.readUByte(); for(var idx = 0; idx < 11; idx++) { this.characters[ idx ] = inputStream.readByte(); } }; dis.Marking.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.characterSet); for(var idx = 0; idx < 11; idx++) { outputStream.writeByte(this.characters[ idx ] ); } }; /* * Returns the byte array marking, in string format. * @return string format marking characters */ dis.Marking.prototype.getMarking = function() { var marking = ""; for(var idx = 0; idx < 11; idx++) { marking = marking + String.fromCharCode(this.characters[idx]); } return marking; }; /** * Given a string format marking, sets the bytes of the marking object * to the appropriate character values. Clamps the string to no more * than 11 characters. * * @param {String} newMarking string format marking * @returns {nothing} */ dis.Marking.prototype.setMarking = function(newMarking) { var stringLen = newMarking.length; if(stringLen > 11) stringLen = 11; // Copy over up to 11 characters from the string to the array var charsCopied = 0; while(charsCopied < stringLen) { this.characters[charsCopied] = newMarking.charCodeAt( charsCopied ); charsCopied++; } // Zero-fill the remainer of the character array while(charsCopied < 11) { this.characters[ charsCopied ] = 0; charsCopied++; } }; }; // end of class // node.js module support exports.Marking = dis.Marking; // End of Marking class /** * Section 5.3.10.3 Information about individual mines within a minefield. This is very, very wrong. UNFINISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.MinefieldDataPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 39; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 8; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Minefield ID */ this.minefieldID = new dis.EntityID(); /** ID of entity making request */ this.requestingEntityID = new dis.EntityID(); /** Minefield sequence number */ this.minefieldSequenceNumbeer = 0; /** request ID */ this.requestID = 0; /** pdu sequence number */ this.pduSequenceNumber = 0; /** number of pdus in response */ this.numberOfPdus = 0; /** how many mines are in this PDU */ this.numberOfMinesInThisPdu = 0; /** how many sensor type are in this PDU */ this.numberOfSensorTypes = 0; /** padding */ this.pad2 = 0; /** 32 boolean fields */ this.dataFilter = 0; /** Mine type */ this.mineType = new dis.EntityType(); /** Sensor types, each 16 bits long */ this.sensorTypes = new Array(); /** Padding to get things 32-bit aligned. ^^^this is wrong--dyanmically sized padding needed */ this.pad3 = 0; /** Mine locations */ this.mineLocation = new Array(); dis.MinefieldDataPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.minefieldID.initFromBinary(inputStream); this.requestingEntityID.initFromBinary(inputStream); this.minefieldSequenceNumbeer = inputStream.readUShort(); this.requestID = inputStream.readUByte(); this.pduSequenceNumber = inputStream.readUByte(); this.numberOfPdus = inputStream.readUByte(); this.numberOfMinesInThisPdu = inputStream.readUByte(); this.numberOfSensorTypes = inputStream.readUByte(); this.pad2 = inputStream.readUByte(); this.dataFilter = inputStream.readUInt(); this.mineType.initFromBinary(inputStream); for(var idx = 0; idx < this.numberOfSensorTypes; idx++) { var anX = new dis.TwoByteChunk(); anX.initFromBinary(inputStream); this.sensorTypes.push(anX); } this.pad3 = inputStream.readUByte(); for(var idx = 0; idx < this.numberOfMinesInThisPdu; idx++) { var anX = new dis.Vector3Float(); anX.initFromBinary(inputStream); this.mineLocation.push(anX); } }; dis.MinefieldDataPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.minefieldID.encodeToBinary(outputStream); this.requestingEntityID.encodeToBinary(outputStream); outputStream.writeUShort(this.minefieldSequenceNumbeer); outputStream.writeUByte(this.requestID); outputStream.writeUByte(this.pduSequenceNumber); outputStream.writeUByte(this.numberOfPdus); outputStream.writeUByte(this.numberOfMinesInThisPdu); outputStream.writeUByte(this.numberOfSensorTypes); outputStream.writeUByte(this.pad2); outputStream.writeUInt(this.dataFilter); this.mineType.encodeToBinary(outputStream); for(var idx = 0; idx < this.sensorTypes.length; idx++) { sensorTypes[idx].encodeToBinary(outputStream); } outputStream.writeUByte(this.pad3); for(var idx = 0; idx < this.mineLocation.length; idx++) { mineLocation[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.MinefieldDataPdu = dis.MinefieldDataPdu; // End of MinefieldDataPdu class /** * Section 5.3.10.1 Abstract superclass for PDUs relating to minefields * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.MinefieldFamilyPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 0; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 8; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; dis.MinefieldFamilyPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); }; dis.MinefieldFamilyPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); }; }; // end of class // node.js module support exports.MinefieldFamilyPdu = dis.MinefieldFamilyPdu; // End of MinefieldFamilyPdu class /** * Section 5.3.10.2 Query a minefield for information about individual mines. Requires manual clean up to get the padding right. UNFINISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.MinefieldQueryPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 38; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 8; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Minefield ID */ this.minefieldID = new dis.EntityID(); /** EID of entity making the request */ this.requestingEntityID = new dis.EntityID(); /** request ID */ this.requestID = 0; /** Number of perimeter points for the minefield */ this.numberOfPerimeterPoints = 0; /** Padding */ this.pad2 = 0; /** Number of sensor types */ this.numberOfSensorTypes = 0; /** data filter, 32 boolean fields */ this.dataFilter = 0; /** Entity type of mine being requested */ this.requestedMineType = new dis.EntityType(); /** perimeter points of request */ this.requestedPerimeterPoints = new Array(); /** Sensor types, each 16 bits long */ this.sensorTypes = new Array(); dis.MinefieldQueryPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.minefieldID.initFromBinary(inputStream); this.requestingEntityID.initFromBinary(inputStream); this.requestID = inputStream.readUByte(); this.numberOfPerimeterPoints = inputStream.readUByte(); this.pad2 = inputStream.readUByte(); this.numberOfSensorTypes = inputStream.readUByte(); this.dataFilter = inputStream.readUInt(); this.requestedMineType.initFromBinary(inputStream); for(var idx = 0; idx < this.numberOfPerimeterPoints; idx++) { var anX = new dis.Point(); anX.initFromBinary(inputStream); this.requestedPerimeterPoints.push(anX); } for(var idx = 0; idx < this.numberOfSensorTypes; idx++) { var anX = new dis.TwoByteChunk(); anX.initFromBinary(inputStream); this.sensorTypes.push(anX); } }; dis.MinefieldQueryPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.minefieldID.encodeToBinary(outputStream); this.requestingEntityID.encodeToBinary(outputStream); outputStream.writeUByte(this.requestID); outputStream.writeUByte(this.numberOfPerimeterPoints); outputStream.writeUByte(this.pad2); outputStream.writeUByte(this.numberOfSensorTypes); outputStream.writeUInt(this.dataFilter); this.requestedMineType.encodeToBinary(outputStream); for(var idx = 0; idx < this.requestedPerimeterPoints.length; idx++) { requestedPerimeterPoints[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.sensorTypes.length; idx++) { sensorTypes[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.MinefieldQueryPdu = dis.MinefieldQueryPdu; // End of MinefieldQueryPdu class /** * Section 5.3.10.4 proivde the means to request a retransmit of a minefield data pdu. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.MinefieldResponseNackPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 40; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 8; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Minefield ID */ this.minefieldID = new dis.EntityID(); /** entity ID making the request */ this.requestingEntityID = new dis.EntityID(); /** request ID */ this.requestID = 0; /** how many pdus were missing */ this.numberOfMissingPdus = 0; /** PDU sequence numbers that were missing */ this.missingPduSequenceNumbers = new Array(); dis.MinefieldResponseNackPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.minefieldID.initFromBinary(inputStream); this.requestingEntityID.initFromBinary(inputStream); this.requestID = inputStream.readUByte(); this.numberOfMissingPdus = inputStream.readUByte(); for(var idx = 0; idx < this.numberOfMissingPdus; idx++) { var anX = new dis.EightByteChunk(); anX.initFromBinary(inputStream); this.missingPduSequenceNumbers.push(anX); } }; dis.MinefieldResponseNackPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.minefieldID.encodeToBinary(outputStream); this.requestingEntityID.encodeToBinary(outputStream); outputStream.writeUByte(this.requestID); outputStream.writeUByte(this.numberOfMissingPdus); for(var idx = 0; idx < this.missingPduSequenceNumbers.length; idx++) { missingPduSequenceNumbers[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.MinefieldResponseNackPdu = dis.MinefieldResponseNackPdu; // End of MinefieldResponseNackPdu class /** * Section 5.3.10.1 Abstract superclass for PDUs relating to minefields. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.MinefieldStatePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 37; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 8; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Minefield ID */ this.minefieldID = new dis.EntityID(); /** Minefield sequence */ this.minefieldSequence = 0; /** force ID */ this.forceID = 0; /** Number of permieter points */ this.numberOfPerimeterPoints = 0; /** type of minefield */ this.minefieldType = new dis.EntityType(); /** how many mine types */ this.numberOfMineTypes = 0; /** location of minefield in world coords */ this.minefieldLocation = new dis.Vector3Double(); /** orientation of minefield */ this.minefieldOrientation = new dis.Orientation(); /** appearance bitflags */ this.appearance = 0; /** protocolMode */ this.protocolMode = 0; /** perimeter points for the minefield */ this.perimeterPoints = new Array(); /** Type of mines */ this.mineType = new Array(); dis.MinefieldStatePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.minefieldID.initFromBinary(inputStream); this.minefieldSequence = inputStream.readUShort(); this.forceID = inputStream.readUByte(); this.numberOfPerimeterPoints = inputStream.readUByte(); this.minefieldType.initFromBinary(inputStream); this.numberOfMineTypes = inputStream.readUShort(); this.minefieldLocation.initFromBinary(inputStream); this.minefieldOrientation.initFromBinary(inputStream); this.appearance = inputStream.readUShort(); this.protocolMode = inputStream.readUShort(); for(var idx = 0; idx < this.numberOfPerimeterPoints; idx++) { var anX = new dis.Point(); anX.initFromBinary(inputStream); this.perimeterPoints.push(anX); } for(var idx = 0; idx < this.numberOfMineTypes; idx++) { var anX = new dis.EntityType(); anX.initFromBinary(inputStream); this.mineType.push(anX); } }; dis.MinefieldStatePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.minefieldID.encodeToBinary(outputStream); outputStream.writeUShort(this.minefieldSequence); outputStream.writeUByte(this.forceID); outputStream.writeUByte(this.numberOfPerimeterPoints); this.minefieldType.encodeToBinary(outputStream); outputStream.writeUShort(this.numberOfMineTypes); this.minefieldLocation.encodeToBinary(outputStream); this.minefieldOrientation.encodeToBinary(outputStream); outputStream.writeUShort(this.appearance); outputStream.writeUShort(this.protocolMode); for(var idx = 0; idx < this.perimeterPoints.length; idx++) { perimeterPoints[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.mineType.length; idx++) { mineType[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.MinefieldStatePdu = dis.MinefieldStatePdu; // End of MinefieldStatePdu class /** * Radio modulation * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ModulationType = function() { /** spread spectrum, 16 bit boolean array */ this.spreadSpectrum = 0; /** major */ this.major = 0; /** detail */ this.detail = 0; /** system */ this.system = 0; dis.ModulationType.prototype.initFromBinary = function(inputStream) { this.spreadSpectrum = inputStream.readUShort(); this.major = inputStream.readUShort(); this.detail = inputStream.readUShort(); this.system = inputStream.readUShort(); }; dis.ModulationType.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.spreadSpectrum); outputStream.writeUShort(this.major); outputStream.writeUShort(this.detail); outputStream.writeUShort(this.system); }; }; // end of class // node.js module support exports.ModulationType = dis.ModulationType; // End of ModulationType class /** * discrete ostional relationsihip * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.NamedLocation = function() { /** station name enumeration */ this.stationName = 0; /** station number */ this.stationNumber = 0; dis.NamedLocation.prototype.initFromBinary = function(inputStream) { this.stationName = inputStream.readUShort(); this.stationNumber = inputStream.readUShort(); }; dis.NamedLocation.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.stationName); outputStream.writeUShort(this.stationNumber); }; }; // end of class // node.js module support exports.NamedLocation = dis.NamedLocation; // End of NamedLocation class /** * Identifies type of object. This is a shorter version of EntityType that omits the specific and extra fields. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ObjectType = function() { /** Kind of entity */ this.entityKind = 0; /** Domain of entity (air, surface, subsurface, space, etc) */ this.domain = 0; /** country to which the design of the entity is attributed */ this.country = 0; /** category of entity */ this.category = 0; /** subcategory of entity */ this.subcategory = 0; dis.ObjectType.prototype.initFromBinary = function(inputStream) { this.entityKind = inputStream.readUByte(); this.domain = inputStream.readUByte(); this.country = inputStream.readUShort(); this.category = inputStream.readUByte(); this.subcategory = inputStream.readUByte(); }; dis.ObjectType.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.entityKind); outputStream.writeUByte(this.domain); outputStream.writeUShort(this.country); outputStream.writeUByte(this.category); outputStream.writeUByte(this.subcategory); }; }; // end of class // node.js module support exports.ObjectType = dis.ObjectType; // End of ObjectType class /** * 8 bit piece of data * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.OneByteChunk = function() { /** one byte of arbitrary data */ this.otherParameters = new Array(0); dis.OneByteChunk.prototype.initFromBinary = function(inputStream) { for(var idx = 0; idx < 1; idx++) { this.otherParameters[ idx ] = inputStream.readByte(); } }; dis.OneByteChunk.prototype.encodeToBinary = function(outputStream) { for(var idx = 0; idx < 1; idx++) { outputStream.writeByte(this.otherParameters[ idx ] ); } }; }; // end of class // node.js module support exports.OneByteChunk = dis.OneByteChunk; // End of OneByteChunk class /** * Section 5.2.17. Three floating point values representing an orientation, psi, theta, and phi, aka the euler angles, in radians * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.Orientation = function() { this.psi = 0; this.theta = 0; this.phi = 0; dis.Orientation.prototype.initFromBinary = function(inputStream) { this.psi = inputStream.readFloat32(); this.theta = inputStream.readFloat32(); this.phi = inputStream.readFloat32(); }; dis.Orientation.prototype.encodeToBinary = function(outputStream) { outputStream.writeFloat32(this.psi); outputStream.writeFloat32(this.theta); outputStream.writeFloat32(this.phi); }; }; // end of class // node.js module support exports.Orientation = dis.Orientation; // End of Orientation class /** * The superclass for all PDUs. This incorporates the PduHeader record, section 5.2.29. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.Pdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 0; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 0; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; dis.Pdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); }; dis.Pdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); }; }; // end of class // node.js module support exports.Pdu = dis.Pdu; // End of Pdu class /** * A container that holds PDUs * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.PduContainer = function() { /** Number of PDUs in the container list */ this.numberOfPdus = 0; /** List of PDUs */ this.pdus = new Array(); dis.PduContainer.prototype.initFromBinary = function(inputStream) { this.numberOfPdus = inputStream.readInt(); for(var idx = 0; idx < this.numberOfPdus; idx++) { var anX = new dis.Pdu(); anX.initFromBinary(inputStream); this.pdus.push(anX); } }; dis.PduContainer.prototype.encodeToBinary = function(outputStream) { outputStream.writeInt(this.numberOfPdus); for(var idx = 0; idx < this.pdus.length; idx++) { pdus[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.PduContainer = dis.PduContainer; // End of PduContainer class /** * Non-DIS class, used to describe streams of PDUs when logging to SQL databases * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.PduStream = function() { /** short description of this PDU stream */ this.shortDescription = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); /** Longish description of this PDU stream */ this.longDescription = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); /** Name of person performing recording */ this.personRecording = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); /** Email of person performing recording */ this.authorEmail = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); /** Start time of recording, in Unix time */ this.startTime = 0; /** stop time of recording, in Unix time */ this.stopTime = 0; /** how many PDUs in this stream */ this.pduCount = 0; /** variable length list of PDUs */ this.pdusInStream = new Array(); dis.PduStream.prototype.initFromBinary = function(inputStream) { for(var idx = 0; idx < 256; idx++) { this.shortDescription[ idx ] = inputStream.readByte(); } for(var idx = 0; idx < 512; idx++) { this.longDescription[ idx ] = inputStream.readByte(); } for(var idx = 0; idx < 128; idx++) { this.personRecording[ idx ] = inputStream.readByte(); } for(var idx = 0; idx < 128; idx++) { this.authorEmail[ idx ] = inputStream.readByte(); } this.startTime = inputStream.readLong(); this.stopTime = inputStream.readLong(); this.pduCount = inputStream.readUInt(); for(var idx = 0; idx < this.pduCount; idx++) { var anX = new dis.Pdu(); anX.initFromBinary(inputStream); this.pdusInStream.push(anX); } }; dis.PduStream.prototype.encodeToBinary = function(outputStream) { for(var idx = 0; idx < 256; idx++) { outputStream.writeByte(this.shortDescription[ idx ] ); } for(var idx = 0; idx < 512; idx++) { outputStream.writeByte(this.longDescription[ idx ] ); } for(var idx = 0; idx < 128; idx++) { outputStream.writeByte(this.personRecording[ idx ] ); } for(var idx = 0; idx < 128; idx++) { outputStream.writeByte(this.authorEmail[ idx ] ); } outputStream.writeLong(this.startTime); outputStream.writeLong(this.stopTime); outputStream.writeUInt(this.pduCount); for(var idx = 0; idx < this.pdusInStream.length; idx++) { pdusInStream[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.PduStream = dis.PduStream; // End of PduStream class /** * x,y point * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.Point = function() { /** x */ this.x = 0; /** y */ this.y = 0; dis.Point.prototype.initFromBinary = function(inputStream) { this.x = inputStream.readFloat32(); this.y = inputStream.readFloat32(); }; dis.Point.prototype.encodeToBinary = function(outputStream) { outputStream.writeFloat32(this.x); outputStream.writeFloat32(this.y); }; }; // end of class // node.js module support exports.Point = dis.Point; // End of Point class /** * Section 5.3.11.3: Inormation abut the addition or modification of a synthecic enviroment object that is anchored to the terrain with a single point. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.PointObjectStatePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 43; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 9; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object in synthetic environment */ this.objectID = new dis.EntityID(); /** Object with which this point object is associated */ this.referencedObjectID = new dis.EntityID(); /** unique update number of each state transition of an object */ this.updateNumber = 0; /** force ID */ this.forceID = 0; /** modifications */ this.modifications = 0; /** Object type */ this.objectType = new dis.ObjectType(); /** Object location */ this.objectLocation = new dis.Vector3Double(); /** Object orientation */ this.objectOrientation = new dis.Orientation(); /** Object apperance */ this.objectAppearance = 0; /** requesterID */ this.requesterID = new dis.SimulationAddress(); /** receiver ID */ this.receivingID = new dis.SimulationAddress(); /** padding */ this.pad2 = 0; dis.PointObjectStatePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.objectID.initFromBinary(inputStream); this.referencedObjectID.initFromBinary(inputStream); this.updateNumber = inputStream.readUShort(); this.forceID = inputStream.readUByte(); this.modifications = inputStream.readUByte(); this.objectType.initFromBinary(inputStream); this.objectLocation.initFromBinary(inputStream); this.objectOrientation.initFromBinary(inputStream); this.objectAppearance = inputStream.readFloat64(); this.requesterID.initFromBinary(inputStream); this.receivingID.initFromBinary(inputStream); this.pad2 = inputStream.readUInt(); }; dis.PointObjectStatePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.objectID.encodeToBinary(outputStream); this.referencedObjectID.encodeToBinary(outputStream); outputStream.writeUShort(this.updateNumber); outputStream.writeUByte(this.forceID); outputStream.writeUByte(this.modifications); this.objectType.encodeToBinary(outputStream); this.objectLocation.encodeToBinary(outputStream); this.objectOrientation.encodeToBinary(outputStream); outputStream.writeFloat64(this.objectAppearance); this.requesterID.encodeToBinary(outputStream); this.receivingID.encodeToBinary(outputStream); outputStream.writeUInt(this.pad2); }; }; // end of class // node.js module support exports.PointObjectStatePdu = dis.PointObjectStatePdu; // End of PointObjectStatePdu class /** * Data about a propulsion system * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.PropulsionSystemData = function() { /** powerSetting */ this.powerSetting = 0; /** engine RPMs */ this.engineRpm = 0; dis.PropulsionSystemData.prototype.initFromBinary = function(inputStream) { this.powerSetting = inputStream.readFloat32(); this.engineRpm = inputStream.readFloat32(); }; dis.PropulsionSystemData.prototype.encodeToBinary = function(outputStream) { outputStream.writeFloat32(this.powerSetting); outputStream.writeFloat32(this.engineRpm); }; }; // end of class // node.js module support exports.PropulsionSystemData = dis.PropulsionSystemData; // End of PropulsionSystemData class /** * Section 5.3.8. Abstract superclass for radio communications PDUs. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.RadioCommunicationsFamilyPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 0; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 4; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; dis.RadioCommunicationsFamilyPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); }; dis.RadioCommunicationsFamilyPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); }; }; // end of class // node.js module support exports.RadioCommunicationsFamilyPdu = dis.RadioCommunicationsFamilyPdu; // End of RadioCommunicationsFamilyPdu class /** * Section 5.2.25. Identifies the type of radio * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.RadioEntityType = function() { /** Kind of entity */ this.entityKind = 0; /** Domain of entity (air, surface, subsurface, space, etc) */ this.domain = 0; /** country to which the design of the entity is attributed */ this.country = 0; /** category of entity */ this.category = 0; /** specific info based on subcategory field */ this.nomenclatureVersion = 0; this.nomenclature = 0; dis.RadioEntityType.prototype.initFromBinary = function(inputStream) { this.entityKind = inputStream.readUByte(); this.domain = inputStream.readUByte(); this.country = inputStream.readUShort(); this.category = inputStream.readUByte(); this.nomenclatureVersion = inputStream.readUByte(); this.nomenclature = inputStream.readUShort(); }; dis.RadioEntityType.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.entityKind); outputStream.writeUByte(this.domain); outputStream.writeUShort(this.country); outputStream.writeUByte(this.category); outputStream.writeUByte(this.nomenclatureVersion); outputStream.writeUShort(this.nomenclature); }; }; // end of class // node.js module support exports.RadioEntityType = dis.RadioEntityType; // End of RadioEntityType class /** * Section 5.3.8.3. Communication of a receiver state. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ReceiverPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 27; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 4; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of the entity that is the source of the communication, ie contains the radio */ this.entityId = new dis.EntityID(); /** particular radio within an entity */ this.radioId = 0; /** encoding scheme used, and enumeration */ this.receiverState = 0; /** padding */ this.padding1 = 0; /** received power */ this.receivedPower = 0; /** ID of transmitter */ this.transmitterEntityId = new dis.EntityID(); /** ID of transmitting radio */ this.transmitterRadioId = 0; dis.ReceiverPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.entityId.initFromBinary(inputStream); this.radioId = inputStream.readUShort(); this.receiverState = inputStream.readUShort(); this.padding1 = inputStream.readUShort(); this.receivedPower = inputStream.readFloat32(); this.transmitterEntityId.initFromBinary(inputStream); this.transmitterRadioId = inputStream.readUShort(); }; dis.ReceiverPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.entityId.encodeToBinary(outputStream); outputStream.writeUShort(this.radioId); outputStream.writeUShort(this.receiverState); outputStream.writeUShort(this.padding1); outputStream.writeFloat32(this.receivedPower); this.transmitterEntityId.encodeToBinary(outputStream); outputStream.writeUShort(this.transmitterRadioId); }; }; // end of class // node.js module support exports.ReceiverPdu = dis.ReceiverPdu; // End of ReceiverPdu class /** * Section 5.3.12.13: A request for one or more records of data from an entity. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.RecordQueryReliablePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 65; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); /** request ID */ this.requestID = 0; /** level of reliability service used for this transaction */ this.requiredReliabilityService = 0; /** padding. The spec is unclear and contradictory here. */ this.pad1 = 0; /** padding */ this.pad2 = 0; /** event type */ this.eventType = 0; /** time */ this.time = 0; /** numberOfRecords */ this.numberOfRecords = 0; /** record IDs */ this.recordIDs = new Array(); dis.RecordQueryReliablePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requestID = inputStream.readUInt(); this.requiredReliabilityService = inputStream.readUByte(); this.pad1 = inputStream.readUShort(); this.pad2 = inputStream.readUByte(); this.eventType = inputStream.readUShort(); this.time = inputStream.readUInt(); this.numberOfRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfRecords; idx++) { var anX = new dis.FourByteChunk(); anX.initFromBinary(inputStream); this.recordIDs.push(anX); } }; dis.RecordQueryReliablePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.requestID); outputStream.writeUByte(this.requiredReliabilityService); outputStream.writeUShort(this.pad1); outputStream.writeUByte(this.pad2); outputStream.writeUShort(this.eventType); outputStream.writeUInt(this.time); outputStream.writeUInt(this.numberOfRecords); for(var idx = 0; idx < this.recordIDs.length; idx++) { recordIDs[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.RecordQueryReliablePdu = dis.RecordQueryReliablePdu; // End of RecordQueryReliablePdu class /** * Record sets, used in transfer control request PDU * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.RecordSet = function() { /** record ID */ this.recordID = 0; /** record set serial number */ this.recordSetSerialNumber = 0; /** record length */ this.recordLength = 0; /** record count */ this.recordCount = 0; /** ^^^This is wrong--variable sized data records */ this.recordValues = 0; /** ^^^This is wrong--variable sized padding */ this.pad4 = 0; dis.RecordSet.prototype.initFromBinary = function(inputStream) { this.recordID = inputStream.readUInt(); this.recordSetSerialNumber = inputStream.readUInt(); this.recordLength = inputStream.readUShort(); this.recordCount = inputStream.readUShort(); this.recordValues = inputStream.readUShort(); this.pad4 = inputStream.readUByte(); }; dis.RecordSet.prototype.encodeToBinary = function(outputStream) { outputStream.writeUInt(this.recordID); outputStream.writeUInt(this.recordSetSerialNumber); outputStream.writeUShort(this.recordLength); outputStream.writeUShort(this.recordCount); outputStream.writeUShort(this.recordValues); outputStream.writeUByte(this.pad4); }; }; // end of class // node.js module support exports.RecordSet = dis.RecordSet; // End of RecordSet class /** * 5.2.56. Purpose for joinging two entities * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.Relationship = function() { /** Nature of join */ this.nature = 0; /** position of join */ this.position = 0; dis.Relationship.prototype.initFromBinary = function(inputStream) { this.nature = inputStream.readUShort(); this.position = inputStream.readUShort(); }; dis.Relationship.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.nature); outputStream.writeUShort(this.position); }; }; // end of class // node.js module support exports.Relationship = dis.Relationship; // End of Relationship class /** * Section 5.3.6.2. Remove an entity. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.RemoveEntityPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 12; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 5; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is sending message */ this.originatingEntityID = new dis.EntityID(); /** Entity that is intended to receive message */ this.receivingEntityID = new dis.EntityID(); /** Identifier for the request */ this.requestID = 0; dis.RemoveEntityPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requestID = inputStream.readUInt(); }; dis.RemoveEntityPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.requestID); }; }; // end of class // node.js module support exports.RemoveEntityPdu = dis.RemoveEntityPdu; // End of RemoveEntityPdu class /** * Section 5.3.12.2: Removal of an entity , reliable. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.RemoveEntityReliablePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 52; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); /** level of reliability service used for this transaction */ this.requiredReliabilityService = 0; /** padding */ this.pad1 = 0; /** padding */ this.pad2 = 0; /** Request ID */ this.requestID = 0; dis.RemoveEntityReliablePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requiredReliabilityService = inputStream.readUByte(); this.pad1 = inputStream.readUShort(); this.pad2 = inputStream.readUByte(); this.requestID = inputStream.readUInt(); }; dis.RemoveEntityReliablePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUByte(this.requiredReliabilityService); outputStream.writeUShort(this.pad1); outputStream.writeUByte(this.pad2); outputStream.writeUInt(this.requestID); }; }; // end of class // node.js module support exports.RemoveEntityReliablePdu = dis.RemoveEntityReliablePdu; // End of RemoveEntityReliablePdu class /** * Section 5.2.5.5. Repair is complete. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.RepairCompletePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 9; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 3; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is receiving service */ this.receivingEntityID = new dis.EntityID(); /** Entity that is supplying */ this.repairingEntityID = new dis.EntityID(); /** Enumeration for type of repair */ this.repair = 0; /** padding, number prevents conflict with superclass ivar name */ this.padding2 = 0; dis.RepairCompletePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.receivingEntityID.initFromBinary(inputStream); this.repairingEntityID.initFromBinary(inputStream); this.repair = inputStream.readUShort(); this.padding2 = inputStream.readShort(); }; dis.RepairCompletePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.receivingEntityID.encodeToBinary(outputStream); this.repairingEntityID.encodeToBinary(outputStream); outputStream.writeUShort(this.repair); outputStream.writeShort(this.padding2); }; }; // end of class // node.js module support exports.RepairCompletePdu = dis.RepairCompletePdu; // End of RepairCompletePdu class /** * Section 5.2.5.6. Sent after repair complete PDU. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.RepairResponsePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 10; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 3; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is receiving service */ this.receivingEntityID = new dis.EntityID(); /** Entity that is supplying */ this.repairingEntityID = new dis.EntityID(); /** Result of repair operation */ this.repairResult = 0; /** padding */ this.padding1 = 0; /** padding */ this.padding2 = 0; dis.RepairResponsePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.receivingEntityID.initFromBinary(inputStream); this.repairingEntityID.initFromBinary(inputStream); this.repairResult = inputStream.readUByte(); this.padding1 = inputStream.readShort(); this.padding2 = inputStream.readByte(); }; dis.RepairResponsePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.receivingEntityID.encodeToBinary(outputStream); this.repairingEntityID.encodeToBinary(outputStream); outputStream.writeUByte(this.repairResult); outputStream.writeShort(this.padding1); outputStream.writeByte(this.padding2); }; }; // end of class // node.js module support exports.RepairResponsePdu = dis.RepairResponsePdu; // End of RepairResponsePdu class /** * Section 5.2.5.4. Cancel of resupply by either the receiving or supplying entity. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ResupplyCancelPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 8; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 3; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is receiving service */ this.receivingEntityID = new dis.EntityID(); /** Entity that is supplying */ this.supplyingEntityID = new dis.EntityID(); dis.ResupplyCancelPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.receivingEntityID.initFromBinary(inputStream); this.supplyingEntityID.initFromBinary(inputStream); }; dis.ResupplyCancelPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.receivingEntityID.encodeToBinary(outputStream); this.supplyingEntityID.encodeToBinary(outputStream); }; }; // end of class // node.js module support exports.ResupplyCancelPdu = dis.ResupplyCancelPdu; // End of ResupplyCancelPdu class /** * Section 5.3.5.2. Information about a request for supplies. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ResupplyOfferPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 6; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 3; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is receiving service */ this.receivingEntityID = new dis.EntityID(); /** Entity that is supplying */ this.supplyingEntityID = new dis.EntityID(); /** how many supplies are being offered */ this.numberOfSupplyTypes = 0; /** padding */ this.padding1 = 0; /** padding */ this.padding2 = 0; this.supplies = new Array(); dis.ResupplyOfferPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.receivingEntityID.initFromBinary(inputStream); this.supplyingEntityID.initFromBinary(inputStream); this.numberOfSupplyTypes = inputStream.readUByte(); this.padding1 = inputStream.readShort(); this.padding2 = inputStream.readByte(); for(var idx = 0; idx < this.numberOfSupplyTypes; idx++) { var anX = new dis.SupplyQuantity(); anX.initFromBinary(inputStream); this.supplies.push(anX); } }; dis.ResupplyOfferPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.receivingEntityID.encodeToBinary(outputStream); this.supplyingEntityID.encodeToBinary(outputStream); outputStream.writeUByte(this.numberOfSupplyTypes); outputStream.writeShort(this.padding1); outputStream.writeByte(this.padding2); for(var idx = 0; idx < this.supplies.length; idx++) { supplies[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.ResupplyOfferPdu = dis.ResupplyOfferPdu; // End of ResupplyOfferPdu class /** * Section 5.3.5.3. Receipt of supplies is communiated. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ResupplyReceivedPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 7; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 3; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is receiving service */ this.receivingEntityID = new dis.EntityID(); /** Entity that is supplying */ this.supplyingEntityID = new dis.EntityID(); /** how many supplies are being offered */ this.numberOfSupplyTypes = 0; /** padding */ this.padding1 = 0; /** padding */ this.padding2 = 0; this.supplies = new Array(); dis.ResupplyReceivedPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.receivingEntityID.initFromBinary(inputStream); this.supplyingEntityID.initFromBinary(inputStream); this.numberOfSupplyTypes = inputStream.readUByte(); this.padding1 = inputStream.readShort(); this.padding2 = inputStream.readByte(); for(var idx = 0; idx < this.numberOfSupplyTypes; idx++) { var anX = new dis.SupplyQuantity(); anX.initFromBinary(inputStream); this.supplies.push(anX); } }; dis.ResupplyReceivedPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.receivingEntityID.encodeToBinary(outputStream); this.supplyingEntityID.encodeToBinary(outputStream); outputStream.writeUByte(this.numberOfSupplyTypes); outputStream.writeShort(this.padding1); outputStream.writeByte(this.padding2); for(var idx = 0; idx < this.supplies.length; idx++) { supplies[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.ResupplyReceivedPdu = dis.ResupplyReceivedPdu; // End of ResupplyReceivedPdu class /** * Section 5.3.7.5. SEES PDU, supplemental emissions entity state information. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.SeesPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 30; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 6; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Originating entity ID */ this.orginatingEntityID = new dis.EntityID(); /** IR Signature representation index */ this.infraredSignatureRepresentationIndex = 0; /** acoustic Signature representation index */ this.acousticSignatureRepresentationIndex = 0; /** radar cross section representation index */ this.radarCrossSectionSignatureRepresentationIndex = 0; /** how many propulsion systems */ this.numberOfPropulsionSystems = 0; /** how many vectoring nozzle systems */ this.numberOfVectoringNozzleSystems = 0; /** variable length list of propulsion system data */ this.propulsionSystemData = new Array(); /** variable length list of vectoring system data */ this.vectoringSystemData = new Array(); dis.SeesPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.orginatingEntityID.initFromBinary(inputStream); this.infraredSignatureRepresentationIndex = inputStream.readUShort(); this.acousticSignatureRepresentationIndex = inputStream.readUShort(); this.radarCrossSectionSignatureRepresentationIndex = inputStream.readUShort(); this.numberOfPropulsionSystems = inputStream.readUShort(); this.numberOfVectoringNozzleSystems = inputStream.readUShort(); for(var idx = 0; idx < this.numberOfPropulsionSystems; idx++) { var anX = new dis.PropulsionSystemData(); anX.initFromBinary(inputStream); this.propulsionSystemData.push(anX); } for(var idx = 0; idx < this.numberOfVectoringNozzleSystems; idx++) { var anX = new dis.VectoringNozzleSystemData(); anX.initFromBinary(inputStream); this.vectoringSystemData.push(anX); } }; dis.SeesPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.orginatingEntityID.encodeToBinary(outputStream); outputStream.writeUShort(this.infraredSignatureRepresentationIndex); outputStream.writeUShort(this.acousticSignatureRepresentationIndex); outputStream.writeUShort(this.radarCrossSectionSignatureRepresentationIndex); outputStream.writeUShort(this.numberOfPropulsionSystems); outputStream.writeUShort(this.numberOfVectoringNozzleSystems); for(var idx = 0; idx < this.propulsionSystemData.length; idx++) { propulsionSystemData[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.vectoringSystemData.length; idx++) { vectoringSystemData[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.SeesPdu = dis.SeesPdu; // End of SeesPdu class /** * Section 5.3.5.1. Information about a request for supplies. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ServiceRequestPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 5; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 3; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is requesting service */ this.requestingEntityID = new dis.EntityID(); /** Entity that is providing the service */ this.servicingEntityID = new dis.EntityID(); /** type of service requested */ this.serviceTypeRequested = 0; /** How many requested */ this.numberOfSupplyTypes = 0; /** padding */ this.serviceRequestPadding = 0; this.supplies = new Array(); dis.ServiceRequestPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.requestingEntityID.initFromBinary(inputStream); this.servicingEntityID.initFromBinary(inputStream); this.serviceTypeRequested = inputStream.readUByte(); this.numberOfSupplyTypes = inputStream.readUByte(); this.serviceRequestPadding = inputStream.readShort(); for(var idx = 0; idx < this.numberOfSupplyTypes; idx++) { var anX = new dis.SupplyQuantity(); anX.initFromBinary(inputStream); this.supplies.push(anX); } }; dis.ServiceRequestPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.requestingEntityID.encodeToBinary(outputStream); this.servicingEntityID.encodeToBinary(outputStream); outputStream.writeUByte(this.serviceTypeRequested); outputStream.writeUByte(this.numberOfSupplyTypes); outputStream.writeShort(this.serviceRequestPadding); for(var idx = 0; idx < this.supplies.length; idx++) { supplies[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.ServiceRequestPdu = dis.ServiceRequestPdu; // End of ServiceRequestPdu class /** * Section 5.3.6.9. Change state information with the data contained in this. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.SetDataPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 19; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 5; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is sending message */ this.originatingEntityID = new dis.EntityID(); /** Entity that is intended to receive message */ this.receivingEntityID = new dis.EntityID(); /** ID of request */ this.requestID = 0; /** padding */ this.padding1 = 0; /** Number of fixed datum records */ this.numberOfFixedDatumRecords = 0; /** Number of variable datum records */ this.numberOfVariableDatumRecords = 0; /** variable length list of fixed datums */ this.fixedDatums = new Array(); /** variable length list of variable length datums */ this.variableDatums = new Array(); dis.SetDataPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requestID = inputStream.readUInt(); this.padding1 = inputStream.readUInt(); this.numberOfFixedDatumRecords = inputStream.readUInt(); this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfFixedDatumRecords; idx++) { var anX = new dis.FixedDatum(); anX.initFromBinary(inputStream); this.fixedDatums.push(anX); } for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.variableDatums.push(anX); } }; dis.SetDataPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.requestID); outputStream.writeUInt(this.padding1); outputStream.writeUInt(this.numberOfFixedDatumRecords); outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.fixedDatums.length; idx++) { fixedDatums[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.variableDatums.length; idx++) { variableDatums[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.SetDataPdu = dis.SetDataPdu; // End of SetDataPdu class /** * Section 5.3.12.9: initializing or chaning internal state information, reliable. Needs manual intervention to fix padding on variable datums. UNFINISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.SetDataReliablePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 59; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); /** level of reliability service used for this transaction */ this.requiredReliabilityService = 0; /** padding */ this.pad1 = 0; /** padding */ this.pad2 = 0; /** Request ID */ this.requestID = 0; /** Fixed datum record count */ this.numberOfFixedDatumRecords = 0; /** variable datum record count */ this.numberOfVariableDatumRecords = 0; /** Fixed datum records */ this.fixedDatumRecords = new Array(); /** Variable datum records */ this.variableDatumRecords = new Array(); dis.SetDataReliablePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requiredReliabilityService = inputStream.readUByte(); this.pad1 = inputStream.readUShort(); this.pad2 = inputStream.readUByte(); this.requestID = inputStream.readUInt(); this.numberOfFixedDatumRecords = inputStream.readUInt(); this.numberOfVariableDatumRecords = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfFixedDatumRecords; idx++) { var anX = new dis.FixedDatum(); anX.initFromBinary(inputStream); this.fixedDatumRecords.push(anX); } for(var idx = 0; idx < this.numberOfVariableDatumRecords; idx++) { var anX = new dis.VariableDatum(); anX.initFromBinary(inputStream); this.variableDatumRecords.push(anX); } }; dis.SetDataReliablePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUByte(this.requiredReliabilityService); outputStream.writeUShort(this.pad1); outputStream.writeUByte(this.pad2); outputStream.writeUInt(this.requestID); outputStream.writeUInt(this.numberOfFixedDatumRecords); outputStream.writeUInt(this.numberOfVariableDatumRecords); for(var idx = 0; idx < this.fixedDatumRecords.length; idx++) { fixedDatumRecords[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.variableDatumRecords.length; idx++) { variableDatumRecords[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.SetDataReliablePdu = dis.SetDataReliablePdu; // End of SetDataReliablePdu class /** * Section 5.3.12.14: Initializing or changing internal parameter info. Needs manual intervention to fix padding in recrod set PDUs. UNFINISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.SetRecordReliablePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 64; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); /** request ID */ this.requestID = 0; /** level of reliability service used for this transaction */ this.requiredReliabilityService = 0; /** padding. The spec is unclear and contradictory here. */ this.pad1 = 0; /** padding */ this.pad2 = 0; /** Number of record sets in list */ this.numberOfRecordSets = 0; /** record sets */ this.recordSets = new Array(); dis.SetRecordReliablePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.requestID = inputStream.readUInt(); this.requiredReliabilityService = inputStream.readUByte(); this.pad1 = inputStream.readUShort(); this.pad2 = inputStream.readUByte(); this.numberOfRecordSets = inputStream.readUInt(); for(var idx = 0; idx < this.numberOfRecordSets; idx++) { var anX = new dis.RecordSet(); anX.initFromBinary(inputStream); this.recordSets.push(anX); } }; dis.SetRecordReliablePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.requestID); outputStream.writeUByte(this.requiredReliabilityService); outputStream.writeUShort(this.pad1); outputStream.writeUByte(this.pad2); outputStream.writeUInt(this.numberOfRecordSets); for(var idx = 0; idx < this.recordSets.length; idx++) { recordSets[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.SetRecordReliablePdu = dis.SetRecordReliablePdu; // End of SetRecordReliablePdu class /** * Shaft RPMs, used in underwater acoustic clacluations. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.ShaftRPMs = function() { /** Current shaft RPMs */ this.currentShaftRPMs = 0; /** ordered shaft rpms */ this.orderedShaftRPMs = 0; /** rate of change of shaft RPMs */ this.shaftRPMRateOfChange = 0; dis.ShaftRPMs.prototype.initFromBinary = function(inputStream) { this.currentShaftRPMs = inputStream.readShort(); this.orderedShaftRPMs = inputStream.readShort(); this.shaftRPMRateOfChange = inputStream.readFloat32(); }; dis.ShaftRPMs.prototype.encodeToBinary = function(outputStream) { outputStream.writeShort(this.currentShaftRPMs); outputStream.writeShort(this.orderedShaftRPMs); outputStream.writeFloat32(this.shaftRPMRateOfChange); }; }; // end of class // node.js module support exports.ShaftRPMs = dis.ShaftRPMs; // End of ShaftRPMs class /** * Section 5.3.8.2. Detailed information about a radio transmitter. This PDU requires manually written code to complete. The encodingScheme field can be used in multiple ways, which requires hand-written code to finish. UNFINISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.SignalPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 26; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 4; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of the entity that is the source of the communication, ie contains the radio */ this.entityId = new dis.EntityID(); /** particular radio within an entity */ this.radioId = 0; /** encoding scheme used, and enumeration */ this.encodingScheme = 0; /** tdl type */ this.tdlType = 0; /** sample rate */ this.sampleRate = 0; /** length of data, in bits */ this.dataLength = 0; /** number of samples. If the PDU contains encoded audio, this should be zero. */ this.samples = 0; /** list of eight bit values. Must be padded to fall on a 32 bit boundary. */ this.data = new Array(); dis.SignalPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.entityId.initFromBinary(inputStream); this.radioId = inputStream.readUShort(); this.encodingScheme = inputStream.readUShort(); this.tdlType = inputStream.readUShort(); this.sampleRate = inputStream.readUInt(); this.dataLength = inputStream.readUShort(); this.samples = inputStream.readUShort(); for(var idx = 0; idx < this.dataLength; idx++) { var anX = new dis.OneByteChunk(); anX.initFromBinary(inputStream); this.data.push(anX); } }; dis.SignalPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.entityId.encodeToBinary(outputStream); outputStream.writeUShort(this.radioId); outputStream.writeUShort(this.encodingScheme); outputStream.writeUShort(this.tdlType); outputStream.writeUInt(this.sampleRate); outputStream.writeUShort(this.dataLength); outputStream.writeUShort(this.samples); for(var idx = 0; idx < this.data.length; idx++) { data[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.SignalPdu = dis.SignalPdu; // End of SignalPdu class /** * Section 5.2.14.1. A Simulation Address record shall consist of the Site Identification number and the Application Identification number. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.SimulationAddress = function() { /** The site ID */ this.site = 0; /** The application ID */ this.application = 0; dis.SimulationAddress.prototype.initFromBinary = function(inputStream) { this.site = inputStream.readUShort(); this.application = inputStream.readUShort(); }; dis.SimulationAddress.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.site); outputStream.writeUShort(this.application); }; }; // end of class // node.js module support exports.SimulationAddress = dis.SimulationAddress; // End of SimulationAddress class /** * Section 5.3.6. Abstract superclass for PDUs relating to the simulation itself. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.SimulationManagementFamilyPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 0; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 5; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is sending message */ this.originatingEntityID = new dis.EntityID(); /** Entity that is intended to receive message */ this.receivingEntityID = new dis.EntityID(); dis.SimulationManagementFamilyPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); }; dis.SimulationManagementFamilyPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); }; }; // end of class // node.js module support exports.SimulationManagementFamilyPdu = dis.SimulationManagementFamilyPdu; // End of SimulationManagementFamilyPdu class /** * Section 5.3.12: Abstract superclass for reliable simulation management PDUs * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.SimulationManagementWithReliabilityFamilyPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 0; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); dis.SimulationManagementWithReliabilityFamilyPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); }; dis.SimulationManagementWithReliabilityFamilyPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); }; }; // end of class // node.js module support exports.SimulationManagementWithReliabilityFamilyPdu = dis.SimulationManagementWithReliabilityFamilyPdu; // End of SimulationManagementWithReliabilityFamilyPdu class /** * 48 bit piece of data * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.SixByteChunk = function() { /** six bytes of arbitrary data */ this.otherParameters = new Array(0, 0, 0, 0, 0, 0); dis.SixByteChunk.prototype.initFromBinary = function(inputStream) { for(var idx = 0; idx < 6; idx++) { this.otherParameters[ idx ] = inputStream.readByte(); } }; dis.SixByteChunk.prototype.encodeToBinary = function(outputStream) { for(var idx = 0; idx < 6; idx++) { outputStream.writeByte(this.otherParameters[ idx ] ); } }; }; // end of class // node.js module support exports.SixByteChunk = dis.SixByteChunk; // End of SixByteChunk class /** * Section 5.2.4.3. Used when the antenna pattern type in the transmitter pdu is of value 2. Specified the direction and radiation pattern from a radio transmitter's antenna. NOTE: this class must be hand-coded to clean up some implementation details. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.SphericalHarmonicAntennaPattern = function() { this.harmonicOrder = 0; dis.SphericalHarmonicAntennaPattern.prototype.initFromBinary = function(inputStream) { this.harmonicOrder = inputStream.readByte(); }; dis.SphericalHarmonicAntennaPattern.prototype.encodeToBinary = function(outputStream) { outputStream.writeByte(this.harmonicOrder); }; }; // end of class // node.js module support exports.SphericalHarmonicAntennaPattern = dis.SphericalHarmonicAntennaPattern; // End of SphericalHarmonicAntennaPattern class /** * Section 5.2.6.3. Start or resume an exercise. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.StartResumePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 13; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 5; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is sending message */ this.originatingEntityID = new dis.EntityID(); /** Entity that is intended to receive message */ this.receivingEntityID = new dis.EntityID(); /** UTC time at which the simulation shall start or resume */ this.realWorldTime = new dis.ClockTime(); /** Simulation clock time at which the simulation shall start or resume */ this.simulationTime = new dis.ClockTime(); /** Identifier for the request */ this.requestID = 0; dis.StartResumePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.realWorldTime.initFromBinary(inputStream); this.simulationTime.initFromBinary(inputStream); this.requestID = inputStream.readUInt(); }; dis.StartResumePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); this.realWorldTime.encodeToBinary(outputStream); this.simulationTime.encodeToBinary(outputStream); outputStream.writeUInt(this.requestID); }; }; // end of class // node.js module support exports.StartResumePdu = dis.StartResumePdu; // End of StartResumePdu class /** * Section 5.3.12.3: Start resume simulation, relaible. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.StartResumeReliablePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 53; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); /** time in real world for this operation to happen */ this.realWorldTime = new dis.ClockTime(); /** time in simulation for the simulation to resume */ this.simulationTime = new dis.ClockTime(); /** level of reliability service used for this transaction */ this.requiredReliabilityService = 0; /** padding */ this.pad1 = 0; /** padding */ this.pad2 = 0; /** Request ID */ this.requestID = 0; dis.StartResumeReliablePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.realWorldTime.initFromBinary(inputStream); this.simulationTime.initFromBinary(inputStream); this.requiredReliabilityService = inputStream.readUByte(); this.pad1 = inputStream.readUShort(); this.pad2 = inputStream.readUByte(); this.requestID = inputStream.readUInt(); }; dis.StartResumeReliablePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); this.realWorldTime.encodeToBinary(outputStream); this.simulationTime.encodeToBinary(outputStream); outputStream.writeUByte(this.requiredReliabilityService); outputStream.writeUShort(this.pad1); outputStream.writeUByte(this.pad2); outputStream.writeUInt(this.requestID); }; }; // end of class // node.js module support exports.StartResumeReliablePdu = dis.StartResumeReliablePdu; // End of StartResumeReliablePdu class /** * Section 5.2.3.4. Stop or freeze an exercise. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.StopFreezePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 14; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 5; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Entity that is sending message */ this.originatingEntityID = new dis.EntityID(); /** Entity that is intended to receive message */ this.receivingEntityID = new dis.EntityID(); /** UTC time at which the simulation shall stop or freeze */ this.realWorldTime = new dis.ClockTime(); /** Reason the simulation was stopped or frozen */ this.reason = 0; /** Internal behavior of the simulation and its appearance while frozento the other participants */ this.frozenBehavior = 0; /** padding */ this.padding1 = 0; /** Request ID that is unique */ this.requestID = 0; dis.StopFreezePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.realWorldTime.initFromBinary(inputStream); this.reason = inputStream.readUByte(); this.frozenBehavior = inputStream.readUByte(); this.padding1 = inputStream.readShort(); this.requestID = inputStream.readUInt(); }; dis.StopFreezePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); this.realWorldTime.encodeToBinary(outputStream); outputStream.writeUByte(this.reason); outputStream.writeUByte(this.frozenBehavior); outputStream.writeShort(this.padding1); outputStream.writeUInt(this.requestID); }; }; // end of class // node.js module support exports.StopFreezePdu = dis.StopFreezePdu; // End of StopFreezePdu class /** * Section 5.3.12.4: Stop freeze simulation, relaible. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.StopFreezeReliablePdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 54; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 10; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** Object originatig the request */ this.originatingEntityID = new dis.EntityID(); /** Object with which this point object is associated */ this.receivingEntityID = new dis.EntityID(); /** time in real world for this operation to happen */ this.realWorldTime = new dis.ClockTime(); /** Reason for stopping/freezing simulation */ this.reason = 0; /** internal behvior of the simulation while frozen */ this.frozenBehavior = 0; /** reliablity level */ this.requiredReliablityService = 0; /** padding */ this.pad1 = 0; /** Request ID */ this.requestID = 0; dis.StopFreezeReliablePdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.originatingEntityID.initFromBinary(inputStream); this.receivingEntityID.initFromBinary(inputStream); this.realWorldTime.initFromBinary(inputStream); this.reason = inputStream.readUByte(); this.frozenBehavior = inputStream.readUByte(); this.requiredReliablityService = inputStream.readUByte(); this.pad1 = inputStream.readUByte(); this.requestID = inputStream.readUInt(); }; dis.StopFreezeReliablePdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.originatingEntityID.encodeToBinary(outputStream); this.receivingEntityID.encodeToBinary(outputStream); this.realWorldTime.encodeToBinary(outputStream); outputStream.writeUByte(this.reason); outputStream.writeUByte(this.frozenBehavior); outputStream.writeUByte(this.requiredReliablityService); outputStream.writeUByte(this.pad1); outputStream.writeUInt(this.requestID); }; }; // end of class // node.js module support exports.StopFreezeReliablePdu = dis.StopFreezeReliablePdu; // End of StopFreezeReliablePdu class /** * Section 5.2.30. A supply, and the amount of that supply. Similar to an entity kind but with the addition of a quantity. * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.SupplyQuantity = function() { /** Type of supply */ this.supplyType = new dis.EntityType(); /** quantity to be supplied */ this.quantity = 0; dis.SupplyQuantity.prototype.initFromBinary = function(inputStream) { this.supplyType.initFromBinary(inputStream); this.quantity = inputStream.readUByte(); }; dis.SupplyQuantity.prototype.encodeToBinary = function(outputStream) { this.supplyType.encodeToBinary(outputStream); outputStream.writeUByte(this.quantity); }; }; // end of class // node.js module support exports.SupplyQuantity = dis.SupplyQuantity; // End of SupplyQuantity class /** * Section 5.3.11: Abstract superclass for synthetic environment PDUs * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.SyntheticEnvironmentFamilyPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 0; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 9; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; dis.SyntheticEnvironmentFamilyPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); }; dis.SyntheticEnvironmentFamilyPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); }; }; // end of class // node.js module support exports.SyntheticEnvironmentFamilyPdu = dis.SyntheticEnvironmentFamilyPdu; // End of SyntheticEnvironmentFamilyPdu class /** * 5.2.58. Used in IFF ATC PDU * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.SystemID = function() { /** System Type */ this.systemType = 0; /** System name, an enumeration */ this.systemName = 0; /** System mode */ this.systemMode = 0; /** Change Options */ this.changeOptions = 0; dis.SystemID.prototype.initFromBinary = function(inputStream) { this.systemType = inputStream.readUShort(); this.systemName = inputStream.readUShort(); this.systemMode = inputStream.readUByte(); this.changeOptions = inputStream.readUByte(); }; dis.SystemID.prototype.encodeToBinary = function(outputStream) { outputStream.writeUShort(this.systemType); outputStream.writeUShort(this.systemName); outputStream.writeUByte(this.systemMode); outputStream.writeUByte(this.changeOptions); }; }; // end of class // node.js module support exports.SystemID = dis.SystemID; // End of SystemID class /** * One track/jam target * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.TrackJamTarget = function() { /** track/jam target */ this.trackJam = new dis.EntityID(); /** Emitter ID */ this.emitterID = 0; /** beam ID */ this.beamID = 0; dis.TrackJamTarget.prototype.initFromBinary = function(inputStream) { this.trackJam.initFromBinary(inputStream); this.emitterID = inputStream.readUByte(); this.beamID = inputStream.readUByte(); }; dis.TrackJamTarget.prototype.encodeToBinary = function(outputStream) { this.trackJam.encodeToBinary(outputStream); outputStream.writeUByte(this.emitterID); outputStream.writeUByte(this.beamID); }; }; // end of class // node.js module support exports.TrackJamTarget = dis.TrackJamTarget; // End of TrackJamTarget class /** * Section 5.3.9.3 Information initiating the dyanic allocation and control of simulation entities between two simulation applications. Requires manual cleanup. The padding between record sets is variable. UNFINISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.TransferControlRequestPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 35; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 7; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of entity originating request */ this.orginatingEntityID = new dis.EntityID(); /** ID of entity receiving request */ this.recevingEntityID = new dis.EntityID(); /** ID ofrequest */ this.requestID = 0; /** required level of reliabliity service. */ this.requiredReliabilityService = 0; /** type of transfer desired */ this.tranferType = 0; /** The entity for which control is being requested to transfer */ this.transferEntityID = new dis.EntityID(); /** number of record sets to transfer */ this.numberOfRecordSets = 0; /** ^^^This is wrong--the RecordSet class needs more work */ this.recordSets = new Array(); dis.TransferControlRequestPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.orginatingEntityID.initFromBinary(inputStream); this.recevingEntityID.initFromBinary(inputStream); this.requestID = inputStream.readUInt(); this.requiredReliabilityService = inputStream.readUByte(); this.tranferType = inputStream.readUByte(); this.transferEntityID.initFromBinary(inputStream); this.numberOfRecordSets = inputStream.readUByte(); for(var idx = 0; idx < this.numberOfRecordSets; idx++) { var anX = new dis.RecordSet(); anX.initFromBinary(inputStream); this.recordSets.push(anX); } }; dis.TransferControlRequestPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.orginatingEntityID.encodeToBinary(outputStream); this.recevingEntityID.encodeToBinary(outputStream); outputStream.writeUInt(this.requestID); outputStream.writeUByte(this.requiredReliabilityService); outputStream.writeUByte(this.tranferType); this.transferEntityID.encodeToBinary(outputStream); outputStream.writeUByte(this.numberOfRecordSets); for(var idx = 0; idx < this.recordSets.length; idx++) { recordSets[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.TransferControlRequestPdu = dis.TransferControlRequestPdu; // End of TransferControlRequestPdu class /** * Section 5.3.8.1. Detailed information about a radio transmitter. This PDU requires manually written code to complete, since the modulation parameters are of variable length. UNFINISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.TransmitterPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 25; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 4; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of the entity that is the source of the communication, ie contains the radio */ this.entityId = new dis.EntityID(); /** particular radio within an entity */ this.radioId = 0; /** linear accelleration of entity */ this.radioEntityType = new dis.RadioEntityType(); /** transmit state */ this.transmitState = 0; /** input source */ this.inputSource = 0; /** padding */ this.padding1 = 0; /** Location of antenna */ this.antennaLocation = new dis.Vector3Double(); /** relative location of antenna, in entity coordinates */ this.relativeAntennaLocation = new dis.Vector3Float(); /** antenna pattern type */ this.antennaPatternType = 0; /** atenna pattern length */ this.antennaPatternCount = 0; /** frequency */ this.frequency = 0; /** transmit frequency Bandwidth */ this.transmitFrequencyBandwidth = 0; /** transmission power */ this.power = 0; /** modulation */ this.modulationType = new dis.ModulationType(); /** crypto system enumeration */ this.cryptoSystem = 0; /** crypto system key identifer */ this.cryptoKeyId = 0; /** how many modulation parameters we have */ this.modulationParameterCount = 0; /** padding2 */ this.padding2 = 0; /** padding3 */ this.padding3 = 0; /** variable length list of modulation parameters */ this.modulationParametersList = new Array(); /** variable length list of antenna pattern records */ this.antennaPatternList = new Array(); dis.TransmitterPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.entityId.initFromBinary(inputStream); this.radioId = inputStream.readUShort(); this.radioEntityType.initFromBinary(inputStream); this.transmitState = inputStream.readUByte(); this.inputSource = inputStream.readUByte(); this.padding1 = inputStream.readUShort(); this.antennaLocation.initFromBinary(inputStream); this.relativeAntennaLocation.initFromBinary(inputStream); this.antennaPatternType = inputStream.readUShort(); this.antennaPatternCount = inputStream.readUShort(); this.frequency = inputStream.readLong(); this.transmitFrequencyBandwidth = inputStream.readFloat32(); this.power = inputStream.readFloat32(); this.modulationType.initFromBinary(inputStream); this.cryptoSystem = inputStream.readUShort(); this.cryptoKeyId = inputStream.readUShort(); this.modulationParameterCount = inputStream.readUByte(); this.padding2 = inputStream.readUShort(); this.padding3 = inputStream.readUByte(); for(var idx = 0; idx < this.modulationParameterCount; idx++) { var anX = new dis.ModulationType(); anX.initFromBinary(inputStream); this.modulationParametersList.push(anX); } for(var idx = 0; idx < this.antennaPatternCount; idx++) { var anX = new dis.BeamAntennaPattern(); anX.initFromBinary(inputStream); this.antennaPatternList.push(anX); } }; dis.TransmitterPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.entityId.encodeToBinary(outputStream); outputStream.writeUShort(this.radioId); this.radioEntityType.encodeToBinary(outputStream); outputStream.writeUByte(this.transmitState); outputStream.writeUByte(this.inputSource); outputStream.writeUShort(this.padding1); this.antennaLocation.encodeToBinary(outputStream); this.relativeAntennaLocation.encodeToBinary(outputStream); outputStream.writeUShort(this.antennaPatternType); outputStream.writeUShort(this.antennaPatternCount); outputStream.writeLong(this.frequency); outputStream.writeFloat32(this.transmitFrequencyBandwidth); outputStream.writeFloat32(this.power); this.modulationType.encodeToBinary(outputStream); outputStream.writeUShort(this.cryptoSystem); outputStream.writeUShort(this.cryptoKeyId); outputStream.writeUByte(this.modulationParameterCount); outputStream.writeUShort(this.padding2); outputStream.writeUByte(this.padding3); for(var idx = 0; idx < this.modulationParametersList.length; idx++) { modulationParametersList[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.antennaPatternList.length; idx++) { antennaPatternList[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.TransmitterPdu = dis.TransmitterPdu; // End of TransmitterPdu class /** * 16 bit piece of data * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.TwoByteChunk = function() { /** two bytes of arbitrary data */ this.otherParameters = new Array(0, 0); dis.TwoByteChunk.prototype.initFromBinary = function(inputStream) { for(var idx = 0; idx < 2; idx++) { this.otherParameters[ idx ] = inputStream.readByte(); } }; dis.TwoByteChunk.prototype.encodeToBinary = function(outputStream) { for(var idx = 0; idx < 2; idx++) { outputStream.writeByte(this.otherParameters[ idx ] ); } }; }; // end of class // node.js module support exports.TwoByteChunk = dis.TwoByteChunk; // End of TwoByteChunk class /** * Section 5.3.7.3. Information about underwater acoustic emmissions. This requires manual cleanup. The beam data records should ALL be a the finish, rather than attached to each emitter system. UNFINISHED * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.UaPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 29; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 6; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of the entity that is the source of the emission */ this.emittingEntityID = new dis.EntityID(); /** ID of event */ this.eventID = new dis.EventID(); /** This field shall be used to indicate whether the data in the UA PDU represent a state update or data that have changed since issuance of the last UA PDU */ this.stateChangeIndicator = 0; /** padding */ this.pad = 0; /** This field indicates which database record (or file) shall be used in the definition of passive signature (unintentional) emissions of the entity. The indicated database record (or file) shall define all noise generated as a function of propulsion plant configurations and associated auxiliaries. */ this.passiveParameterIndex = 0; /** This field shall specify the entity propulsion plant configuration. This field is used to determine the passive signature characteristics of an entity. */ this.propulsionPlantConfiguration = 0; /** This field shall represent the number of shafts on a platform */ this.numberOfShafts = 0; /** This field shall indicate the number of APAs described in the current UA PDU */ this.numberOfAPAs = 0; /** This field shall specify the number of UA emitter systems being described in the current UA PDU */ this.numberOfUAEmitterSystems = 0; /** shaft RPM values */ this.shaftRPMs = new Array(); /** apaData */ this.apaData = new Array(); this.emitterSystems = new Array(); dis.UaPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.emittingEntityID.initFromBinary(inputStream); this.eventID.initFromBinary(inputStream); this.stateChangeIndicator = inputStream.readByte(); this.pad = inputStream.readByte(); this.passiveParameterIndex = inputStream.readUShort(); this.propulsionPlantConfiguration = inputStream.readUByte(); this.numberOfShafts = inputStream.readUByte(); this.numberOfAPAs = inputStream.readUByte(); this.numberOfUAEmitterSystems = inputStream.readUByte(); for(var idx = 0; idx < this.numberOfShafts; idx++) { var anX = new dis.ShaftRPMs(); anX.initFromBinary(inputStream); this.shaftRPMs.push(anX); } for(var idx = 0; idx < this.numberOfAPAs; idx++) { var anX = new dis.ApaData(); anX.initFromBinary(inputStream); this.apaData.push(anX); } for(var idx = 0; idx < this.numberOfUAEmitterSystems; idx++) { var anX = new dis.AcousticEmitterSystemData(); anX.initFromBinary(inputStream); this.emitterSystems.push(anX); } }; dis.UaPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.emittingEntityID.encodeToBinary(outputStream); this.eventID.encodeToBinary(outputStream); outputStream.writeByte(this.stateChangeIndicator); outputStream.writeByte(this.pad); outputStream.writeUShort(this.passiveParameterIndex); outputStream.writeUByte(this.propulsionPlantConfiguration); outputStream.writeUByte(this.numberOfShafts); outputStream.writeUByte(this.numberOfAPAs); outputStream.writeUByte(this.numberOfUAEmitterSystems); for(var idx = 0; idx < this.shaftRPMs.length; idx++) { shaftRPMs[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.apaData.length; idx++) { apaData[idx].encodeToBinary(outputStream); } for(var idx = 0; idx < this.emitterSystems.length; idx++) { emitterSystems[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.UaPdu = dis.UaPdu; // End of UaPdu class /** * Wrapper for an unsigned 32 bit integer * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.UnsignedIntegerWrapper = function() { /** name can't be too accurate or the generated source code will have reserved word problems */ this.wrapper = 0; dis.UnsignedIntegerWrapper.prototype.initFromBinary = function(inputStream) { this.wrapper = inputStream.readUInt(); }; dis.UnsignedIntegerWrapper.prototype.encodeToBinary = function(outputStream) { outputStream.writeUInt(this.wrapper); }; }; // end of class // node.js module support exports.UnsignedIntegerWrapper = dis.UnsignedIntegerWrapper; // End of UnsignedIntegerWrapper class /** * Section 5.2.32. Variable Datum Record * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.VariableDatum = function() { /** ID of the variable datum */ this.variableDatumID = 0; /** length of the variable datums, in bits. Note that this is not programmatically tied to the size of the variableData. The variable data field may be 64 bits long but only 16 bits of it could actually be used. */ this.variableDatumLength = 0; /** data can be any length, but must increase in 8 byte quanta. This requires some postprocessing patches. Note that setting the data allocates a new internal array to account for the possibly increased size. The default initial size is 64 bits. */ this.variableData = new Array(); dis.VariableDatum.prototype.initFromBinary = function(inputStream) { this.variableDatumID = inputStream.readUInt(); this.variableDatumLength = inputStream.readUInt(); for(var idx = 0; idx < this.variableDatumLength; idx++) { var anX = new dis.OneByteChunk(); anX.initFromBinary(inputStream); this.variableData.push(anX); } }; dis.VariableDatum.prototype.encodeToBinary = function(outputStream) { outputStream.writeUInt(this.variableDatumID); outputStream.writeUInt(this.variableDatumLength); for(var idx = 0; idx < this.variableData.length; idx++) { variableData[idx].encodeToBinary(outputStream); } }; }; // end of class // node.js module support exports.VariableDatum = dis.VariableDatum; // End of VariableDatum class /** * Section 5.3.34. Three double precision floating point values, x, y, and z * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.Vector3Double = function() { /** X value */ this.x = 0; /** Y value */ this.y = 0; /** Z value */ this.z = 0; dis.Vector3Double.prototype.initFromBinary = function(inputStream) { this.x = inputStream.readFloat64(); this.y = inputStream.readFloat64(); this.z = inputStream.readFloat64(); }; dis.Vector3Double.prototype.encodeToBinary = function(outputStream) { outputStream.writeFloat64(this.x); outputStream.writeFloat64(this.y); outputStream.writeFloat64(this.z); }; }; // end of class // node.js module support exports.Vector3Double = dis.Vector3Double; // End of Vector3Double class /** * Section 5.2.33. Three floating point values, x, y, and z * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.Vector3Float = function() { /** X value */ this.x = 0; /** y Value */ this.y = 0; /** Z value */ this.z = 0; dis.Vector3Float.prototype.initFromBinary = function(inputStream) { this.x = inputStream.readFloat32(); this.y = inputStream.readFloat32(); this.z = inputStream.readFloat32(); }; dis.Vector3Float.prototype.encodeToBinary = function(outputStream) { outputStream.writeFloat32(this.x); outputStream.writeFloat32(this.y); outputStream.writeFloat32(this.z); }; }; // end of class // node.js module support exports.Vector3Float = dis.Vector3Float; // End of Vector3Float class /** * Data about a vectoring nozzle system * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.VectoringNozzleSystemData = function() { /** horizontal deflection angle */ this.horizontalDeflectionAngle = 0; /** vertical deflection angle */ this.verticalDeflectionAngle = 0; dis.VectoringNozzleSystemData.prototype.initFromBinary = function(inputStream) { this.horizontalDeflectionAngle = inputStream.readFloat32(); this.verticalDeflectionAngle = inputStream.readFloat32(); }; dis.VectoringNozzleSystemData.prototype.encodeToBinary = function(outputStream) { outputStream.writeFloat32(this.horizontalDeflectionAngle); outputStream.writeFloat32(this.verticalDeflectionAngle); }; }; // end of class // node.js module support exports.VectoringNozzleSystemData = dis.VectoringNozzleSystemData; // End of VectoringNozzleSystemData class /** * Section 5.3.4. abstract superclass for fire and detonation pdus that have shared information. COMPLETE * * Copyright (c) 2008-2015, MOVES Institute, Naval Postgraduate School. All rights reserved. * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html * * @author DMcG */ // On the client side, support for a namespace. if (typeof dis === "undefined") dis = {}; // Support for node.js style modules. Ignored if used in a client context. // See http://howtonode.org/creating-custom-modules if (typeof exports === "undefined") exports = {}; dis.WarfareFamilyPdu = function() { /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ this.protocolVersion = 6; /** Exercise ID */ this.exerciseID = 0; /** Type of pdu, unique for each PDU class */ this.pduType = 0; /** value that refers to the protocol family, eg SimulationManagement, et */ this.protocolFamily = 2; /** Timestamp value */ this.timestamp = 0; /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word */ this.pduLength = 0; /** zero-filled array of padding */ this.padding = 0; /** ID of the entity that shot */ this.firingEntityID = new dis.EntityID(); /** ID of the entity that is being shot at */ this.targetEntityID = new dis.EntityID(); dis.WarfareFamilyPdu.prototype.initFromBinary = function(inputStream) { this.protocolVersion = inputStream.readUByte(); this.exerciseID = inputStream.readUByte(); this.pduType = inputStream.readUByte(); this.protocolFamily = inputStream.readUByte(); this.timestamp = inputStream.readUInt(); this.pduLength = inputStream.readUShort(); this.padding = inputStream.readShort(); this.firingEntityID.initFromBinary(inputStream); this.targetEntityID.initFromBinary(inputStream); }; dis.WarfareFamilyPdu.prototype.encodeToBinary = function(outputStream) { outputStream.writeUByte(this.protocolVersion); outputStream.writeUByte(this.exerciseID); outputStream.writeUByte(this.pduType); outputStream.writeUByte(this.protocolFamily); outputStream.writeUInt(this.timestamp); outputStream.writeUShort(this.pduLength); outputStream.writeShort(this.padding); this.firingEntityID.encodeToBinary(outputStream); this.targetEntityID.encodeToBinary(outputStream); }; }; // end of class // node.js module support exports.WarfareFamilyPdu = dis.WarfareFamilyPdu; // End of WarfareFamilyPdu class