trkwsCON_MAIN_TASK

Section: Devices and Network Interfaces (4)
Updated: 2012-04-23 10:11
Index Return to man pages list
 

NAME

trkwsCON_MAIN_TASK - Main class for the trkwsControl program

 

SYNOPSIS


include "trkwsCON_MAIN_TASK.h"

ass trkwsCON_MAIN_TASK : public evhDB_TASK

public:
  trkwsCON_MAIN_TASK(const dbSYMADDRESS  dbPoint,
                   trkwsFOCUS_DATA &focusData,
                   trkwsMANAGE_LIST &LCUList,
                   mswFOCUS &focus);
 ~trkwsCON_MAIN_TASK();

  // Callbacks for public commands

 virtual evhCB_COMPL_STAT OffsetsCB(msgMESSAGE &msg, void *udata);
 virtual evhCB_COMPL_STAT PresetStarCB(msgMESSAGE &msg, void *udata);
 virtual evhCB_COMPL_STAT PresetFixCB(msgMESSAGE &msg, void *udata);
 virtual evhCB_COMPL_STAT PresetNameCB(msgMESSAGE &msg, void *udata);
 virtual evhCB_COMPL_STAT TransfersCB(msgMESSAGE &msg, void *udata);
 virtual evhCB_COMPL_STAT SetupsCB(msgMESSAGE &msg, void *udata);
 virtual evhCB_COMPL_STAT ReadAsmCB(msgMESSAGE &msg, void *udata);
 virtual evhCB_COMPL_STAT ReadPosCB(msgMESSAGE &msg, void *udata);
 virtual evhCB_COMPL_STAT ReadSidCB(msgMESSAGE &msg, void *udata);

 virtual evhCB_COMPL_STAT InitCB(msgMESSAGE &msg, void *udata);
 virtual evhCB_COMPL_STAT OnlineCB(msgMESSAGE &msg, void *udata);
 virtual evhCB_COMPL_STAT ExitCB(msgMESSAGE &msg, void *udata);

  ccsCOMPL_STAT    Init();
  ccsCOMPL_STAT    Recover();


protected:
 virtual evhCB_COMPL_STAT OffsetsOKCB(msgRAW_MESSAGE &msg, void *udata);
 virtual evhCB_COMPL_STAT OffsetsErrorCB(msgRAW_MESSAGE &msg, void *udata);

 virtual evhCB_COMPL_STAT PresetsOKCB(msgRAW_MESSAGE &msg, void *udata);
 virtual evhCB_COMPL_STAT PresetsErrorCB(msgRAW_MESSAGE &msg, void *udata);

 virtual evhCB_COMPL_STAT SetupsOKCB(msgMESSAGE &msg, void *udata);
 virtual evhCB_COMPL_STAT SetupsErrorCB(msgMESSAGE &msg, void *udata);

 virtual evhCB_COMPL_STAT GetRemTrkTimeCB(msgMESSAGE &msg, void *udata);
 virtual evhCB_COMPL_STAT SetRLimCB(msgMESSAGE &msg, void *udata);

 virtual vltLOGICAL IsOwnProcess(msgMESSAGE &msg);

 virtual ccsCOMPL_STAT State(vltINT32 state);
 vltINT32   ReadModSubstate();
 vltINT32   ReadModState();
 ccsCOMPL_STAT CheckSubstate(msgMESSAGE &msg,vltINT32 substate, vltINT32 *valid=NULL);
 ccsCOMPL_STAT PresetAct(msgMESSAGE &msg);
 ccsCOMPL_STAT ExpandCmd(msgMESSAGE &msg);

  trkwsFOCUS_DATA    &trkwsfocusData;
  trkwsMANAGE_LIST   &trkwsLCUList;
  mswFOCUS           &trkwsfocus;
  tcsDB_SYNC_ERR_CHECK       waitOffsets;
  tcsDB_SYNC_ERR_CHECK       waitPresets;
  tcsDB_SYNC_ERR_CHECK       waitGetRem;
  trkwsTRANSFER             *transOffs;
  trkwsTRANSFER             *transPres;
  trkwsTRANSFER_SER         *transRest;
  trkwsNEW_PCM_SER         *transNewPcm;
  trkwsTRANSFER_ASM         *transASM;
  trkwsTRANSFER             *transGetRem;
  trkwsPOS_CALC             *posCalc;


