#include "mswCHANGE_FOCUS.h" class mswCHANGE_FOCUS : public evhDB_TASK { public: mswCHANGE_FOCUS(mswMOD_LIST_MANAGER &listManager); mswCHANGE_FOCUS(const dbSYMADDRESS dbPoint, mswMOD_LIST_MANAGER &listManager); ~mswCHANGE_FOCUS(); virtual vltLOGICAL CheckPresetToZenith(); virtual vltINT32 CurrentFocus(); ccsCOMPL_STAT RegisterCallbacks(evhOBJ_CALLBACK okCB, evhOBJ_CALLBACK errCB); virtual ccsCOMPL_STAT Execute(msgMESSAGE &msg) = 0; protected: virtual mswCHANGE_FOCUS &CurrentFocus(vltINT32 currFoc); virtual ccsCOMPL_STAT ReadMirrorsPos(vltINT32 *currFoc); ccsCOMPL_STAT CheckPresetToZenith(msgMESSAGE &msg) protected: mswFOCUS focus; mswMOD_LIST_MANAGER &modListManager; msgMESSAGE chFocusMsg; evhDB_CMD_SERIAL *M3Cmd; msgMESSAGE M3Msg; evhOBJ_CALLBACK chFocusOkCB; evhOBJ_CALLBACK chFocusErrorCB; }
evhDB_TASK
Base class to perform focus change. It is a pure virtual class. Subclasses implements the real focus changing functionality taking into account the specific telescope architecture (VLT, NTT).
mswCHANGE_FOCUS(mswMOD_LIST_MANAGER &listManager); mswCHANGE_FOCUS(const dbSYMADDRESS dbPoint, mswMOD_LIST_MANAGER &listManager); Two constructors are provided. The second one receives as parameter the symbolic address of online database support point for the object, i.e. the point where the object can find configuration and run time values. The first one defines the online database support point calling the standard tcsDbRoot(4) function and appenting the default relative path from the TCS database root point, assuming a complete default TCS database structure. It prepares all the internal structures. It reads from the database the timeout value for the commands to be sent by means of internal object and installs the callbacks to process the replies. It computes from the mirrors position the current focus and saves this value in the database. ~mswCHANGE_FOCUS() Deletes all the internal structures created dynamically. virtual vltLOGICAL CheckPresetToZenith(); Checks if the telescope is pointing to zenith. Reads from the database the current altitude (with an indirect addressing) and compares this value with a range around zenith (90 deg). virtual vltINT32 CurrentFocus(); Returns the current focus value as stored in the database. ccsCOMPL_STAT RegisterCallbacks(evhOBJ_CALLBACK okCB, evhOBJ_CALLBACK errCB); Registers into the change focus object a success and an error callback, which have to be called respectively either when the change focus procedure has completed successfully or when any error occurred. By means of these callbacks the program flow comes back always under mswCONTROL_MAIN object control. vltDOUBLE GetFocusOffset(void); void SetFocusOffset(vltDOUBLE foffset); vltLOGICAL IsSelectIntrument(msgMESSAGE &msg); virtual ccsCOMPL_STAT CheckModeSwitchingState(vltINT32 actState, vltINT32 actSubState); virtual ccsCOMPL_STAT Execute(msgMESSAGE &msg) = 0; Pure virtual function. It is overridden by the corresponding function in the derived classes to implement the actual changing focus procedure.
virtual mswCHANGE_FOCUS &CurrentFocus(vltINT32 currFoc); Stores the current focus value in the database. virtual ccsCOMPL_STAT ReadMirrorsPos(vltINT32 *currFoc); Computes the current focus by reading the mirrors positions. Here only a default dummy implementation is provided, returning always the initial focus defined in mswDefines.h by mswSTARTING_FOCUS. Every subclass should provide a proper implementation.
mswFOCUS focus; Standard focur access object. mswMOD_LIST_MANAGER &modListManager; List manager object, used when accessing the msw database table. msgMESSAGE chFocusMsg; Message object to store received command in order to return reply to the sender from the callbacks. evhDB_CMD_SERIAL *M3Cmd; Command object to send commands to M3 subsystem. msgMESSAGE M3Msg; Message object to store command to M3 subsystem. evhOBJ_CALLBACK chFocusOkCB; Callback function object to store the pointer to the mswCONTROL_MAIN method, which is called when the change focus procedure has completed successfully. evhOBJ_CALLBACK chFocusErrorCB; Callback function object to store the pointer to the mswCONTROL_MAIN method, which is called when an error occurred during the change focus procedure.
The following database branch in the preset structure pertains to the instance of mswCHANGE_FOCUS: CLASS evhDB_TASK mswCHANGE_FOCUS
ATTRIBUTE INT32 currentFocus ATTRIBUTE BYTES256 altAddr ATTRIBUTE INT32 M3CmdTimeout ATTRIBUTE evhDB_CMD_SERIAL M3Cmd
TCS_DBPOINT - TCs default database root point
evhDB_TASK(4), tcsDbRoot(4)