mswCONTROL
Section: Devices and Network Interfaces (4)
Updated: 2012-04-23 10:09
Index
Return to man pages list
NAME
mswCONTROL - Main object's class for the TCS Mode Switching process.
Receives and handles all the commands not implemented
in a standard way.
SYNOPSIS
#include "mswCONTROL.h"
class mswCONTROL : public evhDB_TASK
{
public:
mswCONTROL(mswMOD_LIST_MANAGER &listManager,
mswINS_CONFIG_TABLE &insTable,
mswEVAL_STATE &eval,
mswCHANGE_FOCUS &changeFoc);
mswCONTROL(const dbSYMADDRESS dbPoint,
mswMOD_LIST_MANAGER &listManager,
mswEVAL_STATE &evalState
mswCHANGE_FOCUS &changeFocus);
~mswCONTROL();
virtual evhCB_COMPL_STAT TcsColdStartCB(msgMESSAGE &msg, void *udata);
virtual evhCB_COMPL_STAT TcsStartCB (msgMESSAGE &msg, void *udata);
virtual evhCB_COMPL_STAT TcsStopCB (msgMESSAGE &msg, void *udata);
virtual evhCB_COMPL_STAT TcsShutdownCB (msgMESSAGE &msg, void *udata);
virtual evhCB_COMPL_STAT TcsPauseCB (msgMESSAGE &msg, void *udata);
virtual evhCB_COMPL_STAT TcsPresetCB (msgMESSAGE &msg, void *udata);
virtual evhCB_COMPL_STAT TcsEndPresetCB(msgMESSAGE &msg, void *udata);
virtual evhCB_COMPL_STAT TcsALignCB (msgMESSAGE &msg, void *udata);
virtual evhCB_COMPL_STAT TcsEndAlignCB(msgMESSAGE &msg, void *udata);
virtual evhCB_COMPL_STAT TcsPermForceSetCB (msgMESSAGE &msg, void *udata);
virtual evhCB_COMPL_STAT TcsRelForceSetCB(msgMESSAGE &msg, void *udata);
virtual evhCB_COMPL_STAT ExitCB(msgMESSAGE &msg, void *udata);
virtual evhCB_COMPL_STAT InitCB(msgMESSAGE &msg, void *udata);
ccsCOMPL_STAT Init();
ccsCOMPL_STAT Recover();
protected:
virtual evhCB_COMPL_STAT MswDoneCB(msgMESSAGE &msg, void *udata);
virtual evhCB_COMPL_STAT MswErrorCB(msgMESSAGE &msg,
vltLOGICAL chFocusErr = ccsFALSE);
vltLOGICAL ForceSetting();
mswCONTROL &ForceSetting(const vltLOGICAL);
mswMOD_LIST_MANAGER &modListManager;
mswEVAL_STATE &evalState;
msgMESSAGE mswMsg;
private:
ccsCOMPL_STAT ActivateSyncObj(int readyState);
// The following methods take care correctly of error handling
ccsCOMPL_STAT GetState(vltINT32 &stateValue);
ccsCOMPL_STAT GetState(vltINT32 &stateValue,vltINT32 &subStateValue);
ccsCOMPL_STAT SetSubState(vltINT32 subStateValue);
vltLOGICAL CommandInProgress(msgMESSAGE &msg);
ccsCOMPL_STAT BroadcastCommand(msgCMD cmdName, char *cmdBuf = "",
vltINT8 phase = mswSEND_NO_PHASE)
ccsCOMPL_STAT ConstructorInit();
evhDB_SYNC waitAllReady;
vltINT32 readyTimeout;
vltINT32 stopTimeout;
}
PARENT CLASS
evhDB_TASK
DESCRIPTION
An instance of this class is the core of the mswControl program and
is used to receive and handle Mode Switching commands and to perform all
the "administrative work".
When it is created it registers the callbacks for the supported
commands and reads from the online database the configuration parameters.
Whenever one of these commands is received, the corresponding action is
issued.
Many of the callbacks for mode switching commands have the same structure.
PUBLIC METHODS
mswCONTROL(mswMOD_LIST_MANAGER &listManager,
mswEVAL_STATE &eval);
mswCONTROL(const dbSYMADDRESS dbPoint,
mswMOD_LIST_MANAGER &listManager,
mswEVAL_STATE &evalState);
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, install the callbacks
and call Init() to read and initialize all configuration parms.
It receives also pointers to cooperating objects, that must heve
been already created.
~mswCONTROL()
Deregisters al the callbacks.
evhCB_COMPL_STAT InitCB(msgMESSAGE &msg, void *udata);
This is called when the INIT command is received.
ccsCOMPL_STAT Init()
Overwrite of the Init method inherited from the base class.
Reads from the database all the configuration parameters.
This method is called also by the inherited InitCB whenever an Init()
command is received.
ccsCOMPL_STAT Recover();
Try to recover from a severe error.
It can be used for example when a callback
generates a severe error and makes the main loop to return. The main
can then try to recover using this method and to go back in the
main-loop. It calls Init() to reinitialize the objects.
evhCB_COMPL_STAT ExitCB(msgMESSAGE &msg, void *udata);
Overload the inherited callback. This is called when the EXIT command
is received.
evhCB_COMPL_STAT TcsColdStartCB(msgMESSAGE &msg, void *udata);
This function is called whenever the CSTART command is received.
First it checks if the command can be accepted, i.e. if:
- The object is not performing a mode switching
- The requested transition is compatible with the current state.
If not, sends a proper error reply to the sender.
If the command can be accepted, stores the received message for later use
and calls the RefreshAndSend() method of the listManager object to
ask all the required unit to go in stand-by, after having checked the
mirror positions and updaded the required list.
The correct sequence to goto standby is INIT followed by STANDBY, using
the START PHASE order for modules.
This means that first an INIT command is sent to all required modules,
but following the sequence for START PHASE (a command is sent to a module
in phase n+1 only after all commands sent for modules in phase n are completed).
When this is completed, a STANDBY command is sent with the same procedure.
It changes the substate to indicate the transition.
Then it installs the MswDoneCB() callback to monitor the state attribute
of the listManager object.
This attribute changes value when the command has been completed or an
error occurred.
It then changes the substate to indicate the completion of the transition.
It also disables state evaluation during the transition.
evhCB_COMPL_STAT TcsStartCB(msgMESSAGE &msg, void *udata);
This function is called whenever the START command is received.
First it checks if the command can be accepted, i.e. if:
- The object is not performing a mode switching
- The requested transition is compatible with the current state.
If not, send a proper error reply to the sender.
If the command can be accepted, store the received message for later use
and calls the RefreshAndSend() method of the listManager object to
ask all the required unit to go in online, after having checked the
mirror positions and updated the required list.
The correct sequence to goto online is ONLINE.
This means that an ONLINE command is sent to all required modules,
but following the sequence for START PHASE (a command is sent to a module
in phase n+1 only after all commands sent for modules in phase n are completed).
It changes the substate to indicate the transition.
Then it installs the MswDoneCB() callback to monitor the state attribute
of the listManager object.
This attribute changes value when the command has been completed or an
error occurred.
It then changes the substate to indicate the completion of the transition.
It also disables state evaluation during the transition.
evhCB_COMPL_STAT TcsStopCB(msgMESSAGE &msg, void *udata);
This function is called whenever the STOP command is received.
First it checks if the command can be accepted, i.e. if:
- The object is not performing a mode switching
- The requested transition is compatible with the current state.
If not, send a proper error reply to the sender.
If the command can be accepted, store the received message for later use
and calls the RefreshAndSend() method of the listManager object to
ask all the required unit to go in standby, after having checked the
mirror positions and updated the required list.
The correct sequence to goto standby is STANDBY.
This means that first a STANDBY command is sent to all required modules,
but following the sequence for START PHASE (a command is sent to a module
in phase n+1 only after all commands sent for modules in phase n are completed).
It changes the substate to indicate the transition.
Then it installs the MswDoneCB() callback to monitor the state attribute
of the listManager object.
This attribute changes value when the command has been completed or an
error occurred.
It then changes the substate to indicate the completion of the transition.
It also disables state evaluation during the transition.
evhCB_COMPL_STAT TcsShutdownCB(msgMESSAGE &msg, void *udata);
This function is called whenever the SHDOWN command is received.
First it checks if the command can be accepted, i.e. if:
- The object is not performing a mode switching
- The requested transition is compatible with the current state.
If not, send a proper error reply to the sender.
If the command can be accepted, store the received message for later use
and calls the RefreshAndSend() method of the listManager object to
ask all the required unit to go in off/loaded, after having checked the
mirror positions and updated the required list.
The correct sequence to goto off/loaded is STOP followed by OFF, using
the STOP PHASE order for modules.
This means that first a STOP command is sent to all required modules,
but following the sequence for STOP PHASE (a command is sent to a module
in phase n+1 only after all commands sent for modules in phase n are completed).
When this is completed, a OFF command is sent (no phase is used in this last case).
It changes the substate to indicate the transition.
Then it installs the MswDoneCB() callback to monitor the state attribute
of the listManager object.
This attribute changes value when the command has been completed or an
error occurred.
It then changes the substate to indicate the completion of the transition.
It also disables state evaluation during the transition.
evhCB_COMPL_STAT TcsPauseCB(msgMESSAGE &msg, void *udata);
THIS IS NOT IMPLEMENTED JET!!
This function is called whenever the PAUSE command is received.
First it checks if the command can be accepted, i.e. if:
- The object is not performing a mode switching
- The requested transition is compatible with the current state.
If not, send a proper error reply to the sender.
If the command can be accepted, store the received message for later use
and calls the RefreshAndSend() method of the listManager object with
parameter TRACKING to ask all the required tracking units to go to
standby, after having checked the mirror positions and updated the
required tracking list.
It changes the substate to indicate the transition.
Then it installs the MswDoneCB() callback to monitor the state attribute
of the listManager object.
This attribute changes value when the command has been completed or an
error occurred.
It then changes the substate to indicate the completion of the transition.
It also disables state evaluation during the transition.
evhCB_COMPL_STAT TcsPresetCB(msgMESSAGE &msg, void *udata);
This function is called whenever the PRESET command is received.
First it checks if the command can be accepted, i.e. if:
- The object is not performing a mode switching
- The requested transition is compatible with the current state.
If not, send a proper error reply to the sender.
If the command can be accepted, changes the substate, and return a reply
in order for prs to go ahead.
evhCB_COMPL_STAT TcsEndPresetCB(msgMESSAGE &msg, void *udata);
This function is called whenever the EPRESET command is received.
From PRESETTING substate goes to IDLE
If not PRESETTING, it just sends back an OK reply.
evhCB_COMPL_STAT TcsAlignCB(msgMESSAGE &msg, void *udata);
This function is called whenever the ALIGN command is received.
First it checks if the command can be accepted, i.e. if:
- The object is not performing a mode switching
- The requested transition is compatible with the current state.
If not, send a proper error reply to the sender.
If the command can be accepted, changes the substate, and return a reply
in order for prs to go ahead.
evhCB_COMPL_STAT TcsEndAlignCB(msgMESSAGE &msg, void *udata);
This function is called whenever the EALIGN command is received.
From ALIGNING substate goes to IDLE
If not ALIGNING, it just sends back an OK reply.
evhCB_COMPL_STAT TcsPermForceSetCB(msgMESSAGE &msg, void *udata);
This function is called whenever the GETPERM command is received.
First it checks if the command can be accepted, i.e. if:
- The object is not performing a mode switching
- The requested transition is compatible with the current state.
If not, send a proper error reply to the sender.
If the command can be accepted, sets the internal flag and returns a reply
in order for active optics to go ahead.
evhCB_COMPL_STAT TcsRelForceSetCB(msgMESSAGE &msg, void *udata);
This function is called whenever the RELPERM command is received.
First it checks if the command can be accepted, i.e. if:
- The object is not performing a mode switching
- The requested transition is compatible with the current state.
If not, send a proper error reply to the sender.
If the command can be accepted, sets the internal flag and returns a reply
in order for active optics to go ahead.
PROTECTED METHODS
evhCB_COMPL_STAT MswDoneCB(msgMESSAGE &msg, void *udata);
This callback is called every time the object is waiting for the
completion of a command sent via the listManager object to many
coordination modules. It detects completion by monitoring the
state attributes for all required modules.
It enables state evaluation and sends back
the proper reply using the message safely stored by the handler
for the received command.
evhCB_COMPL_STAT MswErrorCB(msgMESSAGE &msg,
vltLOGICAL chFocusErr = ccsFALSE);
This callback is called every time the object is waiting for the
completion of a command sent via the listManager and a timeout occured.
It enables state evaluation and sends back
the proper error reply using the message safely stored by the handler
for the received command.
This function is also called whenever the CHFOCUS or SELINS commands
have got an error.
This function is registered during the constructor method into the
change focus object which saves it in a pointer.
vltLOGICAL ForceSetting();
mswCONTROL &ForceSetting(const vltLOGICAL);
These two methods are used to set/retrieve the database flag that marks
when the system is performin a M1 force setting cycle.
They are used internally by TcsPermForceSetCB (command GETPERM) and
TcsRelForceSetCB (command RELPERM).
ccsCOMPL_STAT GetState(vltINT32 &stateValue);
ccsCOMPL_STAT GetState(vltINT32 &stateValue,vltINT32 &subStateValue);
Puts in the given variable(s) the current state (ands substate)
of the module, taking care of sending an error reply in
case of errors accessing the data.
ccsCOMPL_STAT SetSubState(vltINT32 subStateValue);
Sets the module sub-state, taking care of sending an
error reply in case of errors accessing the data.
vltLOGICAL CommandInProgress(msgMESSAGE &msg);
Return TRUE is a mode scwitching is already under execution.
PROTECTED DATA MEMBERS
mswMOD_LIST_MANAGER &modListManager;
listManager object
mswEVAL_STATE &evalState;
evalState object
msgMESSAGE mswMsg;
message to store command in order to return reply from callback.
PRIVATE METHODS
ccsCOMPL_STAT ActivateSyncObj(int readyState);
Activates a evhDB_SYNC object to wait until all modules
which the broadcast command has been sent to, are in the specified state.
No error from here - always SUCCESS.
ccsCOMPL_STAT BroadcastCommand(msgCMD cmdName, char *cmdBuf = "",
vltINT8 phase = mswSEND_NO_PHASE);
Sends the same command to all required modules.
It handles errors, sending an error reply to the originator
of the current command.
ccsCOMPL_STAT ConstructorInit();
Support method called by the constructors to grup in a single
place code that would have been otherwise copied in all constructors
PRIVATE DATA MEMBERS
evhDB_SYNC waitAllReady;
Object to synchronize on all events from state attributes after a
mode switching command.
vltINT32 readyTimeout;
Stores the timeout value for the completion of any mode switching command.
vltINT32 stopTimeout;
Now not used.
ON LINE DATABASE
The following database branch in the msw structure pertains
to the instance of mswCONTROL:
CLASS evhDB_TASK mswCONTROL //
BEGIN //
ATTRIBUTE int32 substate mswSUB_STATE_IDLE //
ATTRIBUTE int32 busy 0 //
ATTRIBUTE logical forceSetting 0 //
ATTRIBUTE int32 readyTimeout 10 //
ATTRIBUTE int32 stopTimeout 10 //
ATTRIBUTE mswMOD_LIST_MANAGER list //
ATTRIBUTE mswCHANGE_FOCUS foc //
ATTRIBUTE mswINS_CONFIG_DATA insData //
CAUTIONS
Some functionality is not yet implemented, like the PAUSE command
SEE ALSO
evhDB_TASK(4),
mswMOD_LIST_MANAGER(4), mswCHANGE_FOCUS(4),
mswINS_CONFIG_DATA(4)
Index
- NAME
-
- SYNOPSIS
-
- PARENT CLASS
-
- DESCRIPTION
-
- PUBLIC METHODS
-
- PROTECTED METHODS
-
- PROTECTED DATA MEMBERS
-
- PRIVATE METHODS
-
- PRIVATE DATA MEMBERS
-
- ON LINE DATABASE
-
- BEGIN //
-
- CAUTIONS
-
- SEE ALSO
-
This document was created by
man2html,
using the manual pages.
Time: 10:09:27 GMT, April 23, 2012