private:

  evhDB_COMMAND   setupCmd;
  msgMESSAGE      msg;
  msgMESSAGE      setupMsg;
  msgMESSAGE      offsPendMsg;
  msgMESSAGE      offsNewMsg;
  vltLOGICAL      offsPending;
  msgMESSAGE      presPendMsg;
  msgMESSAGE      presNewMsg;
  vltLOGICAL      presPending;
  vltLOGICAL      presAstro;
  dbSYMADDRESS    dbBasePoint;


  // Configuration parameters (read from DB) in Init():
  vltINT32     offsetTimeout;
  vltINT32     presetTimeout;
  vltINT32     setupTimeout;
  vltINT32     transferTimeout;


 

PARENT CLASS


 evhDB_TASK

 

DESCRIPTION


An instance of this class is the core of the trkwsControl program, which
is the main workstation process for the tracking module. All commands
for the tracking module are received by this process (with the exceptions
of autoguiding and field stabilisation telescope corrections, that are
sent directly to the involved LCUs).
 Some of these commands are transferred without modifications to all LCUs
involved in tracking. Other commands are processed and then distributed,
and still others are completely processed on the WS, without any LCU
involvement.

When the object is created it registers the callbacks for all the commands.
Whenever one of these commands is received, the corresponding callback is
called.
The class uses other objects to handle the distribution of commands to a
list of LCUs, and to interface with the trkwsSetup program.


 

PUBLIC METHODS


  trkwsCON_MAIN_TASK(const dbSYMADDRESS  dbPoint,
                   trkwsFOCUS_DATA &focusData,
                   trkwsMANAGE_LIST &LCUList,
                   mswFOCUS &focus);

  The constructor receives as parameter the symbolic address of the
  online database support point for the object, i.e. the point
  where the object can find configuration and private run time values.
  It initialises some internal data, installs all command callbacks,
  creates the objects used for transfer of commands to LCUs, and
  calls the Init() function to read and initialise configuration parameters.

 ~trkwsCON_MAIN_TASK();

  The destructor de-registers all callbacks and deletes the transfer
  objects.


 virtual evhCB_COMPL_STAT OffsetsCB(msgMESSAGE &msg, void *udata);

    This is the initial callback for all offset commands.
    If the given offset command is not accepted in the actual
    state/substate, the command is rejected. If an offset command is
    pending, a reply is sent to the originator of that command, and the
    new one becomes the pending command. The command is then sent to
    all tracking LCUs. Finally, callbacks for Ready, Timeout and Error are set up
    and the wait is triggered.

 virtual evhCB_COMPL_STAT PresetStarCB(msgMESSAGE &msg, void *udata);

    This is the initial callback for the 'astronomical' preset command.
    The command is rejected if the state of the trkws module is not
    ONLINE. If the command is acepted, the parameters are picked up,
    converted, and stored in the database. Then the internal method
    'PresetAct' is called, to handle the command.

 virtual evhCB_COMPL_STAT PresetFixCB(msgMESSAGE &msg, void *udata);

    This is the initial callback for the 'engineering' preset command,
    to given alt/az position.
    The command is rejected if the state of the trkws module is not
    ONLINE. If the command is acepted, the parameters are picked up,
    converted, and stored in the database. Then the internal method
    'PresetAct' is called, to handle the command.

 virtual evhCB_COMPL_STAT PresetNameCB(msgMESSAGE &msg, void *udata);

    This is the initial callback for the 'engineering' preset command,
    to a named position.
    The command is rejected if the state of the trkws module is not
    ONLINE. If the command is acepted, the parameters are picked up,
    converted, and stored in the database. Then the internal method
    'PresetAct' is called, to handle the command.

 ccsCOMPL_STAT PresetAct(msgMESSAGE &msg);

      This is a method that is used for all preset commands, to perform
    the actions that are the same.
     If a preset command is pending, a reply is sent to the originator
    of that command, and the new one becomes the pending command. The
    state of the trkwsControl process is set to PRESETTING. The command
    is then sent to all tracking LCUs.
    Finally, callbacks for Ready, Timeout and Error are set up  and the
    wait is triggered.

 virtual evhCB_COMPL_STAT TransfersCB(msgMESSAGE &msg, void *udata);

     This is the initial callback for commands that can be transferred
     to the tracking LCUs without any processing on the WS. This is
     done by use of a support object that queues the commands, i.e. one
     command of this kind has to be ready before the next one is sent
     to the LCUs.
     The support object also sends back reply to the originator of the
     command.

 virtual evhCB_COMPL_STAT SetupsCB(msgMESSAGE &msg, void *udata);

     This is the initial callback for setup-file commands. The
     command is passed to the cooperating process trkwsSetup, by
     use of an interfacing object.

 virtual evhCB_COMPL_STAT ReadAsmCB(msgMESSAGE &msg, void *udata);

      This callback is used to immediately invoke a callback that is
 called periodically, but with low frequency. The Site Monitor data are
 read, the tracking database updated, the data sent to all tracking LCUs
 and finally the data are also passed back in the reply to the command.

 virtual evhCB_COMPL_STAT ReadPosCB(msgMESSAGE &msg, void *udata);

      This callback is used to read the actual position of the telescope

 virtual evhCB_COMPL_STAT SetRLimCB(msgMESSAGE &msg, void *udata);

      Set the value for the remaining tracking time limit.
      If the RTT goes below this limit an alarm will be raised.

 virtual evhCB_COMPL_STAT ReadSidCB(msgMESSAGE &msg, void *udata);

      This callback is used to retrieve the local sidereal time from the
 database where it is scanned to from one LCU.

 virtual evhCB_COMPL_STAT InitCB(msgMESSAGE &msg, void *udata);

     This callback is called when the INIT command is received.
     If the message contains the parameter ALL, the INIT command is
     first passed to the trkwsSetup process. Then the Init() function
     is called.

 virtual evhCB_COMPL_STAT OnlineCB(msgMESSAGE &msg, void *udata);

     This callback is called when the ONLINE command is received.
     If the module is already ONLINE, sends back a reply and returns,
     otherwise it behaves like init.

 virtual evhCB_COMPL_STAT ExitCB(msgMESSAGE &msg, void *udata);

     This callback is called when the EXIT command is received.
     If the message contains the parameter ALL, the EXIT command is
     first passed to the trkwsSetup process. This callback sends
     the final reply, and thus causes the process to really exit.


  ccsCOMPL_STAT    Init();

     This function overloads the Init method inherited from the
     base class. It reads configuration parameters from the data-
     base, and initialises some internal structures and data. It
     also sets the state of the process trkwsControl to ONLINE.

  ccsCOMPL_STAT    Recover();

     This method is used to try to recover from a severe error.
     The attemptt is logged.
     First, the state is set to ERROR, so that interested processes
     can be notified.
     The Init() method is called to reinitialize everything.

 

