The VisAO Camera
VisAO::JoeCtrl Class Reference

The interface between the CCD47Ctrl class and the AO Supervisor. More...

#include <VisAOJoeCtrl.h>

+ Inheritance diagram for VisAO::JoeCtrl:

Public Member Functions

 JoeCtrl (std::string name, const std::string &conffile) throw (AOException)
 Config file constructor.
 JoeCtrl (int argc, char **argv) throw (AOException)
 Command line constructor.
- Public Member Functions inherited from VisAO::VisAOApp_base
 VisAOApp_base ()
 Default constructor.
virtual ~VisAOApp_base ()
 Virtual destructor.
int set_euid_called ()
 Changes the user id of the process to euid_called.
int set_euid_real ()
 Changes the user id fo the process to the real user id.
int set_RT_priority (int prio)
 Set the real-time priority of the current process. More...
int get_RT_priority ()
 Get the real-time priority of the current process.
int set_app_name (std::string an)
 Set the application name.
virtual std::string get_app_name ()
 Get the application name.
virtual int setup_baseApp (bool usethreads=false)
 Install fifo channels. More...
virtual int setup_baseApp (bool remfifo, bool locfifo, bool scrfifo, bool autfifo, bool usethreads=false)
 Create fifo names, then installs the fifo channels. More...
int setup_fifo_list (int nfifos)
 Allocate the fifo_list. More...
int connect_fifo_list ()
 Connect the fifo_list with exclusive locking. More...
int connect_fifo_list_nolock ()
 Connect the fifo_list without exclusive locking. More...
int setup_sigio ()
 Setup the SIGIO signal handling. More...
int setup_RTsigio ()
 Setup SIGIO signal handling using realtime signals. More...
int check_fifo_list_RTpending ()
 Check for pending reads for the fifo list while using the RT signals.
int write_fifo_channel (int ch, const char *com, int comlen, std::string *resp)
 Write data to a fifo_channel, and get a response if desired. More...
int write_fifo_channel (int ch, const char *com, int comlen, std::string *resp, char *sm)
 Write data to a fifo_channel, with a sequence message attached, and get a response if desired. More...
int get_fifo_channel_response (std::string *resp, int ch)
 Check, and wait if neccessary, for data on a fifo channel. More...
int set_wait_to (double to)
 Set the wait timeout for fifo channel responses. More...
double get_wait_to ()
 Get the wait timeout for fifo channel responses. More...
virtual int request_control (int cmode)
 Calls request_control(cmode, 0).
virtual int request_control (int cmode, bool override)
 Attempts to change the control type. More...
virtual std::string __remote_command (std::string com, char *seqmsg)
 Processing for remote commands. More...
virtual std::string remote_command (std::string com)
 Called by __remote_command after control state logic. More...
virtual std::string remote_command (std::string com, char *seqmsg)
virtual std::string __local_command (std::string com, char *seqmsg)
 Processing for local commands. More...
virtual std::string local_command (std::string com)
 Called by __local_command after control state logic. More...
virtual std::string local_command (std::string com, char *seqmsg)
virtual std::string __script_command (std::string com, char *seqmsg)
 Processing for script commands - not normally overriden. More...
virtual std::string script_command (std::string com)
 Called by __script_command after control state logic. More...
virtual std::string script_command (std::string com, char *seqmsg)
virtual std::string auto_command (std::string com, char *seqmsg)
 Processing for auto commands - to be overriden. More...
virtual std::string post_auto_command (std::string com, char *seqmsg=0)
 Processing for auto commands - not normally overriden. More...
std::string control_mode_string ()
 Convenience function to return the control type string, e.g. "REMOTE".
std::string control_mode_response ()
 Convenience function to return the control type response string, e.g. "A\n".
virtual void error_report (int LogLevel, std::string emsg)
 Report an error. Also calls log_msg. More...
virtual void log_msg (int LogLevel, std::string lmsg)
 Log a message. More...
VisAO::profilerget_profile ()
int get_use_profiler ()
int start_profiler ()
void * get_statusboard_shmemptr ()
 Get the status board shared memory pointer. More...
int set_statusboard_shmemkey (key_t mkey)
 Set the status board shared memory key. Does nothing else. More...
key_t get_statusboard_shmemkey ()
 Get the status board shared memory key. More...
virtual int update_statusboard ()
 Update the status board. More...
virtual void dataLogger (timeval tv)
 Log data at intervals.

