VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
10.7 - Messages

Table of Contents

VR-Link communicates with VR-Link C# through messages.

All messages are serialized into a byte buffer and then sent to VR-Link C# through a simple API. Messages are able to serialize and deserialize themselves. Adding new messages requires that a C# implementation and a C++ implementation be created. This is done by using code generators and a message definition language.

10.7.1 Message Definition Language

The message definition language is written using the Lua language. Messages are declared using the "MESSAGE" keyword followed by the message layout and configuration in a key:value pair table.

MESSAGE{
fileName="transmitterState";
className="TransmitterState";
includes={};
dllExport="MANAGEDINTERFACE_DLL";
enums={
TransmitState=[[OFF, RADIO_ON_NOT_TRANSMITTING, ON]];
InputSource=[[OTHER, PILOT, COPILOT, FIRST_OFFICER, DRIVER, LOADER, GUNNER, COMMANDER, DIGITAL_DATA_DEVICE, INTERCOM]];
AntennaPatternType=[[OMNIDIRECTIONAL=0, BEAM=1, SPHERICALHARMONIC=2]];
CryptoSystem=[[ OTHER, KY_28, VINSON, NSVE, WSVE, SINGARS_ICOM, KY_75, KY_100]];
CryptoMode=[[BASEBAND, DIPHASE]];
ModulationMajorType=[[OTHER, AMPLITUDE, AMPLITUDE_ANGLE, ANGLE=3, COMBINATION=4, PULSE=5, UNMODULATED=6, CARRIER_PHASE_SHIFT=7]];
ModulationDetailAplitudeType=[[ OTHER, AFSK, AM, CW, DSB, ISB, LSB, SSB_FULL, SSB_REDUC, USB, VSB]];
ModulationDetailAplitudeAngleType=[[ OTHER, APLITUDE_ANGLE]];
ModulationDetailAngleType=[[ OTHER, FM, FSK, PM]];
ModulationDetailCombinationType=[[ OTHER, AMPLITUDE_ANGLE_PULSE]];
ModulationDetailPulseType=[[ OTHER, PULSE, X_BAND, Y_BAND]];
ModulationDetailUnmodulatedType=[[ OTHER, CONTINOUS_WAVE]];
ModulationDetailCarrierPhaseShiftType=[[ OTHER ]];
ModulationSystemType=[[OTHER, GENERIC, HQ, HQII, HQIIA, SINCGARS, CCTT_SINCGARS, EPLRS, JTIDS]];
ReferenceSystem=[[WORLDCOORD=1, ENTITYCOORD=2]];
StartOfMessage=[[NOT_START, START]];
ClearChannel=[[NOT_CLEAR, CLEAR]];
TransmitTerminalPrimaryMode=[[NTR, JTIDS]];
TransmitTerminalSecondaryMode=[[NONE, NET_POSITION_REFERENCE, PRIMARY_NAVIGATION_CONTROLLER, SECONDARY_NAVIGATION_CONTROLLER]];
SyncState=[[COURSE=1, FINE=2]];
};
structs={
ModulationType={
{type="enum", name="major", enum="ModulationMajorType"};
{type="UInt16", name="detail"}; --needs to be as the right enum
{type="enum", name="system", enum="ModulationSystemType"};
};
OmniAntennaPattern={}; --this is a null pattern
BeamAntennaPattern={
{type="Vector3", name="orientation"};
{type="float", name="AzimuthBeamWidth"};
{type="float", name="ElevationBeamWidth"};
{type="enum", name="referenceSystem", enum="ReferenceSystem"};
{type="float", name="EZ"};
{type="float", name="EX"};
{type="float", name="phase"};
};
SphericalAntennaPattern={
{type="byte", name="order"};
{type="List<float>", name="coefficients"};
{type="enum", name="referenceSystem", enum="ReferenceSystem"};
};
};
attributes={
{type="string", name="entityId"};
{type="UInt16", name="radioId"};
{type="EntityEnum", name="radioEntityType", new=true};
{type="enum", name="transmitState", enum="TransmitState"};
{type="enum", name="inputSource", enum="InputSource"};
{type="Vector3", name="worldAntennaLocation"};
{type="Vector3", name="relativeAntennaLocation"};
{type="enum", name="antennaPatternType", enum="AntennaPatternType"};
{type="UInt64", name="Frequency"};
{type="float", name="transmitBandwidth"};
{type="float", name="power"};
{type="struct", name="modulationType", struct="ModulationType"};
{type="enum", name="cryptoMode", enum="CryptoMode"};
{type="enum", name="cryptoSystem", enum="CryptoSystem"};
{type="UInt16", name="cryptoKey"};
{type="List<byte>", name="modulationParameters", new=true};
{type="List<byte>", name="antennaPaternParameters", new=true};
{type="bool", name="freqHopInUse"};
{type="bool", name="pseudoNoiseInUse"};
{type="bool", name="timeHopInUse"};
}
}

10.7.2 Message Example

Message attributes can be simple data types, listed below, structures, enumerations, or arrays(lists) of acceptable attribute types.

10.7.3 Message Enums

Message Enumerations are defined in the enums table. Enumerations are given a name and then a list of enumerated values within double brackets [[ ]]. If a specific enumeration should have a specific value, then assign the enum=value in the definition. When declaring a message attribute as an enum, the type is "enum" and there is an additional field to declare which enum is used.

The following code shows how to declare an enum attribute within a message definition:

{type="enum", name="transmitState", enum="TransmitState"};

10.7.4 Message Structures

Some messages need to package up several data fields into a single structure. These structures can be defined in the structs table. A structure follows the same rules as the attributes table and uses the same data types, which are defined below. When declaring a message attribute as a struct, the type is "struct" and there is an additional field to declare which struct is used.

The following code shows how to declare a struct attribute within a message definition:

{type="struct", name="modulationType", struct="ModulationType"};

10.7.5 Message Attributes

Message attributes define the message layout. Attributes can be defined a simple data type, an enum, a structure, or a list of any of these types.

Note
Using an EntityEnum, user defined struct or List<> datatype as an attribute requires that the attribute have the field new=true be defined as well, for example:
{type="EntityEnum", name="munitionType", new=true};

10.7.6 Message Configuration

The message description has fields for the name of the file to generate (not including the extension) and the name of the class to build. The message definition also contains fields to describe any required include files, or DLL Export macro name, which are only used for the C++ code generator.

[<< ManagedInterface Concepts] [Home] [Top of Page] [Code Generator >>]


Document ID: Generated on Mon Apr 8 04:49:21 EDT 2019 from SVN revision 197403
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)