PUBLIC DATA MEMBERS


     None.


 

PROTECTED METHODS


 virtual evhCB_COMPL_STAT OffsetsOKCB(msgRAW_MESSAGE &msg, void *udata);

     This callback is called when an offset command has been transferred
     successfully to all involved LCUs. An OK reply is sent back to the
     originator of the command.

 virtual evhCB_COMPL_STAT OffsetsErrorCB(msgRAW_MESSAGE &msg, void *udata);

      This callback is executed on error or timeout from any of the
      LCUs that received an offset command. An error reply is sent back
      to the originator of the command.


 virtual evhCB_COMPL_STAT PresetsOKCB(msgRAW_MESSAGE &msg, void *udata);

     This callback is called when a preset command has been transferred
     successfully to all involved LCUs. An OK reply is sent back to the
     originator of the command.


 virtual evhCB_COMPL_STAT PresetsErrorCB(msgRAW_MESSAGE &msg, void *udata);

      This callback is executed on error or timeout from any of the
      LCUs that received a preset command. An error reply is sent back
      to the originator of the command.


 virtual evhCB_COMPL_STAT SetupsOKCB(msgMESSAGE &msg, void *udata);

      This callback is executed when a non-error reply is received from
      the trkwsSetup process. If the reply is not the last reply, it is
      ignored. If it IS the last one, an OK reply is sent back to the
      original caller.


 virtual evhCB_COMPL_STAT SetupsErrorCB(msgMESSAGE &msg, void *udata);

      This callback is called when an error reply or a time-out is
      received from the trkwsSetup process. An error reply is sent to the
      original caller.

 ccsCOMPL_STAT ExpandCmd(msgMESSAGE &msg);
      This method checks and expands cmd parameters and delivers the
      resulting parameter string in the original msg buffer.

 virtual ccsCOMPL_STAT State(vltINT32 state);
      This method is overloading the standard one to allow enabling and
      disabling database events for certain states.
      With this features like alarms for passing of limits are implemented.

 vltINT32   ReadModSubstate();
      This function reads and returns the substate of the TRACKING module.


 vltINT32   ReadModState();
      This function reads and returns the state of the TRACKING module.


 ccsCOMPL_STAT CheckSubstate(msgMESSAGE &msg,vltINT32 substate, vltINT32 *valid=NULL);
      This function checks if the trkws substate is the required one for
      the given command.
      If an pointer to  vltINT32 is given as last parameter, on return it will
      contain the valid expected substate.



 