Protected Member Functions

void Create (void) throw (AOException)
 Read the JoeCtrl specific config vars and connect to the CCD47Ctrl.
void PostInit ()
 VIRTUAL - Perform post-initialization settings.
void SetupVars (void)
 VIRTUAL - Setups variables in RTDB.
void StateChange (int oldstate, int state)
 VIRTUAL - StateChange. More...
void Run ()
 VIRTUAL - Run. More...
int DoFSM (void)
 Perform controller functions and manage states. More...
int Start ()
 Send a start command to the CCD47Ctrl.
int Stop ()
 Send a stop command to the CCD47Ctrl.
int ReprogramJoe (int force=0)
 Calculate and send a reprogram request to the CCD47Ctrl.
int TestCCD47CtrlLink ()
 Test the link with the CCD47Ctrl, and get its state.
std::string send_ccd47_command (std::string com)
 Send a command to the CCD47 and get its response.
int GetProgramPos (int speed, int xbin, int ybin, int *need_upload)
int UpdateJoeMemory (unsigned int uploaded_file)
int LoadJoeDiskFiles (void)
int EraseLocalMemory (void)
int SetLocalMemory (unsigned int programset_num)
int ComputeFramerate ()
int ChangeFramerate (double framerate, int bestspeed=1)
littlejoe_programGetProgram (int speed, int xbin, int ybin)
int ExposeSpeeds ()
int ExposeWindows ()
int insert_value (std::vector< int > &array, int value)
littlejoe_program ReadProgram (Config_File &cfg)
littlejoe_programset ReadProgramSet (Config_File &cfg)
std::string getCompletePath (std::string filename)
 Gets the complete path of a program/pattern file.
- Protected Member Functions inherited from VisAO::VisAOApp_base
int create_statusboard (size_t sz)
 Creates and attaches to the statusboard shared memory. More...
std::string getDataFileName ()
int checkDataFileOpen ()

Static Protected Member Functions

static int EnableReqChanged (void *pt, Variable *var)
 RTDB handler for an enable change request form the AO Supervisor.
static int XbinReqChanged (void *pt, Variable *var)
 RTDB handler for an x-bin change request form the AO Supervisor.
static int YbinReqChanged (void *pt, Variable *var)
 RTDB handler for a y-bin change request form the AO Supervisor.
static int SpeedReqChanged (void *pt, Variable *var)
 RTDB handler for a speed change request form the AO Supervisor.
static int BlackReqChanged (void *pt, Variable *var)
 RTDB handler for a black level change request form the AO Supervisor.
static int FrameRateReqChanged (void *pt, Variable *var)
 RTDB handler for a frame rate change request form the AO Supervisor.
static int RepReqChanged (void *pt, Variable *var)
 RTDB handler for a repetitions change request form the AO Supervisor.
static int GainReqChanged (void *pt, Variable *var)
 RTDB handler for a gain change request form the AO Supervisor.
static int CModeReqChanged (void *pt, Variable *msgb)
 RTDB handler for a control mode change request from the AO Supervisor.
static int PresetReqChanged (void *pt, Variable *msgb)
 RTDB handler for preset request from the AO Supervisor.

Protected Attributes

int _ccdNum
 CCD number (set from cfg file)
std::string _ccdName
 CCD name.
int _ccdDx
 Size in x.
int _ccdDy
 Size in y.
unsigned int _ccdNumSpeeds
 Number of speeds.
int _maxNumSpeeds
 Maximum number of speeds.
int _maxNumBins
 Maximum number of binnings.
int _maxNumWins
std::vector< int_ccdXbins
 Vector of x binnings.
std::vector< int_ccdYbins
 Vector of y binnings.
std::vector< int_ccdSpeeds
 Vector of speeds.
std::vector< int_ccdBlacks
 Vector of black levels.
int _ccdBlacksNum
 Nuber of blacks.
int _minRep
 Minimum repititions (controls integration time)
int _maxRep
 Maximum repititions (controls integration time)
int cur_ProgramSet
 The Current program set loaded on the little joe.
int cur_Program
 The current program running on the little joe.
int cur_Gain
 The current gain running on the little joe.
int cur_Reps
 The current repititions running on the little joe.
int _startProgramSet
 The program set currently set to load from flash on little joe power up.
int _ccdDefaultXbin
 Default x binning.
int _ccdDefaultYbin
 Default y binning.
