Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pomAUTO_MAIN_TASK.h

Go to the documentation of this file.
00001 #ifndef pomAUTO_MAIN_TASK_H
00002 #define pomAUTO_MAIN_TASK_H
00003 /*******************************************************************************
00004 * E.S.O. - VLT project
00005 *
00006 * "@(#) $Id: pomAUTO_MAIN_TASK.h,v 1.69 2003/09/17 16:04:59 vltsccm Exp $"
00007 *
00008 * who       when      what
00009 * --------  --------  ----------------------------------------------
00010 * pglaves  04/04/96  created
00011 */
00012 
00013 /************************************************************************
00014  *
00015  *----------------------------------------------------------------------
00016  */
00017 
00018 #ifndef __cplusplus
00019 #error This is a C++ include file and cannot be used from plain C
00020 #endif
00021 
00022 #include "pom.h"
00023 
00024 #include "evhDB_TASK.h"
00025 #include "evhCOMMAND.h"
00026 #include "tcsSTATE.h"
00027 #include "tcsCMD_HANDLER.h"
00028 
00029 struct ObjectData {
00030   string ra, dec, mag;
00031   int index;
00032   friend bool operator<(const ObjectData &lhs, const ObjectData &rhs)
00033     {
00034       return lhs.mag < rhs.mag;
00035     }
00036 };
00037 
00038 class pomAUTO_MAIN_TASK : public tcsSTATE
00039 {
00040 public:
00041   pomAUTO_MAIN_TASK(const dbSYMADDRESS  dbPoint);
00042   virtual ~pomAUTO_MAIN_TASK();
00043 
00044   // Standard commands' callbacks.
00045   virtual evhCB_COMPL_STAT StopCB(msgMESSAGE &msg, void *);
00046   virtual evhCB_COMPL_STAT OnlineCB(msgMESSAGE &msg, void *);
00047   virtual evhCB_COMPL_STAT StandbyCB(msgMESSAGE &msg, void *);
00048   virtual evhCB_COMPL_STAT OffCB(msgMESSAGE &msg, void *);
00049   virtual evhCB_COMPL_STAT StatusCB(msgMESSAGE &msg, void *udata);
00050     
00051   // Callbacks for the new commands
00052   virtual evhCB_COMPL_STAT TrgfileCB(msgMESSAGE &msg, void *);  
00053   virtual evhCB_COMPL_STAT AutoCB(msgMESSAGE &msg, void *);
00054   virtual evhCB_COMPL_STAT NextCB(msgMESSAGE &msg, void *);
00055   virtual evhCB_COMPL_STAT LookupCB(msgMESSAGE &msg, void *);
00056   virtual evhCB_COMPL_STAT PoinobjCB(msgMESSAGE &msg, void *);
00057   virtual evhCB_COMPL_STAT RadiusCB(msgMESSAGE &msg, void *);
00058 
00059   ccsCOMPL_STAT    Recover();
00060 
00061 
00062 protected:
00063   // Overloading of inherited commands
00064   virtual evhCB_COMPL_STAT ExitCB(msgMESSAGE &msg, void *udata);
00065   virtual evhCB_COMPL_STAT InitCB(msgMESSAGE &msg, void *udata);
00066 
00067   virtual ccsCOMPL_STAT    Stop();
00068   virtual ccsCOMPL_STAT    Init();
00069   virtual ccsCOMPL_STAT    SwitchOff();
00070 
00071   ifstream infile;
00072 
00073 
00074   ccsCOMPL_STAT    SendErrReplyCheck(tcsCMD_HANDLER& h) const {
00075     if (h.SendReply(ErrStack()) == FAILURE) {
00076       ErrAdd(tcsMOD,tcsERR_SEND_OK_REPLY,__FILE_LINE__,"");
00077       ErrStackClose();    // LOG the problem
00078       return FAILURE;
00079     }
00080     return SUCCESS;
00081   };
00082   
00083   ccsCOMPL_STAT    SendReplyCheck(tcsCMD_HANDLER& h, 
00084           const char *buff, const int len=0, 
00085           const vltLOGICAL last=ccsTRUE) {
00086     if (h.SendReply(buff,len,last) == FAILURE) {
00087       ErrAdd(tcsMOD,tcsERR_SEND_OK_REPLY,__FILE_LINE__,"");
00088       ErrStackClose();    // LOG the problem
00089       return FAILURE;
00090     }
00091     return SUCCESS;
00092   };
00093 
00094   virtual evhCB_COMPL_STAT lkupadErrorCB(msgMESSAGE &msg, void *);
00095   virtual evhCB_COMPL_STAT lkupadReplyCB(msgMESSAGE &msg, void *);
00096 
00097   virtual evhCB_COMPL_STAT catlistErrorCB(msgMESSAGE &msg, void *);
00098   virtual evhCB_COMPL_STAT catlistReplyCB(msgMESSAGE &msg, void *);
00099   
00100   virtual evhCB_COMPL_STAT poinobjErrorCB(msgMESSAGE &msg, void *);
00101   virtual evhCB_COMPL_STAT poinobjReplyCB(msgMESSAGE &msg, void *);
00102 
00103   virtual ccsCOMPL_STAT PresetToTarget(msgMESSAGE &msg, vltINT32 objidx=0);
00104 
00105   virtual evhCB_COMPL_STAT GeneralTimeoutCB( msgMESSAGE &msg, void *);
00106 
00107   tcsCMD_HANDLER *nextHandler;
00108   tcsCMD_HANDLER *poinobjHandler;
00109   tcsCMD_HANDLER *lookupHandler;
00110   // who sent lkupad command to pomMeasure?
00111   tcsCMD_HANDLER *lkupHandler; 
00112   vltDOUBLE     radius;   // lookup radius in arcmin, max=300
00113   dbSYMADDRESS       dbPoint;
00114   evhCOMMAND    cmdLKUPAD;  // to send commands to pomMeasure
00115   evhCOMMAND    cmdCATLIST; // to send commands to pomMeasure
00116   evhCOMMAND    cmdPOINOBJ; // to send commands to pomMeasure
00117   list<ObjectData*> targets;
00118 
00119 private:
00120   // path to where pointing files are
00121   char pointDir[256]; 
00122   
00123   // Standard commands.
00124   tcsCMD_HANDLER    *initHandler;    // INIT command handler
00125   tcsCMD_HANDLER    *exitHandler;    // EXIT command handler
00126   tcsCMD_HANDLER    *stopHandler;    // STOP command handler
00127   tcsCMD_HANDLER    *onlineHandler;  // ONLINE command handler
00128   tcsCMD_HANDLER    *standbyHandler; // STANDBY command handler
00129   tcsCMD_HANDLER    *offHandler;     // OFF command handler
00130   tcsCMD_HANDLER    *statusHandler;  // STATUS command handler
00131 
00132   // pomAUTO specific commands.
00133   tcsCMD_HANDLER *trgfileHandler;
00134   tcsCMD_HANDLER *autoHandler;
00135   tcsCMD_HANDLER *radiusHandler;
00136 
00137 
00138 
00139 };
00140 
00141 #endif 

Generated on Wed Dec 3 14:52:16 2003 for ATCS API by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001