PROTECTED DATA MEMBERS


ooperating objects:
  trkwsFOCUS_DATA    &trkwsfocusData;
  trkwsMANAGE_LIST   &trkwsLCUList;
  mswFOCUS           &trkwsfocus;
  trkwsTRANSFER      *transOffs;
  trkwsTRANSFER      *transPres;
  trkwsTRANSFER_SER  *transRest;
  trkwsNEW_PCM_SER         *transNewPcm;
  trkwsTRANSFER_ASM  *transASM;
  trkwsPOS_CALC      *posCalc;     to handle events for new position from alt/az LCUs

ynchronisation objects:
  tcsDB_SYNC_ERR_CHECK       waitOffsets;
  tcsDB_SYNC_ERR_CHECK       waitPresets;


 

PRIVATE DATA MEMBERS


  ccsCOMPL_STAT CheckLimits (vltDOUBLE ra,
                             vltDOUBLE de,
                             vltBYTES4 syst,
                             vltDOUBLE ep,
                             vltDOUBLE eq,
                             vltDOUBLE pma,
                             vltDOUBLE pmd,
                             vltDOUBLE rv,
                             vltDOUBLE plx,
                             vltBYTES8  type,
                             vltLOGICAL *limitsOk);
      This functions checks if the alt/az limits are violated for
      the given parameters.


  evhDB_COMMAND   setupCmd;         handling setup commands
  msgMESSAGE      msg;              local temporary copy of any message
  msgMESSAGE      setupMsg;         local copy of setup message
  msgMESSAGE      offsPendMsg;      local storage of the pending offset message
  msgMESSAGE      offsNewMsg;       local temp. copy of received offset mssg
  vltLOGICAL      offsPending;      flag for offset pending
  msgMESSAGE      presPendMsg;      local storage of pending preset message
  msgMESSAGE      presNewMsg;       local temp. copy of received preset message
  vltLOGICAL      presPending;      flag for preset pending
  vltLOGICAL      presAstro;        flag for type of preset (astronomical
                                    or engineering).
  dbSYMADDRESS    dbBasePoint;      database point name for 'trk'
  dbSYMADDRESS    dbDataPoint;      database point name for 'trk:data'
  dbSYMADDRESS    dbControlPoint;   database point name for 'trk:control'
  dbSYMADDRESS    dbDataSetupPoint; database point name for 'trk:data:setup'


  vltINT32     offsetTimeout;    local copy of DB item for offset
                                 time-out
  vltINT32     presetTimeout;    local copy of DB item for preset
                                 time-out
  vltINT32     setupTimeout;     local copy of DB item for time-out
                                 from trkwsSetup
  vltINT32     transferTimeout;  local copy of DB item for time-out
                                 for standard transfer commands


 

DEFINES


  Defines for strings used internally

  #define OFFS_TIMEOUT     "offsetTimeout"
  #define PRESET_TIMEOUT   "presetTimeout"
  #define SETUP_TIMEOUT    "setupTimeout"
  #define TRANSFER_TIMEOUT "transferTimeout"


ON-LINE DATABASE

   The class shares an instance of the trkwsCONTROL class with
   trkwsCON_STD_COMMANDS.


 

SEE ALSO


    evhDB_TASK




 

Index

NAME
SYNOPSIS
PARENT CLASS
DESCRIPTION
PUBLIC METHODS
PUBLIC DATA MEMBERS
PROTECTED METHODS
PROTECTED DATA MEMBERS
PRIVATE DATA MEMBERS
DEFINES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 10:11:26 GMT, April 23, 2012