int _ccdDefaultSpeed
 Default speed.
int _ccdDefaultBlack
 Default black levels.
littlejoe_programset memory
 Struct representing LittleJoe's internal memory.
std::vector< littlejoe_programsetondisk
 Struct array representing files that can be uploaded to LittleJoe (each one is a memory dump)
RTDBvar var_name
RTDBvar var_status
RTDBvar var_errmsg
RTDBvar var_enable_cur
RTDBvar var_enable_req
RTDBvar var_dx
RTDBvar var_dx_cur
RTDBvar var_dy
RTDBvar var_dx_req
RTDBvar var_dy_cur
RTDBvar var_dy_req
RTDBvar var_windowxs
RTDBvar var_windowys
RTDBvar var_xbins
RTDBvar var_ybins
RTDBvar var_speeds
RTDBvar var_xbin_cur
RTDBvar var_ybin_cur
RTDBvar var_speed_cur
RTDBvar var_black_cur
RTDBvar var_xbin_req
RTDBvar var_ybin_req
RTDBvar var_speed_req
RTDBvar var_black_req
RTDBvar var_temps
RTDBvar var_framerate_cur
RTDBvar var_framerate_req
RTDBvar var_rep_cur
RTDBvar var_rep_req
RTDBvar var_gain_cur
RTDBvar var_gain_req
RTDBvar var_fanReq
RTDBvar var_cmode_cur
 The current control mode in the RTDB.
RTDBvar var_cmode_req
 The requested control mode in the RTDB.
RTDBvar var_preset_req
 Preset to program set 0, program 0, for presetVisAO.
int _fanCtrlActive
int _fanOnTemp
int _fanOffTemp
- Protected Attributes inherited from VisAO::VisAOApp_base
std::string app_name
 The name of the application.
double pause_time
 Time to pause during application main loop.
fifo_list fl
 The list of named-pipe fifos used for inter-process comms.
std::string com_path
 The control fifo path base name.
std::string com_path_remote
 The path for the remote control fifos.
std::string com_path_local
 The path for the local control fifos.
std::string com_path_script
 The path for the script control fifos.
std::string com_path_auto
 The path for the auto control fifos.
double wait_to
 The timeout for waiting on responses from FIFOs in seconds.
std::ostringstream logss
 Conveninence string stream for building log messages.
std::string profile_path
int use_profiler
void * statusboard_shmemptr
 The pointer to the shared memory block for the statusboard.
key_t statusboard_shmemkey
 The key used to lookup the shared memory.
int statusboard_shmemid
 The ID of the shared memory block.
std::ofstream dataof
bool dataFileOpen
double dataFileOpenTime
double data_log_time_length
std::string data_save_path
std::string data_file_prefix

Additional Inherited Members

- Public Types inherited from VisAO::VisAOApp_base
enum  control_modes {
 The control modes.
- Public Attributes inherited from VisAO::VisAOApp_base
pthread_mutex_t my_mutex
 Mutex used by the threaded versions of the standard command handlers.
- Static Protected Attributes inherited from VisAO::VisAOApp_base
static int control_mode = VisAOApp_base::CMODE_NONE
 The current control mode. More...
static int default_control_mode = -1
 The default control mode. More...

Detailed Description

Based on the Arcetri JoeCtrl class, this class works in nearly identical fashion except it passes commands to the CCD47Ctrl process instead of to the little joe.

Definition at line 41 of file VisAOJoeCtrl.h.

Member Function Documentation

void VisAO::JoeCtrl::StateChange ( int  oldstate,
int  state 

Used to invalidate CUR variables when losing connection Automatically called by AOApp when a state change occurs. Used here to invalidate "CUR" variables when losing connections

Definition at line 218 of file VisAOJoeCtrl.cpp.

References _ccdBlacks.

void VisAO::JoeCtrl::Run ( )

Switches the stage from one state to the other

Definition at line 235 of file VisAOJoeCtrl.cpp.

References DoFSM(), and TimeToDie.

int VisAO::JoeCtrl::DoFSM ( void  )

Switches the controller from one state to another. States can be changed asynchronously from this thread or the listening thread, and this function will properly react to a new state. Many states include a msleep() function to slow down the thread when immediate action is not necessary

Definition at line 257 of file VisAOJoeCtrl.cpp.

References TestCCD47CtrlLink().

Referenced by Run().

The documentation for this class was generated from the following files: