#
# GSML Specification File: Version 0.1.4
#
# This specification file is used to automatically generate GSML
# communication components (ComGsml for the Mercury system.  It defines
# all GSML messages that are used and provides the code for sending
# and receiving them.  The ComGsml component is then extended for writing
# handling specialized component communication, such as drivers.
#
# GsmlGen.java is used to compile the specification file into ComGsml.java.
#
# Grammar:
#
# Start            -> FunctionName_T (parameters_NT);
#
# parameters_NT    -> parameters_NT |
#                     parameter_NT, parameters_NT
#
# parameter_NT     -> parameterType_NT parameterName_T |
#                     Vector<objectType_T> parameterName_T (parameters_NT)
# 
# parameterType_NT -> int | long | double | boolean | String
#
#
# Vectors:
#    "<objectType>" is the name of a manually implemented class with only
#    by the GsmlGen accepted types as fields. The fields must be public.
#
#    Only one level of VECTOR is allowed by the current implementation of
#    GsmlGen, i.e a VECTOR argument cannot contain another VECTOR argument.
# 
#    fields of vectors must be organized in same order as constructor of
#    objectType class. fields must of vectors must have same names as in 
#    objectType class implementation.
#


#------------------------------------------------------------------------------
# Mercury Component Messages:
#       Common to all Mercury components.
#------------------------------------------------------------------------------

# Force a component to exit.
Die ();
# Ping a component for liveness.
Ping ();
# Get state of component.
GetState ();
# Respond to a ping with a pong.
Pong ();


#------------------------------------------------------------------------------
# SessionController:
#       GSML messages for the heart and brains of a session.
#------------------------------------------------------------------------------
# Forces the radio drivers to update themselves during automatic control with
# the latest satellite frequencies..
UpdateRadio ();
# Forces the antenna drivers to update themselves during automatic control with
# the latest satellite pointing angles.
UpdateAntenna ();

#------------------------------------------------------------------------------
# DriverRadio:
#       GSML message for controlling radio devices.
#------------------------------------------------------------------------------

# Enable or disable automatic radio tuning.  
EnableRadioAutoControl (boolean bool);
# Set update interval for automatic control.
SetRadioUpdateInterval (int ms);

# Set state of radio.
SetRadioState (
    double txFrequency,
    String txMode,
    int txPower,
    double rxFrequency,
    String rxMode,
    int squelch,
    int attenuation,
    boolean preampIsEnabled
);

# Individually set up TX parameters.
SetTxFrequency (double frequency);
SetTxMode (String mode);
SetTxPower (int level);

# Individually set up RX parameters.
SetRxFrequency (double frequency);
SetRxMode (String mode);
SetSquelch (int level);
SetAttenuation (int level);
EnablePreamp (boolean bool);

#------------------------------------------------------------------------------
# DriverAntenna
#       GSML message for controlling antenna devices.
#------------------------------------------------------------------------------
# Enable or disable automatic pointing.
EnableAntennaAutoControl (boolean bool);
# Set update interval for automatic control.
SetAntennaUpdateInterval (int ms);

# Set state of the antenna.
SetAntennaState (
    double azimuthAngle,
    double elevationAngle,
    String polarityDirection,
    boolean preampIsEnabled
);

# Individually set antenna parameters.
SetAzimuthAngle (double angle);
SetElevationAngle (double angle);
SetPolarityDirection (String direction);
EnablePreamp (boolean bool);

#------------------------------------------------------------------------------
# DriverPower
#       GSML message for controlling power devices.
#------------------------------------------------------------------------------
SetPower (String componentId, String status);


#------------------------------------------------------------------------------
# Component State Messages
#       Responses to "GetState" queries.
#------------------------------------------------------------------------------
AntennaState (
    boolean autoControlIsEnabled,
    int updateInterval,

    double azimuthAngleLastSet,
    double elevationAngleLastSet,
    String polarityDirectionLastSet,
    boolean preampIsEnabledLastSet,

    double azimuthAngleActual,
    double elevationAngleActual,
    String polarityDirectionActual,
    boolean preampIsEnabledActual,

    double azimuthWindow,
    double elevationWindow
);

RadioState (
    boolean autoControlIsEnabled,
    int updateInterval,

    double txFrequencyLastSet,
    String txModeLastSet,
    int txPowerLastSet,
    double rxFrequencyLastSet,
    String rxModeLastSet,
    int squelchLastSet,
    int attenuationLastSet,
    boolean preampIsEnabledLastSet,

    double txFrequencyActual,
    String txModeActual,
    int txPowerActual,
    double rxFrequencyActual,
    String rxModeActual,
    int squelchActual,
    int attenuationActual,
    boolean preampIsEnabledActual,

    String band,
    String duplexMode
);

PowerState (
    Vector<ModelPowerSwitch> PowerSwitch (
        String componentIdentifier,
        int portNumber,
        String status
    )
);

SessionControllerState (
    String satellite,
    double baseTxFrequency,
    String txMode,
    double baseRxFrequency,
    String rxMode,
    double longitude,
    double latitude,
    double range,
    double altitude,
    double velocity,
    double footprint,
    long orbitnum,
    int visibility,
    long time,
    String state,
    String keps,
    double azimuthAngle,
    double elevationAngle,
    double txFrequency,
    double rxFrequency,
    double doppler
);

MsgServerState (int numClients);

#------------------------------------------------------------------------------
# Logger Messages
#       Log messages sent over GSML.
#------------------------------------------------------------------------------
LogText (String level, long time, String text);
LogPingAck (String level, long time, long delay, String component);
LogRuntimeState (String level, long time, int freeMem, int totalMem);
LogExecEvent (String level, long time, String type, String component);